summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8ee7a9f)
raw | patch | inline | side by side (parent: 8ee7a9f)
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | |
Thu, 8 Mar 2007 09:09:38 +0000 (09:09 +0000) | ||
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | |
Thu, 8 Mar 2007 09:09:38 +0000 (09:09 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1635 f882894a-f735-0410-b71e-b25c423dba1c
NEWS | patch | blob | history | |
THANKS.in | patch | blob | history | |
plugins-root/check_icmp.c | patch | blob | history |
index ee0ac0e47dcb89330c09c3063efaab5e3a78d747..7756de9a80bbc72dd0ff1e2550b787950bb6e77e 100644 (file)
--- a/NEWS
+++ b/NEWS
Root plugins installed with world executable
./configure now detects if possible to compile check_mysql
check_sybase from contrib now maintained in NagiosExchange
+ check_icmp now allows to set a minimum number of hosts required for successs (-m)
1.4.6 5th February 2007
Reduced number of DNS lookups in check_ping and netutils.c for IPv6 configurations
diff --git a/THANKS.in b/THANKS.in
index 98b86795b9029166cf3f0d8b9fc29869d360c687..03b248b4f2f096a02218f555842439e8dde652b5 100644 (file)
--- a/THANKS.in
+++ b/THANKS.in
Ville Mattila
Lars Stavholm
Enrico Scholz
+Marlo Bell
index cd059c3815647557d8e6d365355e7b1020a753c3..7a23e05a880c3b5f323f9f0960e1c84186b82ef2 100644 (file)
* Nagios check_icmp plugin
*
* License: GPL
-* Copyright (c) 2005-2006 nagios-plugins team
+* Copyright (c) 2005-2007 nagios-plugins team
*
* Original Author : Andreas Ericsson <ae@op5.se>
*
/* char *progname = "check_icmp"; */
char *progname;
const char *revision = "$Revision$";
-const char *copyright = "2005-2006";
+const char *copyright = "2005-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
/** nagios plugins basic includes */
static unsigned long long max_completion_time = 0;
static unsigned char ttl = 0; /* outgoing ttl */
static unsigned int warn_down = 1, crit_down = 1; /* host down threshold values */
+static int min_hosts_alive = -1;
float pkt_backoff_factor = 1.5;
float target_backoff_factor = 1.5;
/* parse the arguments */
for(i = 1; i < argc; i++) {
- while((arg = getopt(argc, argv, "vhVw:c:n:p:t:H:i:b:I:l:")) != EOF) {
+ while((arg = getopt(argc, argv, "vhVw:c:n:p:t:H:i:b:I:l:m:")) != EOF) {
switch(arg) {
case 'v':
debug++;
case 'l':
ttl = (unsigned char)strtoul(optarg, NULL, 0);
break;
+ case 'm':
+ min_hosts_alive = (int)strtoul(optarg, NULL, 0);
+ break;
case 'd': /* implement later, for cluster checks */
warn_down = (unsigned char)strtoul(optarg, &ptr, 0);
if(ptr) {
crash("packets is > 20 (%d)", packets);
}
+ if(min_hosts_alive < -1) {
+ errno = 0;
+ crash("minimum alive hosts is negative (%i)", min_hosts_alive);
+ }
+
host = list;
table = malloc(sizeof(struct rta_host **) * (argc - 1));
i = 0;
struct rta_host *host;
char *status_string[] =
{"OK", "WARNING", "CRITICAL", "UNKNOWN", "DEPENDENT"};
+ int hosts_ok = 0;
+ int hosts_warn = 0;
alarm(0);
if(debug > 1) printf("finish(%d) called\n", sig);
}
host->pl = pl;
host->rta = rta;
- if(!status && (pl >= warn.pl || rta >= warn.rta)) status = STATE_WARNING;
- if(pl >= crit.pl || rta >= crit.rta) status = STATE_CRITICAL;
+ if(pl >= crit.pl || rta >= crit.rta) {
+ status = STATE_CRITICAL;
+ }
+ else if(!status && (pl >= warn.pl || rta >= warn.rta)) {
+ status = STATE_WARNING;
+ hosts_warn++;
+ }
+ else {
+ hosts_ok++;
+ }
host = host->next;
}
/* this is inevitable */
if(!targets_alive) status = STATE_CRITICAL;
+ if(min_hosts_alive > -1) {
+ if(hosts_ok >= min_hosts_alive) status = STATE_OK;
+ else if((hosts_ok + hosts_warn) >= min_hosts_alive) status = STATE_WARNING;
+ }
printf("%s - ", status_string[status]);
host = list;
host = host->next;
}
+ if(min_hosts_alive > -1) {
+ if(hosts_ok >= min_hosts_alive) status = STATE_OK;
+ else if((hosts_ok + hosts_warn) >= min_hosts_alive) status = STATE_WARNING;
+ }
+
/* finish with an empty line */
puts("");
- if(debug) printf("targets: %u, targets_alive: %u\n",
- targets, targets_alive);
+ if(debug) printf("targets: %u, targets_alive: %u, hosts_ok: %u, hosts_warn: %u, min_hosts_alive: %i\n",
+ targets, targets_alive, hosts_ok, hosts_warn, min_hosts_alive);
exit(status);
}
printf (" %s\n", "-I");
printf (" %s", _("max target interval (currently "));
printf ("%0.3fms)\n", (float)target_interval / 1000);
+ printf (" %s\n", "-m");
+ printf (" %s",_("number of alive hosts required for success"));
+ printf ("\n");
printf (" %s\n", "-l");
printf (" %s", _("TTL on outgoing packets (currently "));
printf ("%u)", ttl);
printf ("%s\n", _("packet loss. The default values should work well for most users."));
printf ("%s\n", _("You can specify different RTA factors using the standardized abbreviations"));
printf ("%s\n\n", _("us (microseconds), ms (milliseconds, default) or just plain s for seconds."));
- printf ("%s\n", _("Threshold format for -d is warn,crit. 12,14 means WARNING if >= 12 hops"));
+/* -d not yet implemented */
+/* printf ("%s\n", _("Threshold format for -d is warn,crit. 12,14 means WARNING if >= 12 hops"));
printf ("%s\n", _("are spent and CRITICAL if >= 14 hops are spent."));
- printf ("%s\n\n", _("NOTE: Some systems decrease TTL when forming ICMP_ECHOREPLY, others do not."));
+ printf ("%s\n\n", _("NOTE: Some systems decrease TTL when forming ICMP_ECHOREPLY, others do not."));*/
printf ("%s\n\n", _("The -v switch can be specified several times for increased verbosity."));
+
/* printf ("%s\n", _("Long options are currently unsupported."));
printf ("%s\n", _("Options marked with * require an argument"));
*/