<?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: Alert script and severity in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Alert-script-and-severity/m-p/93109#M1335</link>
    <description>&lt;P&gt;So, i asked the dev for this particular piece of code, and it can be done.&lt;/P&gt;

&lt;P&gt;1 - Need to modify alert_actions.conf to pass a 9th argument as &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;$alert.severity$&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;get the name from savedsearches.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;gt; alert.severity = &amp;lt;int&amp;gt;
&amp;gt; * Sets the alert severity level.
&amp;gt; * Valid values are: 1-debug, 2-info, 3-warn, 4-error, 5-severe, 6-fatal
&amp;gt; * Defaults to 3.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2 - you need to modify runshellscript to account for this 9th argument.&lt;/P&gt;

&lt;P&gt;Im no coder, but a quick look tells me at least one thing you need to change. From the runshellscript.py:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    # make sure cmd_args has length of 9
    cmd_args    = cmd_args[:9]
    for i in xrange(9-len(cmd_args)):
       cmd_args.append("")
    cmd_args[0] = script
    cmd_args[8] = path
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Might want to test it out before you change it..&lt;/P&gt;</description>
    <pubDate>Tue, 20 Dec 2011 01:23:50 GMT</pubDate>
    <dc:creator>Genti</dc:creator>
    <dc:date>2011-12-20T01:23:50Z</dc:date>
    <item>
      <title>Alert script and severity</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-script-and-severity/m-p/93107#M1333</link>
      <description>&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Admin/Configurescriptedalerts"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Admin/Configurescriptedalerts&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;says that &lt;/P&gt;

&lt;P&gt;The command line arguments that Splunk passes to the script are:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$0 = Script name
$1 = Number of events returned
$2 = Search terms
$3 = Fully qualified query string
$4 = Name of saved search
$5 = Trigger reason (i.e. "The number of events was greater than 1")
$6 = Browser URL to view the saved search
$7 = This option has been deprecated and is no longer used
$8 = File where the results for this search are stored (contains raw results)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So, I've got a couple of snippets of info, but I want to send the severity that I set in splunk to be passed (if it can't what's the point of having that field, right?&lt;/P&gt;

&lt;P&gt;Is there a way to pass the severity along to the script? If I put some arguments after the script will they be passed as $9 ??&lt;/P&gt;

&lt;P&gt;FYI, I'm passing this to a bash script that simply calls zensedevent.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2011 18:09:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-script-and-severity/m-p/93107#M1333</guid>
      <dc:creator>nicco</dc:creator>
      <dc:date>2011-10-17T18:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: Alert script and severity</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-script-and-severity/m-p/93108#M1334</link>
      <description>&lt;P&gt;No. I guess I'll just have to have a few scripts for the various severity levels.&lt;/P&gt;

&lt;P&gt;Here's the answer:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/4.2.3/user/SchedulingSavedSearches"&gt;http://docs.splunk.com/Documentation/Splunk/4.2.3/user/SchedulingSavedSearches&lt;/A&gt;&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;Severity labels are informational in purpose and have no additional functionality. You can use them to quickly pick out important alerts from the alert listing on the Alerts page, which you can get to by clicking the Alerts link in the upper right-hand corner of the Splunk interface.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Severity labels are informational in purpose and have no additional functionality. You can use them to quickly pick out important alerts from the alert listing on the Alerts page, which you can get to by clicking the Alerts link in the upper right-hand corner of the Splunk interface.&lt;/P&gt;

&lt;P&gt;And... If you try to add additional arguments they don't get passed as arguments, but as the script name itself:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;10-18-2011 00:03:50.562 +0000 ERROR script - command="runshellscript", Cannot find script at /opt/splunk/bin/scripts/alert_splunk_troubleshoot.sh foofoofoo&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2011 00:07:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-script-and-severity/m-p/93108#M1334</guid>
      <dc:creator>nicco</dc:creator>
      <dc:date>2011-10-18T00:07:38Z</dc:date>
    </item>
    <item>
      <title>Re: Alert script and severity</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-script-and-severity/m-p/93109#M1335</link>
      <description>&lt;P&gt;So, i asked the dev for this particular piece of code, and it can be done.&lt;/P&gt;

&lt;P&gt;1 - Need to modify alert_actions.conf to pass a 9th argument as &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;$alert.severity$&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;get the name from savedsearches.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;gt; alert.severity = &amp;lt;int&amp;gt;
&amp;gt; * Sets the alert severity level.
&amp;gt; * Valid values are: 1-debug, 2-info, 3-warn, 4-error, 5-severe, 6-fatal
&amp;gt; * Defaults to 3.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2 - you need to modify runshellscript to account for this 9th argument.&lt;/P&gt;

&lt;P&gt;Im no coder, but a quick look tells me at least one thing you need to change. From the runshellscript.py:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    # make sure cmd_args has length of 9
    cmd_args    = cmd_args[:9]
    for i in xrange(9-len(cmd_args)):
       cmd_args.append("")
    cmd_args[0] = script
    cmd_args[8] = path
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Might want to test it out before you change it..&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2011 01:23:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-script-and-severity/m-p/93109#M1335</guid>
      <dc:creator>Genti</dc:creator>
      <dc:date>2011-12-20T01:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: Alert script and severity</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-script-and-severity/m-p/93110#M1336</link>
      <description>&lt;P&gt;Did you have any luck with this? I am trying to do the same thing and have gotten stuck.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2012 14:41:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-script-and-severity/m-p/93110#M1336</guid>
      <dc:creator>dcparker</dc:creator>
      <dc:date>2012-07-12T14:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: Alert script and severity</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-script-and-severity/m-p/93111#M1337</link>
      <description>&lt;P&gt;ive had people successfully do it with the above instructions.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2012 15:14:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-script-and-severity/m-p/93111#M1337</guid>
      <dc:creator>Genti</dc:creator>
      <dc:date>2012-07-12T15:14:01Z</dc:date>
    </item>
    <item>
      <title>Re: Alert script and severity</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-script-and-severity/m-p/93112#M1338</link>
      <description>&lt;P&gt;Another approach I've been using is to simply use a small number of alert scripts. The severity of the alert is encoded in the name of the script, e.g. alert2mgr_low, alert2mgr_medium and so on.&lt;/P&gt;

&lt;P&gt;For the script, I have one common script which examines its name, the $0 argument, looking for 'low', 'medium', 'high', etc and encodes the appropriate severity into our alert manager. The only cost then is a bunch of links from the various names to the one script. &lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:34:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-script-and-severity/m-p/93112#M1338</guid>
      <dc:creator>enno</dc:creator>
      <dc:date>2020-09-28T19:34:07Z</dc:date>
    </item>
  </channel>
</rss>

