<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Button to pause then resume email alerting in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Button-to-pause-then-resume-email-alerting/m-p/220557#M4032</link>
    <description>&lt;P&gt;This is what I ended up doing.&lt;/P&gt;

&lt;P&gt;Configure a dashboard panel with a time dropdown and a status reading&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1087i5D2C8AB587449B97/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1088iE734182705D563D8/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;The panel code looks like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;panel&amp;gt;
  &amp;lt;input type="dropdown" token="value1" searchWhenChanged="true"&amp;gt;
    &amp;lt;label&amp;gt;Pause Email Alerting&amp;lt;/label&amp;gt;
    &amp;lt;choice value="0"&amp;gt;Resume&amp;lt;/choice&amp;gt;
    &amp;lt;choice value="900"&amp;gt;15 min&amp;lt;/choice&amp;gt;
    &amp;lt;choice value="1800"&amp;gt;30 min&amp;lt;/choice&amp;gt;
    &amp;lt;choice value="3600"&amp;gt;1 hour&amp;lt;/choice&amp;gt;
    &amp;lt;choice value="7200"&amp;gt;2 hours&amp;lt;/choice&amp;gt;
    &amp;lt;choice value="14400"&amp;gt;4 hours&amp;lt;/choice&amp;gt;
    &amp;lt;choice value="28800"&amp;gt;8 hours&amp;lt;/choice&amp;gt;
    &amp;lt;choice value="57600"&amp;gt;16 hours&amp;lt;/choice&amp;gt;
    &amp;lt;choice value="115200"&amp;gt;24 hours&amp;lt;/choice&amp;gt;
    &amp;lt;choice value="230400"&amp;gt;48 hours&amp;lt;/choice&amp;gt;
    &amp;lt;default&amp;gt;0&amp;lt;/default&amp;gt;
    &amp;lt;initialValue&amp;gt;0&amp;lt;/initialValue&amp;gt;
  &amp;lt;/input&amp;gt;
  &amp;lt;single&amp;gt;
    &amp;lt;title&amp;gt;Email Alerting Status&amp;lt;/title&amp;gt;
    &amp;lt;search&amp;gt;
      &amp;lt;query&amp;gt;| inputlookup alert-pause-status.csv&amp;lt;/query&amp;gt;
      &amp;lt;earliest&amp;gt;-1s&amp;lt;/earliest&amp;gt;
      &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
    &amp;lt;/search&amp;gt;
    &amp;lt;option name="height"&amp;gt;10&amp;lt;/option&amp;gt;
    &amp;lt;option name="link.visible"&amp;gt;false&amp;lt;/option&amp;gt;
    &amp;lt;option name="refresh.time.visible"&amp;gt;false&amp;lt;/option&amp;gt;
    &amp;lt;option name="refresh.auto.interval"&amp;gt;5&amp;lt;/option&amp;gt;
  &amp;lt;/single&amp;gt;
&amp;lt;/panel&amp;gt;
&amp;lt;panel depends="$nothing1$"&amp;gt;
  &amp;lt;single&amp;gt;  
    &amp;lt;search&amp;gt;
      &amp;lt;query&amp;gt;| alertemailoff $value1$&amp;lt;/query&amp;gt;
      &amp;lt;earliest&amp;gt;-1s&amp;lt;/earliest&amp;gt;
      &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
    &amp;lt;/search&amp;gt;
    &amp;lt;option name="height"&amp;gt;10&amp;lt;/option&amp;gt;
    &amp;lt;option name="link.visible"&amp;gt;false&amp;lt;/option&amp;gt;
    &amp;lt;option name="refresh.time.visible"&amp;gt;false&amp;lt;/option&amp;gt;
    &amp;lt;option name="refresh.auto.interval"&amp;gt;15&amp;lt;/option&amp;gt;
  &amp;lt;/single&amp;gt;
