[Nagiosplug-devel] check_swap in SUN OS

Nellurandi, Sivakumar sivakumar.nellurandi at cingular.com
Mon Jun 20 10:32:29 CEST 2005

I am finding some difficulties for having the check_swap plugin worked
in SUN Solaris operating system. Can you please provide me the working
version source code of the check_swap plugin?
Problem description
We have a question on the usage of check_swap plugin (version 1.4) on
Solaris. The following is an extract from the print_help() function in
        printf (_("\n\
On Solaris, if -a specified, uses swap -l, otherwise uses swap -s.\n\
Will be discrepencies because swap -s counts allocated swap and
real memory\n"));
        printf (_("\n\
On AIX, if -a is specified, uses lsps -a, otherwise uses lsps -s.\n"));
The above print statements clearly state that omitting the "-a" argument
to the plugin uses "swap -s" command on Solaris and "lsps -s" command on
The following is again an extract from check_swap.c file which executes
the "lsps -s" command for AIX
/* These override the command used if a summary (and thus ! allswaps) is
required */
/* The summary flag returns more accurate information about swap usage
on these OSes */
#  ifdef _AIX
        if (!allswaps) {
                asprintf(&swap_command, "%s", "/usr/sbin/lsps -s");
                asprintf(&swap_format, "%s", "%f%*s %f");
                conv_factor = 1;
#  endif
But in the code we did not find a similar execution of "swap -s" command
for Solaris. Could you point out where the execution of "swap -s"
command takes place.
Here is the output of the plugin on Solaris 2.6 with & without the "-a"
$ ./check_swap -a -w 10% -c 5%
SWAP CRITICAL: 3% free (6 MB out of 200 MB) |swap=5MB;20;10;0;200
$ ./check_swap -w 10% -c 5%
SWAP CRITICAL: 3% free (6 MB out of 200 MB) |swap=5MB;20;10;0;200
$ /usr/sbin/swap -l
swapfile             dev  swaplo blocks   free
/dev/dsk/c0t3d0s1   32,25      8 410248  11312
As you can see, the output of the plugin is always in sync with "swap
-l" command. We have observed the same behavior on Solaris 2.8 and
Solaris 9 also.
Thanks in advance for any help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20050620/c07b819c/attachment.html>

More information about the Devel mailing list