Checking paging files /swap files help


#1

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 generic-service
hostgroup_name windows-servers
service_description swap
check_command check_swap -w 20% -c 10%
}

however i get the error that its “not defined anywhere”.

How would i go about monitoring the paging/swap files for my system?


#2

“check swap” should already be defined in your commands.cfg as:

# 'check_local_swap' command definition
define command{
        command_name    check_local_swap
        command_line    $USER1$/check_swap -w $ARG1$ -c $ARG2$
        }

which means your service needs to be:

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.

Luca


#3

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.


#4

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.

Luca


#5

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.


#6

localhost:/usr/local/nagios/libexec# ./check_swap --help
check_swap v1991 (nagios-plugins 1.4.13)
Copyright © 2000-2007 Nagios Plugin Development Team
nagiosplug-devel@lists.sourceforge.net

Check swap space on local machine.

i think you are trying to monitor remote machines with a local check… so you are gettig the local swap space for each server :slight_smile:


#7

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.


#8

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” :slight_smile:

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.


#9

Hi
have a look here
nagios.manubulon.com/snmp_storage.html
There are some good plugins for monitoring remote linux hosts

brett