check_swap not working in Solaris 11

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
akame
Posts: 3
Joined: Tue Aug 28, 2012 5:49 am

check_swap not working in Solaris 11

Post by akame »

Hi,

I have compiled Nagios 3.4.1 for Solaris, everything seems to be working fine, but the check_swap pluging

The plugin itself was missing from /usr/local/nagios/libexec, so I checked the nagios-plugins-1.4.15 source and compiled it individually

root@ukbhu023p:~/nagios-plugins-1.4.15/plugins# make check_swap
gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include -DNP_VERSION='"1.4.15"' -g -O2 -MT check_swap.o -MD -MP -MF .deps/check_swap.Tpo -c -o check_swap.o check_swap.c
mv -f .deps/check_swap.Tpo .deps/check_swap.Po
/bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.15"' -g -O2 -L. -o check_swap check_swap.o -lm utils.o ../lib/libnagiosplug.a ../gl/libgnu.a popen.o -lpthread -ldl
libtool: link: gcc "-DNP_VERSION=\"1.4.15\"" -g -O2 -o check_swap check_swap.o utils.o popen.o -L/root/nagios-plugins-1.4.15/plugins -lm ../lib/libnagiosplug.a ../gl/libgnu.a -lpthread -ldl

I then copied the check_swap to /usr/local/nagios/libexec

Now it always returns the following

SWAP CRITICAL - 100% free (0 MB out of 0 MB)

Any ideas?

Thanks in advanced!

PD: I do have swap.. 1Gb

root@ukbhu023p:/usr/local/nagios/libexec# swap -l
swapfile dev swaplo blocks free
/dev/zvol/dsk/rpool/swap 228,2 16 2097136 2097136
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_swap not working in Solaris 11

Post by slansing »

Hmm, I will try to get in contact with our Solaris guy, in the meantime have you taken a look at this:

http://exchange.nagios.org/directory/Pl ... ap/details
akame
Posts: 3
Joined: Tue Aug 28, 2012 5:49 am

Re: check_swap not working in Solaris 11

Post by akame »

hi Slansing,

Thanks for your post, that .pl works just fine, it provides info on Virtual memory not disk-swap, but good enough for me. It would be good to have the native tools working though.. also in terms of CPU consumption..

I am facing a different issue now..

/usr/local/nagios/libexec# ./check_procs
System call sent warnings to stderr: pst3: This program can only be run by the root user!root@ukbhu023p:/usr/local/nagios/libexec
/usr/local/nagios/libexec# ./check_procs -vv
CMD: /usr/local/nagios/libexec/pst3
System call sent warnings to stderr: pst3: This program can only be run by the root user!root@ukbhu023p:/usr/local/nagios/libexec
/usr/local/nagios/libexec# file /usr/local/nagios/libexec/pst3
/usr/local/nagios/libexec/pst3: ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped

The only information I have found researching state that it might have been compiled for 32bits, but I checked the config.log and it was compiled for 64 bits..

Thanks in advanced.

Regards
akame
Posts: 3
Joined: Tue Aug 28, 2012 5:49 am

Re: check_swap not working in Solaris 11

Post by akame »

Hi,

I have solve the pst3 issue, apparently it does not check the running credentials but the owner of the binary itself!

root@ukbhu023p:/usr/local/nagios/libexec# chown root:root pst3
root@ukbhu023p:/usr/local/nagios/libexec# ./pst3 | head
S UID PID PPID VSZ RSS %CPU COMMAND ARGS
S 0 5 0 0 0 0.0 zpool-rpool
S 0 6 0 0 0 0.0 kmem_task
S 0 1 0 3184 1784 0.0 init /usr/sbin/init
S 0 8 0 0 0 0.0 vmtasks
S 0 444 1 11512 6400 0.0 picld /usr/lib/picl/picld
S 0 11 1 20296 18064 0.0 svc.startd /lib/svc/bin/svc.startd
S 0 13 1 31104 29480 0.0 svc.configd /lib/svc/bin/svc.configd
S 0 211 1 11472 6856 0.0 devfsadmd /usr/lib/devfsadm/devfsadmd
S 0 484 1 15640 6632 0.0 cupsd /usr/sbin/cupsd -C /etc/cups/cupsd.conf
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_swap not working in Solaris 11

Post by slansing »

Ahhh! Sounds good, I will pass this information on to the Solaris Dev when he is in.
estanley
Posts: 19
Joined: Thu Apr 08, 2010 9:28 am

Re: check_swap not working in Solaris 11

Post by estanley »

akame,

You are correct that the binary version of check_swap was not included with the agent. If I recall correctly, the reason is that it needs to run setuid root (or nrpe needs to run as root) in order for it to work. That presents security issues, so I included a perl version, which you have already discovered.

There is also a custom_check_procs script that should provide the same functionality as the check_procs binary.

Hope that helps,

Eric
Locked