Hi dear,
I’ve write a custom perl to manage the incoming trap.
I need to check the number of soft state of a service to avoid to send an email after just 1/4 check.
So my question if can I query nagios to get the number of attempt of a service?
Not met a way to do this directly personally but that doesn’t of course mean there isn’t a way !shy You could parse status.dat and work it out based on the values in the servicestatus entry for that service, such as:
servicestatus {
host_name=
service_description=
current_state=
current_attempt=
max_attempts=
.....
..…but that’s just horrible.
I’d probably look at doing something like a wget (or use libwww-perl etc) of the nagios “…/extinfo.cgii?type=2&host=YOURHOST&service=YOURSERVICE” webpage for the service in question, and then grep the source for the occurance of something like WARNING and SOFT.