&amp;lt;/panel&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then I configure commands.conf in the apps local dir to point at a perl script&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; [alertemailoff]
 filename = pause-splunk-alerting.pl
 type = perl
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Create a file called alert-pause-status.csv in the apps lookup dir&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;status
active
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then create a perl script to do the editing of the savedsearches.conf file and reload the config&lt;BR /&gt;
Please forgive my very crude perl script, if anyone wants to rewrite and post be my guest.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#!/usr/bin/perl
$file = "/opt/splunk/etc/apps/eproduct/local/savedsearches.conf";
$status = "/opt/splunk/etc/apps/eproduct/lookups/alert-pause-status.csv";
$statustas = "/opt/splunk/etc/apps/tasman/lookups/alert-pause-status.csv";
$pausefor = $ARGV[0];
$check = $$;
$pid = "/opt/splunk/etc/apps/eproduct/bin/pause-splunk-alerting.pid";

use POSIX qw( strftime );
my $finish = strftime("%a %H:%M", localtime(time + $pausefor));

if($pausefor!=0){
    if(`ps -ef | egrep -v "grep|$check" | grep pause-splunk-alerting.pl`)                                                                              {
        print "Process Exists Exiting\n";
        exit;
    }else{
                open(PID, "&amp;gt; $pid") || die "could not open '$pid'  $!";
                print PID "$$\n";
                close(PID);
        print "Starting Process\n";
    }
}else{
        open (IN, $pid) || die "Cannot open file ".$pid." for read";
        $killpid = &amp;lt;IN&amp;gt;;
        close IN;
        `kill $killpid`;
        print "Resume Alerting\n";
        `rm $pid`;
}


open (IN, $file) || die "Cannot open file ".$file." for read";
@lines=&amp;lt;IN&amp;gt;;
close IN;

open (OUT, "&amp;gt;", $file) || die "Cannot open file ".$file." for write";
foreach $line (@lines)
{
   $line =~ s/action.email = 1/action.email = false/ig;
   print OUT $line;
}
close OUT;

open (IN, $status) || die "Cannot open file ".$status." for read";
@lines=&amp;lt;IN&amp;gt;;
close IN;

open (OUT, "&amp;gt;", $status) || die "Cannot open file ".$status." for write";
foreach $line (@lines)
{
   $line =~ s/active/paused til $finish/ig;
   print OUT $line;
}
close OUT;

open (IN, $statustas) || die "Cannot open file ".$statustas." for read";
@lines=&amp;lt;IN&amp;gt;;
close IN;

open (OUT, "&amp;gt;", $statustas) || die "Cannot open file ".$statustas." for write";
foreach $line (@lines)
{
   $line =~ s/active/paused til $finish/ig;
   print OUT $line;
}
close OUT;

`/opt/splunk/bin/splunk _internal call /services/saved/searches/_reload -auth &amp;lt;splunk admin&amp;gt;:&amp;lt;password&amp;gt;`;

sleep($pausefor);

open (IN, $file) || die "Cannot open file ".$file." for read";
@lines=&amp;lt;IN&amp;gt;;
close IN;

open (OUT, "&amp;gt;", $file) || die "Cannot open file ".$file." for write";
foreach $line (@lines)
{
   $line =~ s/action.email = false/action.email = 1/ig;
   print OUT $line;
}
close OUT;

open (IN, $status) || die "Cannot open file ".$status." for read";
@lines=&amp;lt;IN&amp;gt;;
close IN;

open (OUT, "&amp;gt;", $status) || die "Cannot open file ".$status." for write";
foreach $line (@lines)
{
   $line =~ s/paused.*$/active/ig;
   print OUT $line;
}
close OUT;

open (IN, $statustas) || die "Cannot open file ".$statustas." for read";
@lines=&amp;lt;IN&amp;gt;;
close IN;

open (OUT, "&amp;gt;", $statustas) || die "Cannot open file ".$statustas." for write";
foreach $line (@lines)
{
   $line =~ s/paused.*$/active/ig;
   print OUT $line;
}
close OUT;

`/opt/splunk/bin/splunk _internal call /services/saved/searches/_reload -auth &amp;lt;splunk admin&amp;gt;:&amp;lt;password&amp;gt;`;

