Solaris 9 Configuration, check_swap not working

I’ve just completed a new install on Nagios. I’m a first time installer.
Everythings up now. However, check_swap isn’t working.
I get:

SWAP WARNING - 100% free (0 MB out of 0 M:roll: |swap=0MB;0;0;0;0

When I do a check_swap -w

Has anyone seen this before? check_swap compiled and installed just fine,
but it isn’t checking swap at all.

Thanks…JW

This should go to Nagios plugins forum :slight_smile:
This plugins check the swap only on localhost. Are you trying to check it on remote host? If so, then use nrpe to check it on remote host…
What distribution of linux do you use?

This is on Solaris, and on the localhost. I have not configure any clients yet.
This is just on the main Nagios server. I just finished compiling Nagios and
the plugins on the main server. Everything looks good except the check_swap
command.

Oh, sorry, you have mentioned the Solaris in the subject. :slight_smile:
I have found several info about check_swap doesn’t work on Solaris 9. Although changelog says the plugin works with Solaris from version 1.4.6 of nagios-plugins
So if you’re using version lower then that, do an upgrade

I downloaded the 1.4.13 plugins from the website and compiled them.
This is the ones I have the problem with.

osdir.com/ml/network.nagios.plug … 00044.html

Check this conversation. It seems something is wrong with this plugin and Solaris. What you could do is to test the plugin from the version 1.4.6:
downloads.sourceforge.net/nagios … g_mirror=0
and only compile the check_swap and check if it works.

Or final solution is what was alredy said in the discussion in the above link, to write your own shell script that would be a plugin instead of check_swap.

Hi,
Here is a simple script which runs on Solaris 10 and OpenSolaris:

#!/bin/csh

check_solaris_swap

USAGE: check_solaris_swap W C

where W = warning threshold for swap (in kbytes)

where C = warning threshold for swap (in kbytes)

Example: check_solaris_swap 10000 5000

results in warning if swap < 10MB, critical if swap < 5 MB

set a = swap -s | nawk ' { print substr($11,1,length($11)-1) } '
@ b = $a
if ( $b < $2 ) then
echo 'Critical - ’ $b ‘kbytes swap available <’ $2
exit 2
else if ( $b < $1 ) then
echo 'Warning - ’ $b ‘kbytes swap available <’ $1
exit 1
else
echo 'OK - ’ $b 'kbytes swap available’
exit 0
endif

Set script command line parameters 1 and 2 to the warning and critical values that make sense for your configuration.

This plugins check the swap only on localhost. Are you trying to check it on remote host? If so, then use nrpe to check it on remote host…
What distribution of linux do you use?

Thanks for the script. I implemented this on monitoring for my local Solaris Nagios server successfully. But, when I try to monitor it the same way with a remote machine it will not work with check_by_ssh. The check_by_ssh works great with everything else for me.

Example output:

FROM NAGIOS HOST:
bash-3.00$ ./check_by_ssh -H ABC123 -E 16 -C "/opt/nagios/libexec/check_solaris_swap 100000 50000"
WARNING - check_by_ssh: Remote command ‘/opt/nagios/libexec/check_solaris_swap 100000 50000’ returned status 1

IF I RUN IT FROM THE ABC123 HOST:
nagios@ABC123:~
$ /opt/nagios/libexec/check_solaris_swap 100000 50000
OK - 16355720 kbytes swap available

Any ideas?