<?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 service status of a service including Disaster Recovery situation in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/service-status-of-a-service-including-Disaster-Recovery/m-p/685332#M233841</link>
    <description>&lt;P&gt;Just in a situation where I have 2 servers, where 1 is active and the other is passive. I had to deploy the TA on both the servers and report the service status of a service.&lt;BR /&gt;&lt;BR /&gt;So the active server would be reporting the service is "Running" and the passive server would say the service is "stopped"&lt;BR /&gt;&lt;BR /&gt;I have tried writing up a SPL but my only worry is if there is a situation when the service stops on the active server how to get it reported. or if there is no data from the active server. There should be atleast 1 server reporting the service is "Running" always. Only during the DR situation the server name would change&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=mday source="service_status.ps1" sourcetype=service_status os_service="App_Service" host=*papp01
| stats values(host) AS active_host BY status
| where status=="Running"
| append
[ search index = mday source =service_status.ps1 sourcetype = service_status os_service="App_Service" host=*papp01
| stats latest(status) AS status by host,os_service,service_name ]
| filldown active_host
| where active_host=host AND status!="Running"
| table host,active_host,os_service,service_name,status&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is much appreciated&lt;/P&gt;</description>
    <pubDate>Wed, 24 Apr 2024 14:09:30 GMT</pubDate>
    <dc:creator>ashraf_sj</dc:creator>
    <dc:date>2024-04-24T14:09:30Z</dc:date>
    <item>
      <title>service status of a service including Disaster Recovery situation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/service-status-of-a-service-including-Disaster-Recovery/m-p/685332#M233841</link>
      <description>&lt;P&gt;Just in a situation where I have 2 servers, where 1 is active and the other is passive. I had to deploy the TA on both the servers and report the service status of a service.&lt;BR /&gt;&lt;BR /&gt;So the active server would be reporting the service is "Running" and the passive server would say the service is "stopped"&lt;BR /&gt;&lt;BR /&gt;I have tried writing up a SPL but my only worry is if there is a situation when the service stops on the active server how to get it reported. or if there is no data from the active server. There should be atleast 1 server reporting the service is "Running" always. Only during the DR situation the server name would change&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=mday source="service_status.ps1" sourcetype=service_status os_service="App_Service" host=*papp01
| stats values(host) AS active_host BY status
| where status=="Running"
| append
[ search index = mday source =service_status.ps1 sourcetype = service_status os_service="App_Service" host=*papp01
| stats latest(status) AS status by host,os_service,service_name ]
| filldown active_host
| where active_host=host AND status!="Running"
| table host,active_host,os_service,service_name,status&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is much appreciated&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2024 14:09:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/service-status-of-a-service-including-Disaster-Recovery/m-p/685332#M233841</guid>
      <dc:creator>ashraf_sj</dc:creator>
      <dc:date>2024-04-24T14:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: service status of a service including Disaster Recovery situation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/service-status-of-a-service-including-Disaster-Recovery/m-p/685480#M233891</link>
      <description>&lt;P&gt;There are multiple methods to achieve this. However, lets first try it in a simpler way&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=mday source="service_status.ps1" sourcetype=service_status os_service="App_Service" host=*papp01
|stats latest(status) AS status by host
|eventstats values(status) as _status
|eval OverallStatus=if(mvcount(_status) &amp;lt; 2 OR isnull(mvfind(_status,"Running")),"Down","Good")&lt;/LI-CODE&gt;&lt;P&gt;Steps&lt;/P&gt;&lt;P&gt;- count the status values&lt;/P&gt;&lt;P&gt;- If the count is less than 2&amp;nbsp; : meaning only one of the status from Running/Stopped is present&lt;/P&gt;&lt;P&gt;- OR Running status is not available, we are setting the overall status as down.&lt;/P&gt;&lt;P&gt;In this way, we can handle multiple situations where one of the server is down or both are reporting down or even both are reporting Running (active &amp;amp; passive)&lt;/P&gt;&lt;P&gt;Demonstrated with a dummy search&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|makeresults|eval host="HostA",status="Running"
|append[|makeresults|eval host="HostB",status="Stopped"]
|stats latest(status) as status by host
|eventstats values(status) as _status
|eval OverallStatus=if(mvcount(_status) &amp;lt; 2 OR isnull(mvfind(_status,"Running")),"Down","Good")&lt;/LI-CODE&gt;&lt;P&gt;Try changing the status of HostA or HostB and see the results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2024 13:59:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/service-status-of-a-service-including-Disaster-Recovery/m-p/685480#M233891</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2024-04-25T13:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: service status of a service including Disaster Recovery situation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/service-status-of-a-service-including-Disaster-Recovery/m-p/685775#M233977</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/136781"&gt;@renjith_nair&lt;/a&gt;&amp;nbsp;, this works, I have used the&amp;nbsp;OverallStatus as condition to alert. Thanks a lot and much appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2024 08:10:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/service-status-of-a-service-including-Disaster-Recovery/m-p/685775#M233977</guid>
      <dc:creator>ashraf_sj</dc:creator>
      <dc:date>2024-04-29T08:10:17Z</dc:date>
    </item>
  </channel>
</rss>

