<?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: Problem with alert-triggered scripts for ServiceNow in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Problem-with-alert-triggered-scripts-for-ServiceNow/m-p/334871#M40217</link>
    <description>&lt;P&gt;Recently had the same issue and this solution worked - configuring an alert under the Splunk_TA_snow app to send an alert to SNOW (Splunk v6.4.8).&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;N.B.&lt;/STRONG&gt; For notification throttling to work I needed to use the snow_incident.py script instead of the snowincidentstream search command - which will, understandably, always alert in a saved search when search criteria matched.&lt;/P&gt;

&lt;P&gt;Anyway, I wanted my alerts configured under their own app so tried softlinking the Splunk_TA_snow/bin directory into my app's directory and, "&lt;EM&gt;voila&lt;/EM&gt;",  my app's scripted SNOW alerts started working.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ln -s ~splunk/etc/apps/Splunk_TA_snow/bin ~splunk/etc/apps/&amp;lt;myappname&amp;gt;/bin
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you could be bothered you could probably isolate the necessary Splunk_TA_snow/bin files to a smaller selection and just copy (or softlink) the ones you need into your app's bin (and bin/scripts) directory, but in my case I did not have a bin directory so softlinking the whole Splunk_TA_snow bin works well for me.  Also means any Splunk_TA_snow app upgrades should just work.&lt;/P&gt;

&lt;P&gt;Hope someone finds this useful too.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 18:54:09 GMT</pubDate>
    <dc:creator>gcato</dc:creator>
    <dc:date>2020-09-29T18:54:09Z</dc:date>
    <item>
      <title>Problem with alert-triggered scripts for ServiceNow</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Problem-with-alert-triggered-scripts-for-ServiceNow/m-p/334866#M40212</link>
      <description>&lt;P&gt;I am trying to get the alert-triggered script working but having some difficulties as I keep getting exit code 1 on the scripts. &lt;BR /&gt;
I'm not a python guy, so I'm unable to reverse-engineer the script, so hoping someone here can assist.&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;I've installed the Splunk TA for ServiceNow, and configured the logon creds (setting logging to DEBUG)&lt;/LI&gt;
&lt;LI&gt;I have &lt;EM&gt;not&lt;/EM&gt; configured any tables to be pulled down because I'm looking to push only.&lt;/LI&gt;
&lt;LI&gt;I ran the sample query from the documentation and it creates an Incident ticket in ServiceNow successfully:&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;&lt;CODE&gt;  | snowincident --category "Software" --contact_type "Phone"&lt;BR /&gt;
    --subcategory "Database" --short_description "CPU usage is high"&lt;BR /&gt;
    --ci_identifier "8214eb87c0a8018b7bd0919758dcc3c2" --priority 1&lt;BR /&gt;
    --splunk_url "hxxp://localhost:8000"&lt;/CODE&gt;&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;I copied the $SPLUNK_HOME/etc/apps/Splunk_TA_snow/bin/snow_incident.py script to $SPLUNK_HOME/etc/system/local/bin/scripts&lt;/LI&gt;
