<?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: ERROR ScriptRunner - stderr from 'C:\Splunk\etc\apps\search\bin\runshellscript.py':  ImportError: No module named site in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/ERROR-ScriptRunner-stderr-from-C-Splunk-etc-apps-search-bin/m-p/100796#M1454</link>
    <description>&lt;P&gt;I solved the question.&lt;/P&gt;

&lt;P&gt;I put the myalert.py into the %SPLUNK_HOME%\etc\app\search\bin directory, then edit the %SPLUNK_HOME%\etc\app\search\default\commands.conf, add the following section:&lt;/P&gt;

&lt;P&gt;[myalert]&lt;BR /&gt;
filename = myalert.py&lt;/P&gt;

&lt;P&gt;then the script running correct where the alert is triggered. &lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 11:35:05 GMT</pubDate>
    <dc:creator>ycwubin</dc:creator>
    <dc:date>2020-09-28T11:35:05Z</dc:date>
    <item>
      <title>ERROR ScriptRunner - stderr from 'C:\Splunk\etc\apps\search\bin\runshellscript.py':  ImportError: No module named site</title>
      <link>https://community.splunk.com/t5/Alerting/ERROR-ScriptRunner-stderr-from-C-Splunk-etc-apps-search-bin/m-p/100795#M1453</link>
      <description>&lt;P&gt;I config a scripted alert, then i put the myalert.py into $SPLUNK_HOME\bin\scripts. But when alert is trigger, the script execute error(in splunkd.log):&lt;BR /&gt;
ERROR ScriptRunner - stderr from 'C:\Splunk\etc\apps\search\bin\runshellscript.py':  ImportError: No module named site&lt;/P&gt;

&lt;P&gt;Splunk Version is 4.3.0&lt;BR /&gt;
Why?&lt;BR /&gt;&lt;BR /&gt;
Thanks lots.&lt;/P&gt;

&lt;P&gt;SavedSearch:&lt;BR /&gt;
[WebServerMini-alert-script]&lt;BR /&gt;
action.email.inline = 1&lt;BR /&gt;
action.email.reportServerEnabled = 0&lt;BR /&gt;
action.script = 1&lt;BR /&gt;
action.script.filename = myalert.py&lt;BR /&gt;
alert.digest_mode = True&lt;BR /&gt;
alert.severity = 4&lt;BR /&gt;
alert.suppress = 0&lt;BR /&gt;
alert.suppress.period = 5s&lt;BR /&gt;
alert.track = 1&lt;BR /&gt;
counttype = number of events&lt;BR /&gt;
cron_schedule = * * * * *&lt;BR /&gt;
dispatch.earliest_time = -1m@m&lt;BR /&gt;
dispatch.latest_time = @m&lt;BR /&gt;
displayview = flashtimeline&lt;BR /&gt;
enableSched = 1&lt;BR /&gt;
quantity = 0&lt;BR /&gt;
relation = greater than&lt;BR /&gt;
request.ui_dispatch_view = flashtimeline&lt;BR /&gt;
search = index=fschangemonitor sourcetype="WINSERVER1-Web-Mini"&lt;BR /&gt;
vsid = gz0wf600&lt;/P&gt;

&lt;P&gt;myalert.py:&lt;BR /&gt;
import sys&lt;/P&gt;

&lt;P&gt;f = open("argv.txt", "w")&lt;BR /&gt;
for var in sys.argv:&lt;BR /&gt;
    f.write(var + "\n")&lt;BR /&gt;
f.close()&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:34:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/ERROR-ScriptRunner-stderr-from-C-Splunk-etc-apps-search-bin/m-p/100795#M1453</guid>
      <dc:creator>ycwubin</dc:creator>
      <dc:date>2020-09-28T11:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR ScriptRunner - stderr from 'C:\Splunk\etc\apps\search\bin\runshellscript.py':  ImportError: No module named site</title>
      <link>https://community.splunk.com/t5/Alerting/ERROR-ScriptRunner-stderr-from-C-Splunk-etc-apps-search-bin/m-p/100796#M1454</link>
      <description>&lt;P&gt;I solved the question.&lt;/P&gt;

&lt;P&gt;I put the myalert.py into the %SPLUNK_HOME%\etc\app\search\bin directory, then edit the %SPLUNK_HOME%\etc\app\search\default\commands.conf, add the following section:&lt;/P&gt;

&lt;P&gt;[myalert]&lt;BR /&gt;
filename = myalert.py&lt;/P&gt;

&lt;P&gt;then the script running correct where the alert is triggered. &lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:35:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/ERROR-ScriptRunner-stderr-from-C-Splunk-etc-apps-search-bin/m-p/100796#M1454</guid>
      <dc:creator>ycwubin</dc:creator>
      <dc:date>2020-09-28T11:35:05Z</dc:date>
    </item>
  </channel>
</rss>