`rm $pid`;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now when you select a time from the dropdown it runs the perl script, changes the savedsearches.conf "action.email = 1" to "action.email = false" then changed the status file from active to "paused til ..." reloads the config then sleeps for the desired time and puts everything back again.&lt;/P&gt;

&lt;P&gt;You can also select Resume from the dropdown to put it all back and resume email alerts.&lt;/P&gt;

&lt;P&gt;Crude but effective, any improvements are welcome.&lt;/P&gt;

&lt;P&gt;Cheers&lt;/P&gt;</description>
    <pubDate>Mon, 29 Feb 2016 01:03:56 GMT</pubDate>
    <dc:creator>proylea</dc:creator>
    <dc:date>2016-02-29T01:03:56Z</dc:date>
    <item>
      <title>Button to pause then resume email alerting</title>
      <link>https://community.splunk.com/t5/Alerting/Button-to-pause-then-resume-email-alerting/m-p/220550#M4025</link>
      <description>&lt;P&gt;Hi Everyone&lt;BR /&gt;
I have been asked to look into the possibility of having a button on the dashboard that will allow the user to pause splunks email alerting during an outage or scheduled downtime etc.&lt;/P&gt;

&lt;P&gt;I am thinking along the lines of a dashboard button that fires a script that would use sed to edit the specified savedsearches.conf file and change the email alert field to 0, then change it back to 1 when the the button is pressed again.&lt;/P&gt;

&lt;P&gt;I would like to know if anyone has done this and what the other options might be.&lt;/P&gt;

&lt;P&gt;Kind Regards&lt;BR /&gt;
Peter&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 01:59:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Button-to-pause-then-resume-email-alerting/m-p/220550#M4025</guid>
      <dc:creator>proylea</dc:creator>
      <dc:date>2016-02-24T01:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: Button to pause then resume email alerting</title>
      <link>https://community.splunk.com/t5/Alerting/Button-to-pause-then-resume-email-alerting/m-p/220551#M4026</link>
      <description>&lt;P&gt;Cool idea! &lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 02:43:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Button-to-pause-then-resume-email-alerting/m-p/220551#M4026</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2016-02-24T02:43:23Z</dc:date>
    </item>
    <item>
      <title>Re: Button to pause then resume email alerting</title>
      <link>https://community.splunk.com/t5/Alerting/Button-to-pause-then-resume-email-alerting/m-p/220552#M4027</link>
      <description>&lt;P&gt;Actually most monitoring and alerting systems have it as standard functionality, perhaps Splunk could consider an update&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 03:04:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Button-to-pause-then-resume-email-alerting/m-p/220552#M4027</guid>
      <dc:creator>proylea</dc:creator>
      <dc:date>2016-02-24T03:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: Button to pause then resume email alerting</title>
      <link>https://community.splunk.com/t5/Alerting/Button-to-pause-then-resume-email-alerting/m-p/220553#M4028</link>
      <description>&lt;P&gt;The easiest way is to misconfigure (break) the &lt;CODE&gt;System Settings&lt;/CODE&gt; -&amp;gt; &lt;CODE&gt;Email Alert Settings&lt;/CODE&gt; -&amp;gt; &lt;CODE&gt;Mail Server Settings&lt;/CODE&gt;.  For example, change &lt;CODE&gt;Mail Host&lt;/CODE&gt; to something like &lt;CODE&gt;ThisHostIsDeliberatelyBrokenUntilOutageIsFixed-ChangeItBackToASAP&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 28 Feb 2016 22:07:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Button-to-pause-then-resume-email-alerting/m-p/220553#M4028</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-02-28T22:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: Button to pause then resume email alerting</title>
      <link>https://community.splunk.com/t5/Alerting/Button-to-pause-then-resume-email-alerting/m-p/220554#M4029</link>
      <description>&lt;P&gt;Hi proylea,&lt;/P&gt;

