[Nagiosplug-checkins] CVS: nagiosplug/plugins check_swap.c,1.22,1.23
Ton Voon
tonvoon at users.sourceforge.net
Tue Nov 11 02:28:02 CET 2003
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv24673
Modified Files:
check_swap.c
Log Message:
Added perfdata
Index: check_swap.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_swap.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -r1.22 -r1.23
*** check_swap.c 11 Nov 2003 10:19:29 -0000 1.22
--- check_swap.c 11 Nov 2003 10:27:16 -0000 1.23
***************
*** 56,59 ****
--- 56,60 ----
int result = STATE_OK;
char input_buffer[MAX_INPUT_BUFFER];
+ char *perf;
#ifdef HAVE_PROC_MEMINFO
FILE *fp;
***************
*** 74,77 ****
--- 75,79 ----
status = strdup("");
+ perf = strdup("");
if (process_arguments (argc, argv) != OK)
***************
*** 223,227 ****
(100 - percent_used), free_swap, total_swap, status);
! die (result, "SWAP %s:%s\n", state_text (result), status);
return STATE_UNKNOWN;
}
--- 225,234 ----
(100 - percent_used), free_swap, total_swap, status);
! asprintf (&perf, "%s", perfdata ("swap", free_swap, "MB",
! TRUE, max (warn_size/1024, warn_percent/100.0*total_swap),
! TRUE, max (crit_size/1024, crit_percent/100.0*total_swap),
! TRUE, 0,
! TRUE, total_swap));
! die (result, "SWAP %s:%s |%s\n", state_text (result), status, perf);
return STATE_UNKNOWN;
}
***************
*** 330,339 ****
if (c == argc)
return validate_arguments ();
! if (warn_percent > 100 && is_intnonneg (argv[c]))
warn_percent = atoi (argv[c++]);
if (c == argc)
return validate_arguments ();
! if (crit_percent > 100 && is_intnonneg (argv[c]))
crit_percent = atoi (argv[c++]);
--- 337,346 ----
if (c == argc)
return validate_arguments ();
! if (warn_percent == 0 && is_intnonneg (argv[c]))
warn_percent = atoi (argv[c++]);
if (c == argc)
return validate_arguments ();
! if (crit_percent == 0 && is_intnonneg (argv[c]))
crit_percent = atoi (argv[c++]);
***************
*** 358,362 ****
validate_arguments (void)
{
! if (warn_percent > 100 && crit_percent > 100 && warn_size == 0
&& crit_size == 0) {
return ERROR;
--- 365,369 ----
validate_arguments (void)
{
! if (warn_percent == 0 && crit_percent == 0 && warn_size == 0
&& crit_size == 0) {
return ERROR;
More information about the Commits
mailing list