[Nagiosplug-checkins] CVS: nagiosplug/plugins check_load.c,1.13,1.14
Karl DeBisschop
kdebisschop at users.sourceforge.net
Thu Oct 30 20:21:16 CET 2003
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv31587/plugins
Modified Files:
check_load.c
Log Message:
add perfdata
Index: check_load.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_load.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** check_load.c 17 Sep 2003 16:15:48 -0000 1.13
--- check_load.c 31 Oct 2003 04:20:34 -0000 1.14
***************
*** 56,61 ****
main (int argc, char **argv)
{
- #if HAVE_GETLOADAVG==1
int result;
double la[3] = { 0.0, 0.0, 0.0 }; /* NetBSD complains about unitialized arrays */
#else
--- 56,61 ----
main (int argc, char **argv)
{
int result;
+ #if HAVE_GETLOADAVG==1
double la[3] = { 0.0, 0.0, 0.0 }; /* NetBSD complains about unitialized arrays */
#else
***************
*** 65,69 ****
char *tmp_ptr;
# else
- int result;
char input_buffer[MAX_INPUT_BUFFER];
# endif
--- 65,68 ----
***************
*** 127,130 ****
--- 126,130 ----
#endif
+
if ((la1 < 0.0) || (la5 < 0.0) || (la15 < 0.0)) {
#if HAVE_GETLOADAVG==1
***************
*** 139,152 ****
return STATE_UNKNOWN;
}
asprintf(&status_line, _("load average: %.2f, %.2f, %.2f"), la1, la5, la15);
! if ((la1 >= cload1) || (la5 >= cload5) || (la15 >= cload15)) {
! printf(_("CRITICAL - %s\n"), status_line);
! return STATE_CRITICAL;
! }
! if ((la1 >= wload1) || (la5 >= wload5) || (la15 >= wload15)) {
! printf (_("WARNING - %s\n"), status_line);
! return STATE_WARNING;
! }
! printf (_("OK - %s\n"), status_line);
return STATE_OK;
}
--- 139,159 ----
return STATE_UNKNOWN;
}
+
asprintf(&status_line, _("load average: %.2f, %.2f, %.2f"), la1, la5, la15);
!
! if ((la1 >= cload1) || (la5 >= cload5) || (la15 >= cload15))
! result = STATE_CRITICAL;
! else if ((la1 >= wload1) || (la5 >= wload5) || (la15 >= wload15))
! result = STATE_WARNING;
! else
! result = STATE_OK;
!
! die (result,
! "%s - %s|%s %s %s\n",
! state_text (result),
! status_line,
! perfdata ("load1", la1, "", wload1, wload1, cload1, cload1, TRUE, 0, FALSE, 0),
! perfdata ("load5", la5, "", wload5, wload5, cload5, cload5, TRUE, 0, FALSE, 0),
! perfdata ("load15", la15, "", wload15, wload15, cload15, cload15, TRUE, 0, FALSE, 0));
return STATE_OK;
}
More information about the Commits
mailing list