<?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 Server Down and Up Alert in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Server-Down-and-Up-Alert/m-p/690367#M16064</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have created server down and up alerts separately which triggers when the server is down on the basis of percentile80&amp;gt;5 and up when the percentile80&amp;lt;5.&lt;/P&gt;
&lt;P&gt;But I want to create one combine alert which should trigger all the time when the server is down and I just want only one up alert (Recovery alert) once the server is up again, means it should not trigger multiple alerts for up until it again down.&lt;/P&gt;
&lt;P&gt;Any way to get this done ?&lt;/P&gt;
&lt;P&gt;Below is the query :&lt;/P&gt;
&lt;P&gt;Time Range is last 15 minutes and Cron job is */2 * * * * (every 2 minutes)&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=xyz sourcetype=xyz host=*
| eval RespTime=time_taken/1000
| eval RespTime = round(RespTime,2)
| bucket _time span=2m
| stats avg(RespTime) as Average perc80(RespTime) as "Percentile_80" by _time
| eval Server_Status=if(Percentile_80&amp;gt;=5, "Server Down", "Server UP")

&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;So above alert should trigger when the Server is down and it should trigger every 2 minutes until is up. And then alert should trigger only once when the server is Up again and it should not trigger every 2 minutes until the server is down again.&lt;/P&gt;</description>
    <pubDate>Tue, 11 Jun 2024 22:21:16 GMT</pubDate>
    <dc:creator>Chirag812</dc:creator>
    <dc:date>2024-06-11T22:21:16Z</dc:date>
    <item>
      <title>Server Down and Up Alert</title>
      <link>https://community.splunk.com/t5/Alerting/Server-Down-and-Up-Alert/m-p/690367#M16064</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have created server down and up alerts separately which triggers when the server is down on the basis of percentile80&amp;gt;5 and up when the percentile80&amp;lt;5.&lt;/P&gt;
&lt;P&gt;But I want to create one combine alert which should trigger all the time when the server is down and I just want only one up alert (Recovery alert) once the server is up again, means it should not trigger multiple alerts for up until it again down.&lt;/P&gt;
&lt;P&gt;Any way to get this done ?&lt;/P&gt;
&lt;P&gt;Below is the query :&lt;/P&gt;
&lt;P&gt;Time Range is last 15 minutes and Cron job is */2 * * * * (every 2 minutes)&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=xyz sourcetype=xyz host=*
| eval RespTime=time_taken/1000
| eval RespTime = round(RespTime,2)
| bucket _time span=2m
| stats avg(RespTime) as Average perc80(RespTime) as "Percentile_80" by _time
| eval Server_Status=if(Percentile_80&amp;gt;=5, "Server Down", "Server UP")

&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;So above alert should trigger when the Server is down and it should trigger every 2 minutes until is up. And then alert should trigger only once when the server is Up again and it should not trigger every 2 minutes until the server is down again.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 22:21:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Server-Down-and-Up-Alert/m-p/690367#M16064</guid>
      <dc:creator>Chirag812</dc:creator>
      <dc:date>2024-06-11T22:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: Server Down and Up Alert</title>
      <link>https://community.splunk.com/t5/Alerting/Server-Down-and-Up-Alert/m-p/691049#M16088</link>
      <description>&lt;P&gt;&lt;SPAN&gt;One possible solution would be to use a lookup (status_lookup) to keep track of the last known state.&amp;nbsp; This solution adds a host field so it can work for more than one host.&lt;BR /&gt;&lt;BR /&gt;Step 1:&lt;BR /&gt;Create a KVStore (or file based) lookup with the fields "host", and "current_status" (Note: the solution below will also add an alert message field, but that 's more of a side effect.)&lt;BR /&gt;&lt;BR /&gt;Step 2:&amp;nbsp;&lt;BR /&gt;Add the "host" group by clause, and lookup commands to your SPL:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=xyz sourcetype=xyz host=*
| eval RespTime=time_taken/1000
| eval RespTime = round(RespTime,2)
| bucket _time span=2m
| stats avg(RespTime) as Average perc80(RespTime) as "Percentile_80" by _time host
| eval Current_Server_Status=if(Percentile_80&amp;gt;=5, "Server Down", "Server Up")  
| lookup status_lookup host
| eval alert=case(Current_Server_Status="Server Down",$host$+" is down",
                 (Current_Server_Status="Server Up" AND Server_Status="Server Down"),$host$+" is back up") 
| rename Current_Server_Status AS Server_Status 
| table host Server_Status alert 
| outputlookup status_lookup&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;You'll end up with a serach that outputs something like this (and updates the lookup for the next alert run):&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;+---------------+--------------+------+
| Server_Status	| alert	       | host |
+---------------+--------------+------+
| Server Down	| a is down    | a    |
| Server Up     | b is back up | b    |
| Server Up     |              | c    |
| Server Down   | d is down    | d    |
+---------------+--------------+------+&lt;/LI-CODE&gt;&lt;P&gt;Note that host c has no alert message because it went from "up" to "up" with the sample data I used.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2024 01:25:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Server-Down-and-Up-Alert/m-p/691049#M16088</guid>
      <dc:creator>P_vandereerden</dc:creator>
      <dc:date>2024-06-19T01:25:51Z</dc:date>
    </item>
  </channel>
</rss>