&lt;LI&gt;Have this alert setup to run every N minutes:&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;&lt;CODE&gt;    index=waf sourcetype=imperva_incapsula_cef sourceServiceName="www[dot]site[dot]com" | where isnull(cn1) | stats count as Timeouts | where Timeouts&amp;gt;50 | eval category="network" | eval contact_type="endpoint_security" | eval urgency=2 | eval impact=3 | eval short_description="Excessive timeouts (". Timeouts .") on www[dot]site[dot]com in the last hour" | table category, contact_type, short_description &lt;/CODE&gt;&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;This returns the following when run manually (added commas to improve legibility):
*&lt;EM&gt;category,     contact_type,       short_description   *&lt;/EM&gt;
network,    endpoint_security,  Excessive timeouts (138) on www[dot]site[dot]com in the last hour &lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Now, the alert fires, and calls the python script, but:&lt;BR /&gt;
a) There is never any debug output. I did a search for "eventtype=snow_*" over "All Time" and there are no results, so I must be failing long before the script gets to any significant portion&lt;BR /&gt;
b) looking through the _internal logs (e.g. index=_internal snow) I see "runshellscript" instances execute passing the results.csv.gz&lt;BR /&gt;
c) I get this error message:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ERROR script ... command="runshellscript", Script: /opt/splunk/bin/scripts/snow_incident.py exited with status code: 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Other things I've tried:&lt;BR /&gt;
- copying $SPLUNK_HOME/etc/apps/Splunk_TA_snow/bin/*.py to /opt/splunk/bin/scripts&lt;BR /&gt;
- copying $SPLUNK_HOME/etc/apps/Splunk_TA_snow/bin/script/snow_incident.py to /opt/splunk/bin/scripts&lt;BR /&gt;
* (as an aside, it's kinda dumb to have 2 separate scripts with different content named snow_incident.py in this TA) *&lt;/P&gt;

&lt;P&gt;No matter what I do, I get the status code:1 result.&lt;/P&gt;

&lt;P&gt;BTW, in case it matters, I'm running Ubuntu 16.04 and Splunk Enterprise 6.6.4&lt;/P&gt;

&lt;P&gt;Any help is appreciated...&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:11:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Problem-with-alert-triggered-scripts-for-ServiceNow/m-p/334866#M40212</guid>
      <dc:creator>gordo32</dc:creator>
      <dc:date>2020-09-29T17:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with alert-triggered scripts for ServiceNow</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Problem-with-alert-triggered-scripts-for-ServiceNow/m-p/334867#M40213</link>
      <description>&lt;P&gt;Hi Gordo32,&lt;/P&gt;

&lt;P&gt;Have you tried creating your alerts under the context of the Snow app and triggering the script from the default location? I had a similar issue trying to move the script to another location so I ended up just building my searches/alerts under the Splunk_TA_Snow app. &lt;/P&gt;

&lt;P&gt;Hope that helps. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:12:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Problem-with-alert-triggered-scripts-for-ServiceNow/m-p/334867#M40213</guid>
      <dc:creator>gstefancyk</dc:creator>
      <dc:date>2020-09-29T17:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with alert-triggered scripts for ServiceNow</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Problem-with-alert-triggered-scripts-for-ServiceNow/m-p/334868#M40214</link>
      <description>&lt;P&gt;Finally found some time to test - and that solved it. Thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Dec 2017 14:23:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Problem-with-alert-triggered-scripts-for-ServiceNow/m-p/334868#M40214</guid>
      <dc:creator>gordo32</dc:creator>
      <dc:date>2017-12-17T14:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with alert-triggered scripts for ServiceNow</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Problem-with-alert-triggered-scripts-for-ServiceNow/m-p/334869#M40215</link>
      <description>&lt;P&gt;Facing same issue. Can you please tell how did you solve that issue?&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 05:58:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Problem-with-alert-triggered-scripts-for-ServiceNow/m-p/334869#M40215</guid>
      <dc:creator>PriyankaArivala</dc:creator>
      <dc:date>2018-02-02T05:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with alert-triggered scripts for ServiceNow</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Problem-with-alert-triggered-scripts-for-ServiceNow/m-p/334870#M40216</link>
      <description>&lt;P&gt;Yes, as gstefancyk pointed out, after moving the Alert from being under the security context of the Search app over to the context of the SNOW add-on resolved the issue.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 21:10:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Problem-with-alert-triggered-scripts-for-ServiceNow/m-p/334870#M40216</guid>
      <dc:creator>gordo32</dc:creator>
      <dc:date>2018-02-02T21:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with alert-triggered scripts for ServiceNow</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Problem-with-alert-triggered-scripts-for-ServiceNow/m-p/334871#M40217</link>
      <description>&lt;P&gt;Recently had the same issue and this solution worked - configuring an alert under the Splunk_TA_snow app to send an alert to SNOW (Splunk v6.4.8).&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;N.B.&lt;/STRONG&gt; For notification throttling to work I needed to use the snow_incident.py script instead of the snowincidentstream search command - which will, understandably, always alert in a saved search when search criteria matched.&lt;/P&gt;

&lt;P&gt;Anyway, I wanted my alerts configured under their own app so tried softlinking the Splunk_TA_snow/bin directory into my app's directory and, "&lt;EM&gt;voila&lt;/EM&gt;",  my app's scripted SNOW alerts started working.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ln -s ~splunk/etc/apps/Splunk_TA_snow/bin ~splunk/etc/apps/&amp;lt;myappname&amp;gt;/bin
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you could be bothered you could probably isolate the necessary Splunk_TA_snow/bin files to a smaller selection and just copy (or softlink) the ones you need into your app's bin (and bin/scripts) directory, but in my case I did not have a bin directory so softlinking the whole Splunk_TA_snow bin works well for me.  Also means any Splunk_TA_snow app upgrades should just work.&lt;/P&gt;

&lt;P&gt;Hope someone finds this useful too.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:54:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Problem-with-alert-triggered-scripts-for-ServiceNow/m-p/334871#M40217</guid>
      <dc:creator>gcato</dc:creator>
      <dc:date>2020-09-29T18:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with alert-triggered scripts for ServiceNow</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Problem-with-alert-triggered-scripts-for-ServiceNow/m-p/334872#M40218</link>
      <description>&lt;P&gt;Is there any way to create SNOW incidents without the use of Service NOW add-on? I want to use the REST API's exposed by SNOW to create the incident but not sure of to call them via alert action. Any comments on this topic would be of great help.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Feb 2019 12:28:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Problem-with-alert-triggered-scripts-for-ServiceNow/m-p/334872#M40218</guid>
      <dc:creator>santosh_sshanbh</dc:creator>
      <dc:date>2019-02-06T12:28:18Z</dc:date>
    </item>
  </channel>
</rss>

