<?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: cutom alert action python script in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/cutom-alert-action-python-script/m-p/465636#M8267</link>
    <description>&lt;P&gt;You are importing &lt;STRONG&gt;request&lt;/STRONG&gt;, it should be &lt;STRONG&gt;requests&lt;/STRONG&gt;.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Feb 2020 10:16:51 GMT</pubDate>
    <dc:creator>manjunathmeti</dc:creator>
    <dc:date>2020-02-12T10:16:51Z</dc:date>
    <item>
      <title>cutom alert action python script</title>
      <link>https://community.splunk.com/t5/Alerting/cutom-alert-action-python-script/m-p/465632#M8263</link>
      <description>&lt;P&gt;Hi all. I am struggling where should I check.&lt;/P&gt;

&lt;P&gt;I want to make splunk user automatically.&lt;BR /&gt;
so, I made this script.&lt;/P&gt;

&lt;P&gt;test.py&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import sys
import os
import request
import json

def test():

data = { 'name':'username', 'password':'password', 'roles':'user'}


response = request.post('https://mng_uri:8089/services/authentication/users', data=data, auth=('admin','passme'))


id __name__ == "__main__":
 test()
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I can execute this scripts  &lt;CODE&gt;python test.py&lt;/CODE&gt; in my /home directory,&lt;/P&gt;

&lt;P&gt;and I can create user.&lt;/P&gt;

&lt;P&gt;so I made custom alert action.&lt;/P&gt;

&lt;P&gt;I made an alert and select this custom action, but I can not create user.&lt;/P&gt;

&lt;P&gt;I have no idea because there are no error in internal log(splunkd.log).&lt;/P&gt;

&lt;P&gt;where should I check???&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2020 08:55:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/cutom-alert-action-python-script/m-p/465632#M8263</guid>
      <dc:creator>pipipipi</dc:creator>
      <dc:date>2020-02-12T08:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: cutom alert action python script</title>
      <link>https://community.splunk.com/t5/Alerting/cutom-alert-action-python-script/m-p/465633#M8264</link>
      <description>&lt;P&gt;Please share configurations created for custom alert action.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2020 09:20:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/cutom-alert-action-python-script/m-p/465633#M8264</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2020-02-12T09:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: cutom alert action python script</title>
      <link>https://community.splunk.com/t5/Alerting/cutom-alert-action-python-script/m-p/465634#M8265</link>
      <description>&lt;P&gt;Thank you for helping me.  I use add-on builder. so I did not edit conf files.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2020 09:24:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/cutom-alert-action-python-script/m-p/465634#M8265</guid>
      <dc:creator>pipipipi</dc:creator>
      <dc:date>2020-02-12T09:24:56Z</dc:date>
    </item>
    <item>
      <title>Re: cutom alert action python script</title>
      <link>https://community.splunk.com/t5/Alerting/cutom-alert-action-python-script/m-p/465635#M8266</link>
      <description>&lt;P&gt;Search logs in splunkd.log for your alert action, you can use below query.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal sourcetype=splunkd component=sendmodalert
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Feb 2020 10:13:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/cutom-alert-action-python-script/m-p/465635#M8266</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2020-02-12T10:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: cutom alert action python script</title>
      <link>https://community.splunk.com/t5/Alerting/cutom-alert-action-python-script/m-p/465636#M8267</link>
      <description>&lt;P&gt;You are importing &lt;STRONG&gt;request&lt;/STRONG&gt;, it should be &lt;STRONG&gt;requests&lt;/STRONG&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2020 10:16:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/cutom-alert-action-python-script/m-p/465636#M8267</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2020-02-12T10:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: cutom alert action python script</title>
      <link>https://community.splunk.com/t5/Alerting/cutom-alert-action-python-script/m-p/465637#M8268</link>
      <description>&lt;P&gt;Thank you. but exit code =0.&lt;BR /&gt;
I can not understand &lt;CODE&gt;def process_event(helper, *args, **kwargs):&lt;/CODE&gt;and &lt;CODE&gt;return0&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 01:14:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/cutom-alert-action-python-script/m-p/465637#M8268</guid>
      <dc:creator>pipipipi</dc:creator>
      <dc:date>2020-02-13T01:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: cutom alert action python script</title>
      <link>https://community.splunk.com/t5/Alerting/cutom-alert-action-python-script/m-p/465638#M8269</link>
      <description>&lt;P&gt;Add exception handling in your script and check if any error occurring in the splunkd logs.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; import sys
 import os
 import requests
 import json

 def test():
    data = { 'name':'username', 'password':'password', 'roles':'user'}
    response = requests.post('https://mng_uri:8089/services/authentication/users', data=data, auth=('admin','passme'))
    response.raise_for_status()

 if __name__ == "__main__":
    try:
        test()
    except Exception as e:
        print &amp;gt;&amp;gt; sys.stderr, "ERROR Unexpected error: %s" % e
        sys.exit(1)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Feb 2020 02:49:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/cutom-alert-action-python-script/m-p/465638#M8269</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2020-02-13T02:49:46Z</dc:date>
    </item>
  </channel>
</rss>

