Sortoption for sorting by status information


#1

Hi,
Most of our servers are supposed to be patched on the last weekend of every month - a few like our backup servers need to be patched the Monday afterwards. I have a simiple check that looks at the uptime of all our servers and sends an alert if they haven’t been rebooted in more than 45 days. The problem is that we get a lot of emails all at once at the 45 day mark since we’re a little sloppy :-). So our SMS group requested a view in Nagios where they could see the uptime status. I said no problem and created a service group called uptime. The problem now is that I can’t sort by the uptime status and we have a lot of servers. So the view isn’t very useful since the output isn’t sorted by the uptime status. For now, I’m going to create a script with wget and then sorting that.

This functionality seems like it should already be in Nagios. Do you know how to ask the developers to add this functionality? Or do you have a better way to do it other than my wget sorting script?

Nagios has 6 sort options, but there are 7 columns, so I know this is how we’d call it from http - with sortoption=7.
](http://)/nagios/cgi-bin/status.cgi?servicegroup=&style=detail&servicestatustypes=2&sorttype=1&sortoption=7

thanks

adam


#2

Bummer. wget isn’t going to work since it doesn’t have the actual value of the status for each host in the downloaded file anywhere?

here’s a sample for one host - names changed to protect the innocent

[code]

UP
1 OK
View Extended Information For This Host View Extra Host NotesView Service Details For This Host Locate Host On Map
myserver Windows vmware guest server
[/code]

#3

Hi

Think you are wgetting the wrong page… you want status.cgi?servicegroup=whatever&style=detail not style=overview

HTH

/S


#4

hmm - I was using style=detail in my wget?.

Anyway, i just wrote a script that calls /usr/local/nagios/libexec/check_uptime against every server. I had to create a list of servers to do this against though, which is a bummer to maintain

adam


#5

Odd… things like “TD CLASS=‘miniStatusOK’” don’t seem to appear in the sourcecode for the detail view, only the overview one… any road up at least you’ve got a solution now with your new script… One thing though, to make it easier to manage, rather than keeping a seperate list of the hosts you have in that service group, you could try a wget/grep/sed combination one-liner to squirt dynamically obtain the list of hosts in the group and then squirt that list into an array in your script instead, that way you only need to make sure you add any new host to a the appropriate service-group…

something like this, which strips out all of the html leaving you just the hostname…

…would seem to do the job. Well, works for me at least :slight_smile:

HTH

/S