Splunk Enterprise

Send alerts for status recovery

frankroger
Engager

We have the below query, which checks whenever a server is down. So we want this query to send an alert when the status changes from Stopped to Running. Now it only sends an alert when the status is Stopped.

 

index="init_butcher" sourcetype="services_status.out.log" host=* | chart useother=f values(status) as services over host by service limit=0
| eval status=if('abc'="STOPPED", "DOWN", "Critical")
| where 'cfd'="STOPPED" OR 'hij'="STOPPED" OR ''="STOPPED" OR 'jkl'="STOPPED" OR 'mno'="STOPPED" OR 'pqr'="STOPPED" OR 'stu'="STOPPED" OR 'vux'="STOPPED" OR 'yz'="STOPPED"
| fields butcher, host, status
| mvcombine host delim=","
| eval message="Butcher Services are at status: ".status." Host(s):".mvjoin(host,",")

0 Karma

thambisetty
SplunkTrust
SplunkTrust

yes. you have got few results that means you have field status. 

The query you have provided in the question is not properly developed.  If you just need to be alerted when status is running you can just add below and save as an alert.

| stats count by host,service

————————————
If this helps, give a like below.

frankroger
Engager

I want the alert to trigger when the services are down and then trigger again once or twice when the server is up.  

0 Karma

thambisetty
SplunkTrust
SplunkTrust

@frankroger 

can you post sample events and also check is there any field status or abc in your events.

————————————
If this helps, give a like below.
0 Karma

frankroger
Engager

frankroger_0-1606304620857.png


Here is the results.

0 Karma

frankroger
Engager

Thanks Thambisetty for your quick respone. But I am new to splunk, I don't understand what is meant by your reply there. 

0 Karma

thambisetty
SplunkTrust
SplunkTrust

@frankroger 

you need to identify the value used to find events for running. 

index="init_butcher" sourcetype="services_status.out.log" host=* status="running" 

 

————————————
If this helps, give a like below.
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...