Hard State Only
Hard State Only
Hi,
I have done a lot of searching but haven't found a way of doing it...
I want to only know about hosts/services with hard states. Is there a way for the CGI to ignore soft state status's?
Thanks.
I have done a lot of searching but haven't found a way of doing it...
I want to only know about hosts/services with hard states. Is there a way for the CGI to ignore soft state status's?
Thanks.
Re: Hard State Only
If you configure the max_check_attempts to be just 1 it should go to hard state at the first attempt
Rob Hassing


Re: Hard State Only
I should of explained...
I still want soft states in the background so for example max_check_attempts=3 and then go to hard state. But I don't want to know about the soft states, I'm only interested if there has been 3 "none OK" checks in a row and I don't want it displayed anywhere unless it hits hard state.
I still want soft states in the background so for example max_check_attempts=3 and then go to hard state. But I don't want to know about the soft states, I'm only interested if there has been 3 "none OK" checks in a row and I don't want it displayed anywhere unless it hits hard state.
Re: Hard State Only
this thread has an answer
https://support.nagios.com/forum/viewto ... 16&t=35520
https://support.nagios.com/forum/viewto ... 16&t=35520
Looking forward to seeing you all at #NagiosCon2019?
-Dedicated Lover of Nconf,PNP4Nagios and Nagvis
-Dedicated Lover of Nconf,PNP4Nagios and Nagvis
Re: Hard State Only
It says I'm not authorised to view that forum. Any chance you can repost the answer?
Re: Hard State Only
It's because it falls under our customer forum. This is usually something only our customers do have access to. As it's a useful post by @Box293, here's a copy -
-----
I can tell you how to do it but it's a tad confusing.
Basically the URLs contain the key to it all. For example:
This &servicestatustypes=28 makes the page display with the filters Service=Warning,Unknown,Critical.
If you look in this file /usr/local/nagiosxi/html/includes/constants.inc.php you'll find this:
4 (Warning) + 8 (Unknown) + 16 (Critical) = 28
So it should be a matter of defining an extra filter to only display hard states. You'll see this in the file:
So you should be able to add &serviceattr=262144 to any URL and it will only show you HARD states. However you still need the other filter, so it would be something like:
Which should show a filter like Service=Warning,Unknown,Critical,Hard State,Hard State
/usr/local/nagiosxi/html/includes/constants.inc.php is a handy file to go digging in
-----
I can tell you how to do it but it's a tad confusing.
Basically the URLs contain the key to it all. For example:
Code: Select all
http://xiproduction/nagiosxi/includes/components/xicore/status.php?show=services&servicestatustypes=28If you look in this file /usr/local/nagiosxi/html/includes/constants.inc.php you'll find this:
Code: Select all
// PSEUDO-STATES (USED IN LINKS, ETC)
define("SERVICESTATE_PENDING", 1);
define("SERVICESTATE_OK", 2);
define("SERVICESTATE_WARNING", 4);
define("SERVICESTATE_UNKNOWN", 8);
define("SERVICESTATE_CRITICAL", 16);
define("SERVICESTATE_ANY", 31);So it should be a matter of defining an extra filter to only display hard states. You'll see this in the file:
Code: Select all
define("SERVICESTATUSATTR_HARDSTATE", 262144);Code: Select all
http://xitest/nagiosxi/includes/components/xicore/status.php?show=services&servicestatustypes=28&serviceattr=262144/usr/local/nagiosxi/html/includes/constants.inc.php is a handy file to go digging in
Former Nagios Employee
Re: Hard State Only
This is brilliant and sounds like exactly what I'm after...
However, I can't locate the above files/config in Nagios Core. Is this only applicable to XI?
Thanks.
However, I can't locate the above files/config in Nagios Core. Is this only applicable to XI?
Thanks.
Re: Hard State Only
Apologies I posted that just as I went to bed and didnt pay attention to the fact it was out of the XI forum and it was XI
you certainly can do the same thing with core using the status.cgi etc..
to show hosts with issues but not soft states use this
http://nagiosserver/nagios/cgi-bin/stat ... ops=262144
for services use &serivceprops=262144
this will work for any page which is generated by status.cgi
for a really good blog post about the status.cgi check out http://roshamboot.org/main/guide-nagios-statuscgi/
you certainly can do the same thing with core using the status.cgi etc..
to show hosts with issues but not soft states use this
http://nagiosserver/nagios/cgi-bin/stat ... ops=262144
for services use &serivceprops=262144
this will work for any page which is generated by status.cgi
for a really good blog post about the status.cgi check out http://roshamboot.org/main/guide-nagios-statuscgi/
Looking forward to seeing you all at #NagiosCon2019?
-Dedicated Lover of Nconf,PNP4Nagios and Nagvis
-Dedicated Lover of Nconf,PNP4Nagios and Nagvis
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Hard State Only
Thanks nozlaf!
for easy reading I'm going to put the URL in code
for easy reading I'm going to put the URL in code
Code: Select all
http://<nagiosserver>/nagios/cgi-bin/status.cgi?hostgroup=all&style=hostdetail&hoststatustypes=12&hostprops=262144