I need nagios to monitor the swap files for my computer but the problem is that i’m unsure whats the code for it. I think its the check_swap code, but i haven’t got it to work. Below is what i’ve written:
define service{
use local-service ; Name of service
template to use
host_name localhost
service_description Swap Usage
check_command check_local_swap!20!10
}
notice thta you are calling check_swap instead of check_local_swap, and the different usage of the -w and -c parameter, those are defined inthe commands.cfg and only the values are given (separated by ! ) in the service.cfg.
thanks luca, it appears to have worked. Just one more question to ask, it concerns being able to monitor terminal server what would be the code to do this? I was under the impression it would be a service again, but it seems to be svchost and a lot of other services seem to have svchost, is there any way to just monitor indivudual services like terminal server without using svchost?
I was under the impression that using w32time would be the answer, but i’m not so sure.
i think you should use NSclient for checking services on a windows server… or yiou could check the TCP port (usually this is NOT enough) with check_tcp.
I’ll worry about terminal services later then. I’ve just noticed something odd regarding the swap file monitor.
For some reason they all give the same values. They all the same value of 991mb out of 991mb, but my servers have different values. Some certainly have more then others.
My guess is that percentages just isn’t going to cut it and i’ll need to specify an exact figure for each server. but could there be any other reason as to why it gives the same value.
ok, makes sense. Then the next question is how to monitor it remotely?
At first i tried check_remote_swap with the same code as the check_remote_swap but that just throws up a not defined error. Consulting commands.cfg i use
define command{
command_name swap usuage
command_line check_swap -h (host IP address, tried host name as well) -w(number) -c (number)
}
Nothing happens, verified ok and all. I think the “user” part in services maybe needed, but i’m not entirely sure.
Check swap has no remote option, -h is the HELP switch and it looks like you are a bit confused about how the commdns and services files work.
First i’d recommend you read a bit the nagios docs about how commands and service checks are defined, then have a look in the libexec folder to see what plugins you have available… i doubt you’ll find a check_remote_swap, that’s why it “throws up a not defined error”
I think the load can somehow be fetched via snmp, or (and this one is porbably the better way) you’ll need to install the plugin on the remote server and use check_by_ssh.