&lt;P&gt;You can run a REST POST against this endpoint:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/servicesNS/nobody/search/alerts/alert_actions/email
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and change it to some non existing value like @woodcock mentioned. So a working example would be:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -k -u admin:changeme &lt;A href="https://localhost:8089/servicesNS/nobody/search/alerts/alert_actions/email" target="test_blank"&gt;https://localhost:8089/servicesNS/nobody/search/alerts/alert_actions/email&lt;/A&gt; -d mailserver=foobar
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This can be also used in a custom search command or an external script; as always it depends on your use case &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Sun, 28 Feb 2016 23:31:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Button-to-pause-then-resume-email-alerting/m-p/220554#M4029</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2016-02-28T23:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: Button to pause then resume email alerting</title>
      <link>https://community.splunk.com/t5/Alerting/Button-to-pause-then-resume-email-alerting/m-p/220555#M4030</link>
      <description>&lt;P&gt;Yes that would be ok but I don't want to disable all email alerts only the specific ones related to the apps.&lt;BR /&gt;
I have a working solution now it's crude but it works.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Feb 2016 00:47:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Button-to-pause-then-resume-email-alerting/m-p/220555#M4030</guid>
      <dc:creator>proylea</dc:creator>
      <dc:date>2016-02-29T00:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: Button to pause then resume email alerting</title>
      <link>https://community.splunk.com/t5/Alerting/Button-to-pause-then-resume-email-alerting/m-p/220556#M4031</link>
      <description>&lt;P&gt;Most of the time, I create a lookup table which holds &lt;CODE&gt;server names&lt;/CODE&gt; and &lt;CODE&gt;alert_status&lt;/CODE&gt; like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;server, alert_status
foo,active
boo,down
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and use a automatic lookup. All the alerts are saved and include the field &lt;CODE&gt;alert_status="active"&lt;/CODE&gt; in the base search. This way you can set only some servers in &lt;CODE&gt;maintenance mode&lt;/CODE&gt; while others are still active.&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Mon, 29 Feb 2016 00:51:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Button-to-pause-then-resume-email-alerting/m-p/220556#M4031</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2016-02-29T00:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: Button to pause then resume email alerting</title>
      <link>https://community.splunk.com/t5/Alerting/Button-to-pause-then-resume-email-alerting/m-p/220557#M4032</link>
      <description>&lt;P&gt;This is what I ended up doing.&lt;/P&gt;

&lt;P&gt;Configure a dashboard panel with a time dropdown and a status reading&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1087i5D2C8AB587449B97/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1088iE734182705D563D8/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;The panel code looks like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;panel&amp;gt;
  &amp;lt;input type="dropdown" token="value1" searchWhenChanged="true"&amp;gt;
    &amp;lt;label&amp;gt;Pause Email Alerting&amp;lt;/label&amp;gt;
    &amp;lt;choice value="0"&amp;gt;Resume&amp;lt;/choice&amp;gt;
    &amp;lt;choice value="900"&amp;gt;15 min&amp;lt;/choice&amp;gt;
    &amp;lt;choice value="1800"&amp;gt;30 min&amp;lt;/choice&amp;gt;
    &amp;lt;choice value="3600"&amp;gt;1 hour&amp;lt;/choice&amp;gt;
    &amp;lt;choice value="7200"&amp;gt;2 hours&amp;lt;/choice&amp;gt;
    &amp;lt;choice value="14400"&amp;gt;4 hours&amp;lt;/choice&amp;gt;
    &amp;lt;choice value="28800"&amp;gt;8 hours&amp;lt;/choice&amp;gt;
    &amp;lt;choice value="57600"&amp;gt;16 hours&amp;lt;/choice&amp;gt;
    &amp;lt;choice value="115200"&amp;gt;24 hours&amp;lt;/choice&amp;gt;
    &amp;lt;choice value="230400"&amp;gt;48 hours&amp;lt;/choice&amp;gt;
    &amp;lt;default&amp;gt;0&amp;lt;/default&amp;gt;
    &amp;lt;initialValue&amp;gt;0&amp;lt;/initialValue&amp;gt;
  &amp;lt;/input&amp;gt;
  &amp;lt;single&amp;gt;
    &amp;lt;title&amp;gt;Email Alerting Status&amp;lt;/title&amp;gt;
    &amp;lt;search&amp;gt;
      &amp;lt;query&amp;gt;| inputlookup alert-pause-status.csv&amp;lt;/query&amp;gt;
      &amp;lt;earliest&amp;gt;-1s&amp;lt;/earliest&amp;gt;
      &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
    &amp;lt;/search&amp;gt;
    &amp;lt;option name="height"&amp;gt;10&amp;lt;/option&amp;gt;
    &amp;lt;option name="link.visible"&amp;gt;false&amp;lt;/option&amp;gt;
    &amp;lt;option name="refresh.time.visible"&amp;gt;false&amp;lt;/option&amp;gt;
    &amp;lt;option name="refresh.auto.interval"&amp;gt;5&amp;lt;/option&amp;gt;
  &amp;lt;/single&amp;gt;
