summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2022-03-26 12:48:03 (GMT)
committerRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2022-03-26 12:48:03 (GMT)
commit9cff76363a3aff01ba64e7aa87c56825a073c839 (patch)
tree988215adf02828a5c5b2bd1bf601a08389a320c1
parent0c9fae5758838fa7fff774443e3d004110264771 (diff)
downloadmonitoring-plugins-9cff763.tar.gz
Style and whitespace fixesrefs/pull/1757/head
-rw-r--r--plugins-root/check_icmp.c163
1 files changed, 81 insertions, 82 deletions
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c
index c7e1865..1f5d465 100644
--- a/plugins-root/check_icmp.c
+++ b/plugins-root/check_icmp.c
@@ -1,39 +1,39 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* Monitoring check_icmp plugin 3* Monitoring check_icmp plugin
4* 4*
5* License: GPL 5* License: GPL
6* Copyright (c) 2005-2008 Monitoring Plugins Development Team 6* Copyright (c) 2005-2008 Monitoring Plugins Development Team
7* Original Author : Andreas Ericsson <ae@op5.se> 7* Original Author : Andreas Ericsson <ae@op5.se>
8* 8*
9* Description: 9* Description:
10* 10*
11* This file contains the check_icmp plugin 11* This file contains the check_icmp plugin
12* 12*
13* Relevant RFC's: 792 (ICMP), 791 (IP) 13* Relevant RFC's: 792 (ICMP), 791 (IP)
14* 14*
15* This program was modeled somewhat after the check_icmp program, 15* This program was modeled somewhat after the check_icmp program,
16* which was in turn a hack of fping (www.fping.org) but has been 16* which was in turn a hack of fping (www.fping.org) but has been
17* completely rewritten since to generate higher precision rta values, 17* completely rewritten since to generate higher precision rta values,
18* and support several different modes as well as setting ttl to control. 18* and support several different modes as well as setting ttl to control.
19* redundant routes. The only remainders of fping is currently a few 19* redundant routes. The only remainders of fping is currently a few
20* function names. 20* function names.
21* 21*
22* 22*
23* This program is free software: you can redistribute it and/or modify 23* This program is free software: you can redistribute it and/or modify
24* it under the terms of the GNU General Public License as published by 24* it under the terms of the GNU General Public License as published by
25* the Free Software Foundation, either version 3 of the License, or 25* the Free Software Foundation, either version 3 of the License, or
26* (at your option) any later version. 26* (at your option) any later version.
27* 27*
28* This program is distributed in the hope that it will be useful, 28* This program is distributed in the hope that it will be useful,
29* but WITHOUT ANY WARRANTY; without even the implied warranty of 29* but WITHOUT ANY WARRANTY; without even the implied warranty of
30* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 30* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31* GNU General Public License for more details. 31* GNU General Public License for more details.
32* 32*
33* You should have received a copy of the GNU General Public License 33* You should have received a copy of the GNU General Public License
34* along with this program. If not, see <http://www.gnu.org/licenses/>. 34* along with this program. If not, see <http://www.gnu.org/licenses/>.
35* 35*
36* 36*
37*****************************************************************************/ 37*****************************************************************************/
38 38
39/* progname may change */ 39/* progname may change */
@@ -1545,74 +1545,73 @@ icmp_checksum(uint16_t *p, size_t n)
1545void 1545void
1546print_help(void) 1546print_help(void)
1547{ 1547{
1548 1548 /*print_revision (progname);*/ /* FIXME: Why? */
1549 /*print_revision (progname);*/ /* FIXME: Why? */ 1549
1550 1550 printf ("Copyright (c) 2005 Andreas Ericsson <ae@op5.se>\n");
1551 printf ("Copyright (c) 2005 Andreas Ericsson <ae@op5.se>\n"); 1551 printf (COPYRIGHT, copyright, email);
1552 printf (COPYRIGHT, copyright, email); 1552
1553 1553 printf ("\n\n");
1554 printf ("\n\n"); 1554
1555 1555 print_usage ();
1556 print_usage (); 1556
1557 1557 printf (UT_HELP_VRSN);
1558 printf (UT_HELP_VRSN); 1558 printf (UT_EXTRA_OPTS);
1559 printf (UT_EXTRA_OPTS); 1559
1560 1560 printf (" %s\n", "-H");
1561 printf (" %s\n", "-H"); 1561 printf (" %s\n", _("specify a target"));
1562 printf (" %s\n", _("specify a target")); 1562 printf (" %s\n", "[-4|-6]");
1563 printf (" %s\n", "[-4|-6]"); 1563 printf (" %s\n", _("Use IPv4 (default) or IPv6 to communicate with the targets"));
1564 printf (" %s\n", _("Use IPv4 (default) or IPv6 to communicate with the targets")); 1564 printf (" %s\n", "-w");
1565 printf (" %s\n", "-w"); 1565 printf (" %s", _("warning threshold (currently "));
1566 printf (" %s", _("warning threshold (currently ")); 1566 printf ("%0.3fms,%u%%)\n", (float)warn.rta / 1000, warn.pl);
1567 printf ("%0.3fms,%u%%)\n", (float)warn.rta / 1000, warn.pl); 1567 printf (" %s\n", "-c");
1568 printf (" %s\n", "-c"); 1568 printf (" %s", _("critical threshold (currently "));
1569 printf (" %s", _("critical threshold (currently ")); 1569 printf ("%0.3fms,%u%%)\n", (float)crit.rta / 1000, crit.pl);
1570 printf ("%0.3fms,%u%%)\n", (float)crit.rta / 1000, crit.pl); 1570 printf (" %s\n", "-s");
1571 printf (" %s\n", "-s"); 1571 printf (" %s\n", _("specify a source IP address or device name"));
1572 printf (" %s\n", _("specify a source IP address or device name")); 1572 printf (" %s\n", "-n");
1573 printf (" %s\n", "-n"); 1573 printf (" %s", _("number of packets to send (currently "));
1574 printf (" %s", _("number of packets to send (currently ")); 1574 printf ("%u)\n",packets);
1575 printf ("%u)\n",packets); 1575 printf (" %s\n", "-i");
1576 printf (" %s\n", "-i"); 1576 printf (" %s", _("max packet interval (currently "));
1577 printf (" %s", _("max packet interval (currently ")); 1577 printf ("%0.3fms)\n",(float)pkt_interval / 1000);
1578 printf ("%0.3fms)\n",(float)pkt_interval / 1000); 1578 printf (" %s\n", "-I");
1579 printf (" %s\n", "-I"); 1579 printf (" %s", _("max target interval (currently "));
1580 printf (" %s", _("max target interval (currently ")); 1580 printf ("%0.3fms)\n", (float)target_interval / 1000);
1581 printf ("%0.3fms)\n", (float)target_interval / 1000); 1581 printf (" %s\n", "-m");
1582 printf (" %s\n", "-m"); 1582 printf (" %s",_("number of alive hosts required for success"));
1583 printf (" %s",_("number of alive hosts required for success")); 1583 printf ("\n");
1584 printf ("\n"); 1584 printf (" %s\n", "-l");
1585 printf (" %s\n", "-l"); 1585 printf (" %s", _("TTL on outgoing packets (currently "));
1586 printf (" %s", _("TTL on outgoing packets (currently ")); 1586 printf ("%u)\n", ttl);
1587 printf ("%u)\n", ttl); 1587 printf (" %s\n", "-t");
1588 printf (" %s\n", "-t"); 1588 printf (" %s",_("timeout value (seconds, currently "));
1589 printf (" %s",_("timeout value (seconds, currently ")); 1589 printf ("%u)\n", timeout);
1590 printf ("%u)\n", timeout); 1590 printf (" %s\n", "-b");
1591 printf (" %s\n", "-b"); 1591 printf (" %s\n", _("Number of icmp data bytes to send"));
1592 printf (" %s\n", _("Number of icmp data bytes to send")); 1592 printf (" %s %u + %d)\n", _("Packet size will be data bytes + icmp header (currently"),icmp_data_size, ICMP_MINLEN);
1593 printf (" %s %u + %d)\n", _("Packet size will be data bytes + icmp header (currently"),icmp_data_size, ICMP_MINLEN); 1593 printf (" %s\n", "-v");
1594 printf (" %s\n", "-v"); 1594 printf (" %s\n", _("verbose"));
1595 printf (" %s\n", _("verbose")); 1595
1596 1596 printf ("\n");
1597 printf ("\n"); 1597 printf ("%s\n", _("Notes:"));
1598 printf ("%s\n", _("Notes:")); 1598 printf (" %s\n", _("The -H switch is optional. Naming a host (or several) to check is not."));
1599 printf (" %s\n", _("The -H switch is optional. Naming a host (or several) to check is not.")); 1599 printf ("\n");
1600 printf ("\n"); 1600 printf (" %s\n", _("Threshold format for -w and -c is 200.25,60% for 200.25 msec RTA and 60%"));
1601 printf (" %s\n", _("Threshold format for -w and -c is 200.25,60% for 200.25 msec RTA and 60%")); 1601 printf (" %s\n", _("packet loss. The default values should work well for most users."));
1602 printf (" %s\n", _("packet loss. The default values should work well for most users.")); 1602 printf (" %s\n", _("You can specify different RTA factors using the standardized abbreviations"));
1603 printf (" %s\n", _("You can specify different RTA factors using the standardized abbreviations")); 1603 printf (" %s\n", _("us (microseconds), ms (milliseconds, default) or just plain s for seconds."));
1604 printf (" %s\n", _("us (microseconds), ms (milliseconds, default) or just plain s for seconds.")); 1604 /* -d not yet implemented */
1605/* -d not yet implemented */ 1605 /* printf ("%s\n", _("Threshold format for -d is warn,crit. 12,14 means WARNING if >= 12 hops"));
1606/* printf ("%s\n", _("Threshold format for -d is warn,crit. 12,14 means WARNING if >= 12 hops")); 1606 printf ("%s\n", _("are spent and CRITICAL if >= 14 hops are spent."));
1607 printf ("%s\n", _("are spent and CRITICAL if >= 14 hops are spent.")); 1607 printf ("%s\n\n", _("NOTE: Some systems decrease TTL when forming ICMP_ECHOREPLY, others do not."));*/
1608 printf ("%s\n\n", _("NOTE: Some systems decrease TTL when forming ICMP_ECHOREPLY, others do not."));*/ 1608 printf ("\n");
1609 printf ("\n"); 1609 printf (" %s\n", _("The -v switch can be specified several times for increased verbosity."));
1610 printf (" %s\n", _("The -v switch can be specified several times for increased verbosity.")); 1610 /* printf ("%s\n", _("Long options are currently unsupported."));
1611/* printf ("%s\n", _("Long options are currently unsupported.")); 1611 printf ("%s\n", _("Options marked with * require an argument"));
1612 printf ("%s\n", _("Options marked with * require an argument")); 1612 */
1613*/ 1613
1614 1614 printf (UT_SUPPORT);
1615 printf (UT_SUPPORT);
1616} 1615}
1617 1616
1618 1617
@@ -1620,6 +1619,6 @@ print_help(void)
1620void 1619void
1621print_usage (void) 1620print_usage (void)
1622{ 1621{
1623 printf ("%s\n", _("Usage:")); 1622 printf ("%s\n", _("Usage:"));
1624 printf(" %s [options] [-H] host1 host2 hostN\n", progname); 1623 printf(" %s [options] [-H] host1 host2 hostN\n", progname);
1625} 1624}