<?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: 'splunk status' return code in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/splunk-status-return-code/m-p/25657#M177593</link>
    <description>&lt;P&gt;Yes indeed.  This is why splunk status changed to returning 3 when the splunkd service is down.&lt;/P&gt;</description>
    <pubDate>Tue, 09 Feb 2016 01:31:33 GMT</pubDate>
    <dc:creator>jrodman</dc:creator>
    <dc:date>2016-02-09T01:31:33Z</dc:date>
    <item>
      <title>'splunk status' return code</title>
      <link>https://community.splunk.com/t5/Splunk-Search/splunk-status-return-code/m-p/25649#M177585</link>
      <description>&lt;P&gt;When I issue 'splunk status' on Linux, the exit code is 0 even when splunk is not running. This makes it hard to use it in automation - Chef in my case, which relies on the return code to tell it whether the service is up/down. Is there other good way to do this?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2011 16:07:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/splunk-status-return-code/m-p/25649#M177585</guid>
      <dc:creator>ianformanek</dc:creator>
      <dc:date>2011-11-30T16:07:41Z</dc:date>
    </item>
    <item>
      <title>Re: 'splunk status' return code</title>
      <link>https://community.splunk.com/t5/Splunk-Search/splunk-status-return-code/m-p/25650#M177586</link>
      <description>&lt;P&gt;I am not sure why 'splunk status' command does not work in your environment. But the other way to monitor splunk process will be "ps" command may be useful.&lt;/P&gt;

&lt;P&gt;A normal default Splunk will start up: &lt;/P&gt;

&lt;P&gt;・" Two "splunkd" (or "splunkd.exe") processes. &lt;BR /&gt;
One does indexing, and the other helps launch other processes as necessary&lt;BR /&gt;
・ " SplunkWeb, which runs inside of "python" (or "pythonservice.exe")&lt;/P&gt;

&lt;P&gt;So, you can use following command to monitor those processes.&lt;/P&gt;

&lt;P&gt;ps aux | grep splunk | grep -v grep&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2011 08:26:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/splunk-status-return-code/m-p/25650#M177586</guid>
      <dc:creator>Takajian</dc:creator>
      <dc:date>2011-12-01T08:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: 'splunk status' return code</title>
      <link>https://community.splunk.com/t5/Splunk-Search/splunk-status-return-code/m-p/25651#M177587</link>
      <description>&lt;P&gt;Here is the best approach I ended up to simulate returning non-0 exit code when one of the splunk services is not running:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;expr `service splunk status | grep 'is not running' | wc -l` == 0&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2011 09:48:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/splunk-status-return-code/m-p/25651#M177587</guid>
      <dc:creator>ianformanek</dc:creator>
      <dc:date>2011-12-01T09:48:10Z</dc:date>
    </item>
    <item>
      <title>Re: 'splunk status' return code</title>
      <link>https://community.splunk.com/t5/Splunk-Search/splunk-status-return-code/m-p/25652#M177588</link>
      <description>&lt;P&gt;Thanks Takajian, yes that works. I wanted to avoid doing it this way though, as it is error prone (just naming the server 'my-splunk-server' can easily make the ps result always appear as if splunk is running).&lt;/P&gt;

&lt;P&gt;Just to clarify - 'splunk status' does work correctly and reports status for both processes, just not via the exit code. Below is a way I ended up doing it.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2011 09:49:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/splunk-status-return-code/m-p/25652#M177588</guid>
      <dc:creator>ianformanek</dc:creator>
      <dc:date>2011-12-01T09:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: 'splunk status' return code</title>
      <link>https://community.splunk.com/t5/Splunk-Search/splunk-status-return-code/m-p/25653#M177589</link>
      <description>&lt;P&gt;ianformanek,&lt;/P&gt;

&lt;P&gt;Building on your answer, would it not be better to a be a little more explicit and use&lt;/P&gt;

&lt;P&gt;To check just splunkweb...&lt;BR /&gt;
... $SPLUNK_HOME/bin/splunk status splunkweb | grep 'is not running' | ...&lt;/P&gt;

&lt;P&gt;To check just splunkd (not including helpers)&lt;BR /&gt;
... $SPLUNK_HOME/bin/splunk status splunkd | grep splunkd| grep 'is not running' | ...&lt;/P&gt;

&lt;P&gt;You could also check helpers are running (used for running scripts, etc.)&lt;BR /&gt;
... $SPLUNK_HOME/bin/splunk status splunkd | grep 'splunk helpers' | grep 'are running'...&lt;/P&gt;

&lt;P&gt;Doing this could prove more reliable. As one service could crash without stopping the other (or someone could kill one process but not the other). &lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2011 17:46:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/splunk-status-return-code/m-p/25653#M177589</guid>
      <dc:creator>MHibbin</dc:creator>
      <dc:date>2011-12-01T17:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: 'splunk status' return code</title>
      <link>https://community.splunk.com/t5/Splunk-Search/splunk-status-return-code/m-p/25654#M177590</link>
      <description>&lt;P&gt;Indeed, depending on the usecase, this may be better. In my case, I want to check if all the services are running to determine if &lt;CODE&gt;splunk service start&lt;/CODE&gt; needs to be called (that would only start those not running) - hence the check for any ocurrence of 'is not running'.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2011 07:51:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/splunk-status-return-code/m-p/25654#M177590</guid>
      <dc:creator>ianformanek</dc:creator>
      <dc:date>2011-12-02T07:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: 'splunk status' return code</title>
      <link>https://community.splunk.com/t5/Splunk-Search/splunk-status-return-code/m-p/25655#M177591</link>
      <description>&lt;P&gt;Hello, this seems to be a bug. Splunk exit code is clearly not LSB conform. At least on Linux. We experience the same problem.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html"&gt;http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jun 2012 08:15:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/splunk-status-return-code/m-p/25655#M177591</guid>
      <dc:creator>tpaulsen</dc:creator>
      <dc:date>2012-06-08T08:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: 'splunk status' return code</title>
      <link>https://community.splunk.com/t5/Splunk-Search/splunk-status-return-code/m-p/25656#M177592</link>
      <description>&lt;P&gt;If you use,&lt;BR /&gt;
    splunk status splunkd&lt;/P&gt;

&lt;P&gt;The return code is 0 when daemon is running and 3 for not running. But if you use,&lt;BR /&gt;
    splunk status splunkweb&lt;/P&gt;

&lt;P&gt;The return code is always 0 no matter web service is running or not. I think it is a bug.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Jul 2012 03:09:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/splunk-status-return-code/m-p/25656#M177592</guid>
      <dc:creator>Takol1</dc:creator>
      <dc:date>2012-07-07T03:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: 'splunk status' return code</title>
      <link>https://community.splunk.com/t5/Splunk-Search/splunk-status-return-code/m-p/25657#M177593</link>
      <description>&lt;P&gt;Yes indeed.  This is why splunk status changed to returning 3 when the splunkd service is down.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2016 01:31:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/splunk-status-return-code/m-p/25657#M177593</guid>
      <dc:creator>jrodman</dc:creator>
      <dc:date>2016-02-09T01:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: 'splunk status' return code</title>
      <link>https://community.splunk.com/t5/Splunk-Search/splunk-status-return-code/m-p/25658#M177594</link>
      <description>&lt;P&gt;I think this got fixed in the intervening years, but in any event it is no longer relevant, as splunkweb is no longer a separate service.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2016 01:32:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/splunk-status-return-code/m-p/25658#M177594</guid>
      <dc:creator>jrodman</dc:creator>
      <dc:date>2016-02-09T01:32:08Z</dc:date>
    </item>
  </channel>
</rss>