&amp;lt;/panel&amp;gt;
&amp;lt;panel depends="$nothing1$"&amp;gt;
  &amp;lt;single&amp;gt;  
    &amp;lt;search&amp;gt;
      &amp;lt;query&amp;gt;| alertemailoff $value1$&amp;lt;/query&amp;gt;
      &amp;lt;earliest&amp;gt;-1s&amp;lt;/earliest&amp;gt;
      &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
    &amp;lt;/search&amp;gt;
    &amp;lt;option name="height"&amp;gt;10&amp;lt;/option&amp;gt;
    &amp;lt;option name="link.visible"&amp;gt;false&amp;lt;/option&amp;gt;
    &amp;lt;option name="refresh.time.visible"&amp;gt;false&amp;lt;/option&amp;gt;
    &amp;lt;option name="refresh.auto.interval"&amp;gt;15&amp;lt;/option&amp;gt;
  &amp;lt;/single&amp;gt;
&amp;lt;/panel&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then I configure commands.conf in the apps local dir to point at a perl script&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; [alertemailoff]
 filename = pause-splunk-alerting.pl
 type = perl
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Create a file called alert-pause-status.csv in the apps lookup dir&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;status
active
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then create a perl script to do the editing of the savedsearches.conf file and reload the config&lt;BR /&gt;
Please forgive my very crude perl script, if anyone wants to rewrite and post be my guest.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#!/usr/bin/perl
$file = "/opt/splunk/etc/apps/eproduct/local/savedsearches.conf";
$status = "/opt/splunk/etc/apps/eproduct/lookups/alert-pause-status.csv";
$statustas = "/opt/splunk/etc/apps/tasman/lookups/alert-pause-status.csv";
$pausefor = $ARGV[0];
$check = $$;
$pid = "/opt/splunk/etc/apps/eproduct/bin/pause-splunk-alerting.pid";

use POSIX qw( strftime );
my $finish = strftime("%a %H:%M", localtime(time + $pausefor));

if($pausefor!=0){
    if(`ps -ef | egrep -v "grep|$check" | grep pause-splunk-alerting.pl`)                                                                              {
        print "Process Exists Exiting\n";
        exit;
    }else{
                open(PID, "&amp;gt; $pid") || die "could not open '$pid'  $!";
                print PID "$$\n";
                close(PID);
        print "Starting Process\n";
    }
}else{
        open (IN, $pid) || die "Cannot open file ".$pid." for read";
        $killpid = &amp;lt;IN&amp;gt;;
        close IN;
        `kill $killpid`;
        print "Resume Alerting\n";
        `rm $pid`;
}


open (IN, $file) || die "Cannot open file ".$file." for read";
@lines=&amp;lt;IN&amp;gt;;
close IN;

open (OUT, "&amp;gt;", $file) || die "Cannot open file ".$file." for write";
foreach $line (@lines)
{
   $line =~ s/action.email = 1/action.email = false/ig;
   print OUT $line;
}
close OUT;

open (IN, $status) || die "Cannot open file ".$status." for read";
@lines=&amp;lt;IN&amp;gt;;
close IN;

open (OUT, "&amp;gt;", $status) || die "Cannot open file ".$status." for write";
foreach $line (@lines)
{
   $line =~ s/active/paused til $finish/ig;
   print OUT $line;
}
close OUT;

