<?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 Alert Set up in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Alert-Set-up/m-p/508972#M9306</link>
    <description>&lt;P&gt;I want to set up an alert&amp;nbsp; when the server status is not "HEALTH_OK" for three consecutive times in a row.&lt;/P&gt;&lt;P&gt;Any pointers on how to schedule such search. I receive data every two minutes.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/9679i77A3CD6871BD05B5/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Capture.PNG&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;TABLE width="940"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="493"&gt;Send Alert If&lt;/TD&gt;&lt;TD width="447"&gt;Comments/Alert Frequency&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Status is not "RUNNING" or State is not "HEALTH_OK" for 3 times consecutively&lt;/TD&gt;&lt;TD&gt;1 alert every 2 min, for first 10 min, then 1 alert every 30 min&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
    <pubDate>Tue, 14 Jul 2020 03:45:08 GMT</pubDate>
    <dc:creator>smuderasi</dc:creator>
    <dc:date>2020-07-14T03:45:08Z</dc:date>
    <item>
      <title>Alert Set up</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-Set-up/m-p/508972#M9306</link>
      <description>&lt;P&gt;I want to set up an alert&amp;nbsp; when the server status is not "HEALTH_OK" for three consecutive times in a row.&lt;/P&gt;&lt;P&gt;Any pointers on how to schedule such search. I receive data every two minutes.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/9679i77A3CD6871BD05B5/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Capture.PNG&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;TABLE width="940"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="493"&gt;Send Alert If&lt;/TD&gt;&lt;TD width="447"&gt;Comments/Alert Frequency&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Status is not "RUNNING" or State is not "HEALTH_OK" for 3 times consecutively&lt;/TD&gt;&lt;TD&gt;1 alert every 2 min, for first 10 min, then 1 alert every 30 min&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 14 Jul 2020 03:45:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-Set-up/m-p/508972#M9306</guid>
      <dc:creator>smuderasi</dc:creator>
      <dc:date>2020-07-14T03:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Alert Set up</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-Set-up/m-p/509002#M9310</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/57095"&gt;@smuderasi&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;This is not the finished meal, but should give you an idea of how you can do it:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| noop 
| makeresults 
| eval id = "1 2 3 4 5 6 7 8 9" 
| makemv id
| mvexpand id
| eval server = case(id=1,"hostA",id=2,"hostB",id=3,"hostC",id=4,"hostA",id=5,"hostC",id=6,"hostB",id=7,"hostB",id=8,"hostA",id=9,"hostC")
| eval _time = case(id=1,_time+10,id=2,_time+20,id=3,_time+40,id=4,_time+40,id=5,_time+50,id=6,_time+60,id=7,_time+70,id=8,_time+80,id=9,_time+90)
| eval state = case(id=1,"health_ok",id=2,"health_not_ok",id=3,"health_ok",id=4,"health_ok",id=5,"health_ok",id=6,"health_not_ok",id=7,"health_not_ok",id=8,"health_not_ok",id=9,"health_not_ok")
| fields - id

| sort server, _time
| streamstats count as alert_counter by server, state&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;The first block, until including the &lt;EM&gt;| fields - id&lt;/EM&gt; is just to make up some sample data - you don't need that as you have data &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;The streamstats will create the field alert_counter which adds 1 every time the server and state is the same as in the line above. So your alert could trigger when&amp;nbsp;&lt;EM&gt;alert_counter&amp;gt;=3 AND state!=health_ok&lt;BR /&gt;&lt;/EM&gt;You can also add your status field like that.&lt;BR /&gt;&lt;BR /&gt;I&amp;nbsp;don't have a good idea right now for your alert conditions (every 2 minutes, later every 30 minutes), might be possible with 2 different alerts somehow.&lt;BR /&gt;&lt;BR /&gt;Hope I could at least give you some inspiration.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2020 07:55:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-Set-up/m-p/509002#M9310</guid>
      <dc:creator>rnowitzki</dc:creator>
      <dc:date>2020-07-14T07:55:02Z</dc:date>
    </item>
  </channel>
</rss>