open (IN, $statustas) || die "Cannot open file ".$statustas." for read";
@lines=&amp;lt;IN&amp;gt;;
close IN;

open (OUT, "&amp;gt;", $statustas) || die "Cannot open file ".$statustas." for write";
foreach $line (@lines)
{
   $line =~ s/active/paused til $finish/ig;
   print OUT $line;
}
close OUT;

`/opt/splunk/bin/splunk _internal call /services/saved/searches/_reload -auth &amp;lt;splunk admin&amp;gt;:&amp;lt;password&amp;gt;`;

sleep($pausefor);

open (IN, $file) || die "Cannot open file ".$file." for read";
@lines=&amp;lt;IN&amp;gt;;
close IN;

open (OUT, "&amp;gt;", $file) || die "Cannot open file ".$file." for write";
foreach $line (@lines)
{
   $line =~ s/action.email = false/action.email = 1/ig;
   print OUT $line;
}
close OUT;

open (IN, $status) || die "Cannot open file ".$status." for read";
@lines=&amp;lt;IN&amp;gt;;
close IN;

open (OUT, "&amp;gt;", $status) || die "Cannot open file ".$status." for write";
foreach $line (@lines)
{
   $line =~ s/paused.*$/active/ig;
   print OUT $line;
}
close OUT;

open (IN, $statustas) || die "Cannot open file ".$statustas." for read";
@lines=&amp;lt;IN&amp;gt;;
close IN;

open (OUT, "&amp;gt;", $statustas) || die "Cannot open file ".$statustas." for write";
foreach $line (@lines)
{
   $line =~ s/paused.*$/active/ig;
   print OUT $line;
}
close OUT;

`/opt/splunk/bin/splunk _internal call /services/saved/searches/_reload -auth &amp;lt;splunk admin&amp;gt;:&amp;lt;password&amp;gt;`;

`rm $pid`;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now when you select a time from the dropdown it runs the perl script, changes the savedsearches.conf "action.email = 1" to "action.email = false" then changed the status file from active to "paused til ..." reloads the config then sleeps for the desired time and puts everything back again.&lt;/P&gt;

&lt;P&gt;You can also select Resume from the dropdown to put it all back and resume email alerts.&lt;/P&gt;

&lt;P&gt;Crude but effective, any improvements are welcome.&lt;/P&gt;

&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Mon, 29 Feb 2016 01:03:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Button-to-pause-then-resume-email-alerting/m-p/220557#M4032</guid>
      <dc:creator>proylea</dc:creator>
      <dc:date>2016-02-29T01:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: Button to pause then resume email alerting</title>
      <link>https://community.splunk.com/t5/Alerting/Button-to-pause-then-resume-email-alerting/m-p/220558#M4033</link>
      <description>&lt;P&gt;Nice !&lt;/P&gt;

&lt;P&gt;I removed your admin password from the script &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Feb 2016 01:07:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Button-to-pause-then-resume-email-alerting/m-p/220558#M4033</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2016-02-29T01:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: Button to pause then resume email alerting</title>
      <link>https://community.splunk.com/t5/Alerting/Button-to-pause-then-resume-email-alerting/m-p/220559#M4034</link>
      <description>&lt;P&gt;Yeh those credentials would be hit and miss for sure lol!&lt;/P&gt;</description>
      <pubDate>Mon, 29 Feb 2016 04:04:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Button-to-pause-then-resume-email-alerting/m-p/220559#M4034</guid>
      <dc:creator>proylea</dc:creator>
      <dc:date>2016-02-29T04:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: Button to pause then resume email alerting</title>
      <link>https://community.splunk.com/t5/Alerting/Button-to-pause-then-resume-email-alerting/m-p/220560#M4035</link>
      <description>&lt;P&gt;Yeh I use similar lookups to do alerting ack and clear type functionality.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Feb 2016 04:05:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Button-to-pause-then-resume-email-alerting/m-p/220560#M4035</guid>
      <dc:creator>proylea</dc:creator>
      <dc:date>2016-02-29T04:05:09Z</dc:date>
    </item>
  </channel>
</rss>

