summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--LEGAL10
-rw-r--r--Makefile.am2
-rw-r--r--NEWS17
-rw-r--r--configure.ac14
-rw-r--r--doc/RELEASING38
-rw-r--r--lib/utils_cmd.c14
-rw-r--r--plugins-root/check_icmp.c75
-rw-r--r--plugins/check_mrtgtraf.c14
-rw-r--r--plugins/check_nt.c51
-rw-r--r--plugins/check_real.c8
-rw-r--r--plugins/check_snmp.c54
-rw-r--r--plugins/check_ssh.c12
-rw-r--r--plugins/check_swap.c3
14 files changed, 214 insertions, 99 deletions
diff --git a/.gitignore b/.gitignore
index 8ea2d8e5..3093c6ea 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,6 +35,7 @@ NP-VERSION-FILE
35/build-aux/install-sh 35/build-aux/install-sh
36/build-aux/missing 36/build-aux/missing
37/build-aux/mkinstalldirs 37/build-aux/mkinstalldirs
38/build-aux/test-driver
38 39
39# /doc/ 40# /doc/
40/doc/developer-guidelines.html 41/doc/developer-guidelines.html
diff --git a/LEGAL b/LEGAL
deleted file mode 100644
index 147fc989..00000000
--- a/LEGAL
+++ /dev/null
@@ -1,10 +0,0 @@
1
2All source code, binaries, documentation, and information contained
3in this distribution are provided AS IS with NO WARRANTY OF ANY KIND,
4INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY, AND FITNESS FOR
5A PARTICULAR PURPOSE.
6
7Nagios and the Nagios logo are trademarks of Ethan Galstad. All
8other trademarks, servicemarks, registered trademarks, and
9registered servicemarks are the property of their respective owner(s).
10
diff --git a/Makefile.am b/Makefile.am
index 9ee0800e..7e0d4131 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,7 +3,7 @@
3SUBDIRS = gl tap lib plugins plugins-scripts plugins-root po @PERLMODS_DIR@ 3SUBDIRS = gl tap lib plugins plugins-scripts plugins-root po @PERLMODS_DIR@
4 4
5EXTRA_DIST = config.rpath \ 5EXTRA_DIST = config.rpath \
6 ABOUT-NLS ACKNOWLEDGEMENTS AUTHORS CODING ChangeLog FAQ LEGAL NEWS \ 6 ABOUT-NLS ACKNOWLEDGEMENTS AUTHORS CODING ChangeLog FAQ NEWS \
7 NP-VERSION-GEN REQUIREMENTS SUPPORT THANKS \ 7 NP-VERSION-GEN REQUIREMENTS SUPPORT THANKS \
8 NPTest.pm pkg \ 8 NPTest.pm pkg \
9 config_test/Makefile config_test/run_tests config_test/child_test.c \ 9 config_test/Makefile config_test/run_tests config_test/child_test.c \
diff --git a/NEWS b/NEWS
index c999e515..70ee6591 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,22 @@
1This file documents the major additions and syntax changes between releases. 1This file documents the major additions and syntax changes between releases.
2 2
32.2 [...]
4 ENHANCEMENTS
5 check_snmp's performance data now also includes warning/critical
6 thresholds
7 New check_snmp "-N" option to specify SNMPv3 context name
8 New check_nt "-l" parameters: seconds|minutes|hours|days
9
10 FIXES
11 Let check_real terminate lines with CRLF when talking to the server, as
12 mandated by 2326
13 Fix check_procs on HP-UX
14
15 WARNINGS
16 The format of the performance data emitted by check_mrtgtraf has been
17 changed to comply with the development guidelines
18 check_ssh not returns CRITICAL for protocal/version errors
19
32.1.1 2nd December 2014 202.1.1 2nd December 2014
4 FIXES 21 FIXES
5 Fix check_ntp's jitter checking 22 Fix check_ntp's jitter checking
diff --git a/configure.ac b/configure.ac
index 2429e990..a6c9e79a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -610,6 +610,7 @@ AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
610dnl #### Process table test 610dnl #### Process table test
611 611
612AC_PATH_PROG(PATH_TO_PS,ps) 612AC_PATH_PROG(PATH_TO_PS,ps)
613AC_PATH_PROG(PATH_TO_ENV,env)
613 614
614AC_MSG_CHECKING(for ps syntax) 615AC_MSG_CHECKING(for ps syntax)
615AC_ARG_WITH(ps_command, 616AC_ARG_WITH(ps_command,
@@ -931,6 +932,19 @@ then
931 ac_cv_ps_cols=6 932 ac_cv_ps_cols=6
932 AC_MSG_RESULT([$ac_cv_ps_command]) 933 AC_MSG_RESULT([$ac_cv_ps_command])
933 934
935dnl HP-UX:
936dnl S UID RUID USER RUSER PID PPID VSZ %CPU COMMAND COMMAND
937dnl S 0 400 root oracle 2805 1 12904 0.00 ora_dism_SEA1X ora_dism_SEA1X
938dnl S 400 400 oracle oracle 19261 1 126488 0.00 tnslsnr /u01/app/oracle/product/db/11.2.0.3/bin/tnslsnr LISTENER -inherit
939elif env UNIX95=1 ps -eo 'state uid ruid user ruser pid ppid vsz pcpu comm args' 2>/dev/null | head -n 1 | \
940 egrep -i ["^ *S +UID +RUID +USER +RUSER +PID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
941then
942 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
943 ac_cv_ps_command="$PATH_TO_ENV UNIX95=1 $PATH_TO_PS -eo 'state uid pid ppid vsz pcpu comm args'"
944 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
945 ac_cv_ps_cols=8
946 AC_MSG_RESULT([$ac_cv_ps_command])
947
934dnl AIX 4.1: 948dnl AIX 4.1:
935dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD 949dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
936dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper 950dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
diff --git a/doc/RELEASING b/doc/RELEASING
index 1eaec9de..eee53d7b 100644
--- a/doc/RELEASING
+++ b/doc/RELEASING
@@ -1,4 +1,4 @@
1NOTES ON RELEASING NEW VERSION OF NAGIOSPLUG 1NOTES ON RELEASING NEW VERSION OF MONITORING-PLUGINS
2 2
3*** Pre-release 3*** Pre-release
4git pull 4git pull
@@ -6,25 +6,23 @@ git pull
6check compilation, check tinderbox screens 6check compilation, check tinderbox screens
7 7
8*** Prepare and commit files 8*** Prepare and commit files
9Update BUGS, NEWS file 9Update NEWS file
10Update AUTHORS if new members 10Update AUTHORS if new members
11Update configure.in, package.def and NP-VERSION-GEN with version 11Update configure.ac and NP-VERSION-GEN with version
12Run git2cl (get from http://josefsson.org/git2cl/): 12commit NEWS configure.ac NP-VERSION-GEN
13git2cl >Changelog
14commit BUGS NEWS configure.in package.def ChangeLog
15 13
16*** Create new annotated tag 14*** Create new annotated tag
17git tag -a release-1.4.14 -m release-1.4.14 15git tag -a v2.1.1 -m v2.1.1
18 16
19*** Push the code and tag to origin 17*** Push the code and tag to origin
20git push origin master 18git push origin master
21git push origin release-1.4.14 19git push origin v2.1.1
22 20
23*** Checkout new version 21*** Checkout new version
24rm -fr /tmp/monitoringlug 22rm -fr /tmp/monitoringlug
25# If you need to checkout the tag, don't forget to "checkout master" later to 23# If you need to checkout the tag, don't forget to "checkout master" later to
26# get back to your development branch: 24# get back to your development branch:
27git checkout tags/release-1.4.14 25git checkout tags/v2.1.1
28# Beware: the trailing slash of --prefix is REQUIRED 26# Beware: the trailing slash of --prefix is REQUIRED
29git checkout-index --prefix=/tmp/monitoringlug/ -a 27git checkout-index --prefix=/tmp/monitoringlug/ -a
30 28
@@ -34,27 +32,7 @@ tools/setup
34./configure 32./configure
35make dist 33make dist
36 34
37*** Upload generated tarball to sourceforge 35*** Upload generated tarball to our Project Site
38sftp frs.sourceforge.net
39SF username and password
40cd /uploads
41put file
42
43SF -> Submit News about release. Make sure it is called "Monitoring Plugins" (with those caps)
44Link to download at http://sourceforge.net/project/showfiles.php?group_id=29880
45Include contents of NEWS for this release
46List all people on team involved.
47Add acknowledgement to contributors
48Submit. Get URL to news item
49
50SF -> Admin -> File Releases
51Add a release to nagiosplug and create a file release
52Name: 1.4.14
53Create release
54Step 1: Add release notes pointing to news item
55Step 2: add file
56Step 3: *.tar.gz, Platform Independent, Source .gz
57Step 4: Send notice
58 36
59*** Announce new release 37*** Announce new release
60Send email to help, announce with the news text 38Send email to help, announce with the news text
diff --git a/lib/utils_cmd.c b/lib/utils_cmd.c
index 9e214bd4..7eb9a3a0 100644
--- a/lib/utils_cmd.c
+++ b/lib/utils_cmd.c
@@ -79,12 +79,14 @@ static pid_t *_cmd_pids = NULL;
79 * If that fails and the macro isn't defined, we fall back to an educated 79 * If that fails and the macro isn't defined, we fall back to an educated
80 * guess. There's no guarantee that our guess is adequate and the program 80 * guess. There's no guarantee that our guess is adequate and the program
81 * will die with SIGSEGV if it isn't and the upper boundary is breached. */ 81 * will die with SIGSEGV if it isn't and the upper boundary is breached. */
82#define DEFAULT_MAXFD 256 /* fallback value if no max open files value is set */
83#define MAXFD_LIMIT 8192 /* upper limit of open files */
82#ifdef _SC_OPEN_MAX 84#ifdef _SC_OPEN_MAX
83static long maxfd = 0; 85static long maxfd = 0;
84#elif defined(OPEN_MAX) 86#elif defined(OPEN_MAX)
85# define maxfd OPEN_MAX 87# define maxfd OPEN_MAX
86#else /* sysconf macro unavailable, so guess (may be wildly inaccurate) */ 88#else /* sysconf macro unavailable, so guess (may be wildly inaccurate) */
87# define maxfd 256 89# define maxfd DEFAULT_MAXFD
88#endif 90#endif
89 91
90 92
@@ -112,10 +114,18 @@ cmd_init (void)
112 if (!maxfd && (maxfd = sysconf (_SC_OPEN_MAX)) < 0) { 114 if (!maxfd && (maxfd = sysconf (_SC_OPEN_MAX)) < 0) {
113 /* possibly log or emit a warning here, since there's no 115 /* possibly log or emit a warning here, since there's no
114 * guarantee that our guess at maxfd will be adequate */ 116 * guarantee that our guess at maxfd will be adequate */
115 maxfd = 256; 117 maxfd = DEFAULT_MAXFD;
116 } 118 }
117#endif 119#endif
118 120
121 /* if maxfd is unnaturally high, we force it to a lower value
122 * ( e.g. on SunOS, when ulimit is set to unlimited: 2147483647 this would cause
123 * a segfault when following calloc is called ... ) */
124
125 if ( maxfd > MAXFD_LIMIT ) {
126 maxfd = MAXFD_LIMIT;
127 }
128
119 if (!_cmd_pids) 129 if (!_cmd_pids)
120 _cmd_pids = calloc (maxfd, sizeof (pid_t)); 130 _cmd_pids = calloc (maxfd, sizeof (pid_t));
121} 131}
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c
index 8b563e40..44c6826c 100644
--- a/plugins-root/check_icmp.c
+++ b/plugins-root/check_icmp.c
@@ -184,7 +184,7 @@ static u_int get_timevar(const char *);
184static u_int get_timevaldiff(struct timeval *, struct timeval *); 184static u_int get_timevaldiff(struct timeval *, struct timeval *);
185static in_addr_t get_ip_address(const char *); 185static in_addr_t get_ip_address(const char *);
186static int wait_for_reply(int, u_int); 186static int wait_for_reply(int, u_int);
187static int recvfrom_wto(int, void *, unsigned int, struct sockaddr *, u_int *); 187static int recvfrom_wto(int, void *, unsigned int, struct sockaddr *, u_int *, struct timeval*);
188static int send_icmp_ping(int, struct rta_host *); 188static int send_icmp_ping(int, struct rta_host *);
189static int get_threshold(char *str, threshold *th); 189static int get_threshold(char *str, threshold *th);
190static void run_checks(void); 190static void run_checks(void);
@@ -378,6 +378,9 @@ main(int argc, char **argv)
378 int icmp_sockerrno, udp_sockerrno, tcp_sockerrno; 378 int icmp_sockerrno, udp_sockerrno, tcp_sockerrno;
379 int result; 379 int result;
380 struct rta_host *host; 380 struct rta_host *host;
381#ifdef SO_TIMESTAMP
382 int on = 1;
383#endif
381 384
382 setlocale (LC_ALL, ""); 385 setlocale (LC_ALL, "");
383 bindtextdomain (PACKAGE, LOCALEDIR); 386 bindtextdomain (PACKAGE, LOCALEDIR);
@@ -402,6 +405,11 @@ main(int argc, char **argv)
402 /* now drop privileges (no effect if not setsuid or geteuid() == 0) */ 405 /* now drop privileges (no effect if not setsuid or geteuid() == 0) */
403 setuid(getuid()); 406 setuid(getuid());
404 407
408#ifdef SO_TIMESTAMP
409 if(setsockopt(icmp_sock, SOL_SOCKET, SO_TIMESTAMP, &on, sizeof(on)))
410 if(debug) printf("Warning: no SO_TIMESTAMP support\n");
411#endif // SO_TIMESTAMP
412
405 /* POSIXLY_CORRECT might break things, so unset it (the portable way) */ 413 /* POSIXLY_CORRECT might break things, so unset it (the portable way) */
406 environ = NULL; 414 environ = NULL;
407 415
@@ -462,13 +470,13 @@ main(int argc, char **argv)
462 /* parse the arguments */ 470 /* parse the arguments */
463 for(i = 1; i < argc; i++) { 471 for(i = 1; i < argc; i++) {
464 while((arg = getopt(argc, argv, "vhVw:c:n:p:t:H:s:i:b:I:l:m:")) != EOF) { 472 while((arg = getopt(argc, argv, "vhVw:c:n:p:t:H:s:i:b:I:l:m:")) != EOF) {
465 long size; 473 unsigned short size;
466 switch(arg) { 474 switch(arg) {
467 case 'v': 475 case 'v':
468 debug++; 476 debug++;
469 break; 477 break;
470 case 'b': 478 case 'b':
471 size = strtol(optarg,NULL,0); 479 size = (unsigned short)strtol(optarg,NULL,0);
472 if (size >= (sizeof(struct icmp) + sizeof(struct icmp_ping_data)) && 480 if (size >= (sizeof(struct icmp) + sizeof(struct icmp_ping_data)) &&
473 size < MAX_PING_DATA) { 481 size < MAX_PING_DATA) {
474 icmp_data_size = size; 482 icmp_data_size = size;
@@ -727,7 +735,7 @@ wait_for_reply(int sock, u_int t)
727 735
728 /* reap responses until we hit a timeout */ 736 /* reap responses until we hit a timeout */
729 n = recvfrom_wto(sock, buf, sizeof(buf), 737 n = recvfrom_wto(sock, buf, sizeof(buf),
730 (struct sockaddr *)&resp_addr, &t); 738 (struct sockaddr *)&resp_addr, &t, &now);
731 if(!n) { 739 if(!n) {
732 if(debug > 1) { 740 if(debug > 1) {
733 printf("recvfrom_wto() timed out during a %u usecs wait\n", 741 printf("recvfrom_wto() timed out during a %u usecs wait\n",
@@ -777,11 +785,10 @@ wait_for_reply(int sock, u_int t)
777 /* this is indeed a valid response */ 785 /* this is indeed a valid response */
778 memcpy(&data, icp.icmp_data, sizeof(data)); 786 memcpy(&data, icp.icmp_data, sizeof(data));
779 if (debug > 2) 787 if (debug > 2)
780 printf("ICMP echo-reply of len %u, id %u, seq %u, cksum 0x%X\n", 788 printf("ICMP echo-reply of len %lu, id %u, seq %u, cksum 0x%X\n",
781 sizeof(data), ntohs(icp.icmp_id), ntohs(icp.icmp_seq), icp.icmp_cksum); 789 sizeof(data), ntohs(icp.icmp_id), ntohs(icp.icmp_seq), icp.icmp_cksum);
782 790
783 host = table[ntohs(icp.icmp_seq)/packets]; 791 host = table[ntohs(icp.icmp_seq)/packets];
784 gettimeofday(&now, &tz);
785 tdiff = get_timevaldiff(&data.stime, &now); 792 tdiff = get_timevaldiff(&data.stime, &now);
786 793
787 host->time_waited += tdiff; 794 host->time_waited += tdiff;
@@ -823,6 +830,8 @@ send_icmp_ping(int sock, struct rta_host *host)
823 } packet = { NULL }; 830 } packet = { NULL };
824 long int len; 831 long int len;
825 struct icmp_ping_data data; 832 struct icmp_ping_data data;
833 struct msghdr hdr;
834 struct iovec iov;
826 struct timeval tv; 835 struct timeval tv;
827 struct sockaddr *addr; 836 struct sockaddr *addr;
828 837
@@ -855,11 +864,20 @@ send_icmp_ping(int sock, struct rta_host *host)
855 packet.icp->icmp_cksum = icmp_checksum(packet.cksum_in, icmp_pkt_size); 864 packet.icp->icmp_cksum = icmp_checksum(packet.cksum_in, icmp_pkt_size);
856 865
857 if (debug > 2) 866 if (debug > 2)
858 printf("Sending ICMP echo-request of len %u, id %u, seq %u, cksum 0x%X to host %s\n", 867 printf("Sending ICMP echo-request of len %lu, id %u, seq %u, cksum 0x%X to host %s\n",
859 sizeof(data), ntohs(packet.icp->icmp_id), ntohs(packet.icp->icmp_seq), packet.icp->icmp_cksum, host->name); 868 sizeof(data), ntohs(packet.icp->icmp_id), ntohs(packet.icp->icmp_seq), packet.icp->icmp_cksum, host->name);
860 869
861 len = sendto(sock, packet.buf, icmp_pkt_size, 0, (struct sockaddr *)addr, 870 memset(&iov, 0, sizeof(iov));
862 sizeof(struct sockaddr)); 871 iov.iov_base = packet.buf;
872 iov.iov_len = icmp_pkt_size;
873
874 memset(&hdr, 0, sizeof(hdr));
875 hdr.msg_name = addr;
876 hdr.msg_namelen = sizeof(struct sockaddr);
877 hdr.msg_iov = &iov;
878 hdr.msg_iovlen = 1;
879
880 len = sendmsg(sock, &hdr, MSG_CONFIRM);
863 881
864 if(len < 0 || (unsigned int)len != icmp_pkt_size) { 882 if(len < 0 || (unsigned int)len != icmp_pkt_size) {
865 if(debug) printf("Failed to send ping to %s\n", 883 if(debug) printf("Failed to send ping to %s\n",
@@ -875,12 +893,18 @@ send_icmp_ping(int sock, struct rta_host *host)
875 893
876static int 894static int
877recvfrom_wto(int sock, void *buf, unsigned int len, struct sockaddr *saddr, 895recvfrom_wto(int sock, void *buf, unsigned int len, struct sockaddr *saddr,
878 u_int *timo) 896 u_int *timo, struct timeval* tv)
879{ 897{
880 u_int slen; 898 u_int slen;
881 int n; 899 int n, ret;
882 struct timeval to, then, now; 900 struct timeval to, then, now;
883 fd_set rd, wr; 901 fd_set rd, wr;
902 char ans_data[4096];
903 struct msghdr hdr;
904 struct iovec iov;
905#ifdef SO_TIMESTAMP
906 struct cmsghdr* chdr;
907#endif
884 908
885 if(!*timo) { 909 if(!*timo) {
886 if(debug) printf("*timo is not\n"); 910 if(debug) printf("*timo is not\n");
@@ -904,7 +928,32 @@ recvfrom_wto(int sock, void *buf, unsigned int len, struct sockaddr *saddr,
904 928
905 slen = sizeof(struct sockaddr); 929 slen = sizeof(struct sockaddr);
906 930
907 return recvfrom(sock, buf, len, 0, saddr, &slen); 931 memset(&iov, 0, sizeof(iov));
932 iov.iov_base = buf;
933 iov.iov_len = len;
934
935 memset(&hdr, 0, sizeof(hdr));
936 hdr.msg_name = saddr;
937 hdr.msg_namelen = slen;
938 hdr.msg_iov = &iov;
939 hdr.msg_iovlen = 1;
940 hdr.msg_control = ans_data;
941 hdr.msg_controllen = sizeof(ans_data);
942
943 ret = recvmsg(sock, &hdr, 0);
944#ifdef SO_TIMESTAMP
945 for(chdr = CMSG_FIRSTHDR(&hdr); chdr; chdr = CMSG_NXTHDR(&hdr, chdr)) {
946 if(chdr->cmsg_level == SOL_SOCKET
947 && chdr->cmsg_type == SO_TIMESTAMP
948 && chdr->cmsg_len >= CMSG_LEN(sizeof(struct timeval))) {
949 memcpy(tv, CMSG_DATA(chdr), sizeof(*tv));
950 break ;
951 }
952 }
953 if (!chdr)
954#endif // SO_TIMESTAMP
955 gettimeofday(tv, &tz);
956 return (ret);
908} 957}
909 958
910static void 959static void
@@ -1183,7 +1232,7 @@ static u_int
1183get_timevar(const char *str) 1232get_timevar(const char *str)
1184{ 1233{
1185 char p, u, *ptr; 1234 char p, u, *ptr;
1186 unsigned int len; 1235 size_t len;
1187 u_int i, d; /* integer and decimal, respectively */ 1236 u_int i, d; /* integer and decimal, respectively */
1188 u_int factor = 1000; /* default to milliseconds */ 1237 u_int factor = 1000; /* default to milliseconds */
1189 1238
diff --git a/plugins/check_mrtgtraf.c b/plugins/check_mrtgtraf.c
index 32ba0507..3b038cf1 100644
--- a/plugins/check_mrtgtraf.c
+++ b/plugins/check_mrtgtraf.c
@@ -148,37 +148,37 @@ main (int argc, char **argv)
148 148
149 /* report incoming traffic in Bytes/sec */ 149 /* report incoming traffic in Bytes/sec */
150 if (incoming_rate < 1024) { 150 if (incoming_rate < 1024) {
151 strcpy (incoming_speed_rating, "B/s"); 151 strcpy (incoming_speed_rating, "B");
152 adjusted_incoming_rate = (double) incoming_rate; 152 adjusted_incoming_rate = (double) incoming_rate;
153 } 153 }
154 154
155 /* report incoming traffic in KBytes/sec */ 155 /* report incoming traffic in KBytes/sec */
156 else if (incoming_rate < (1024 * 1024)) { 156 else if (incoming_rate < (1024 * 1024)) {
157 strcpy (incoming_speed_rating, "KB/s"); 157 strcpy (incoming_speed_rating, "KB");
158 adjusted_incoming_rate = (double) (incoming_rate / 1024.0); 158 adjusted_incoming_rate = (double) (incoming_rate / 1024.0);
159 } 159 }
160 160
161 /* report incoming traffic in MBytes/sec */ 161 /* report incoming traffic in MBytes/sec */
162 else { 162 else {
163 strcpy (incoming_speed_rating, "MB/s"); 163 strcpy (incoming_speed_rating, "MB");
164 adjusted_incoming_rate = (double) (incoming_rate / 1024.0 / 1024.0); 164 adjusted_incoming_rate = (double) (incoming_rate / 1024.0 / 1024.0);
165 } 165 }
166 166
167 /* report outgoing traffic in Bytes/sec */ 167 /* report outgoing traffic in Bytes/sec */
168 if (outgoing_rate < 1024) { 168 if (outgoing_rate < 1024) {
169 strcpy (outgoing_speed_rating, "B/s"); 169 strcpy (outgoing_speed_rating, "B");
170 adjusted_outgoing_rate = (double) outgoing_rate; 170 adjusted_outgoing_rate = (double) outgoing_rate;
171 } 171 }
172 172
173 /* report outgoing traffic in KBytes/sec */ 173 /* report outgoing traffic in KBytes/sec */
174 else if (outgoing_rate < (1024 * 1024)) { 174 else if (outgoing_rate < (1024 * 1024)) {
175 strcpy (outgoing_speed_rating, "KB/s"); 175 strcpy (outgoing_speed_rating, "KB");
176 adjusted_outgoing_rate = (double) (outgoing_rate / 1024.0); 176 adjusted_outgoing_rate = (double) (outgoing_rate / 1024.0);
177 } 177 }
178 178
179 /* report outgoing traffic in MBytes/sec */ 179 /* report outgoing traffic in MBytes/sec */
180 else { 180 else {
181 strcpy (outgoing_speed_rating, "MB/s"); 181 strcpy (outgoing_speed_rating, "MB");
182 adjusted_outgoing_rate = (double) (outgoing_rate / 1024.0 / 1024.0); 182 adjusted_outgoing_rate = (double) (outgoing_rate / 1024.0 / 1024.0);
183 } 183 }
184 184
@@ -191,7 +191,7 @@ main (int argc, char **argv)
191 result = STATE_WARNING; 191 result = STATE_WARNING;
192 } 192 }
193 193
194 xasprintf (&error_message, _("%s. In = %0.1f %s, %s. Out = %0.1f %s|%s %s\n"), 194 xasprintf (&error_message, _("%s. In = %0.1f %s/s, %s. Out = %0.1f %s/s|%s %s\n"),
195 (use_average == TRUE) ? _("Avg") : _("Max"), adjusted_incoming_rate, 195 (use_average == TRUE) ? _("Avg") : _("Max"), adjusted_incoming_rate,
196 incoming_speed_rating, (use_average == TRUE) ? _("Avg") : _("Max"), 196 incoming_speed_rating, (use_average == TRUE) ? _("Avg") : _("Max"),
197 adjusted_outgoing_rate, outgoing_speed_rating, 197 adjusted_outgoing_rate, outgoing_speed_rating,
diff --git a/plugins/check_nt.c b/plugins/check_nt.c
index fefbfb7a..f621b0a8 100644
--- a/plugins/check_nt.c
+++ b/plugins/check_nt.c
@@ -197,19 +197,40 @@ int main(int argc, char **argv){
197 197
198 case CHECK_UPTIME: 198 case CHECK_UPTIME:
199 199
200 xasprintf(&send_buffer, "%s&3", req_password); 200 if (value_list == NULL) {
201 fetch_data (server_address, server_port, send_buffer); 201 value_list = "minutes";
202 uptime=strtoul(recv_buffer,NULL,10); 202 }
203 updays = uptime / 86400; 203 if (strncmp(value_list, "seconds", strlen("seconds") + 1 ) &&
204 uphours = (uptime % 86400) / 3600; 204 strncmp(value_list, "minutes", strlen("minutes") + 1) &&
205 upminutes = ((uptime % 86400) % 3600) / 60; 205 strncmp(value_list, "hours", strlen("hours") + 1) &&
206 xasprintf(&output_message,_("System Uptime - %u day(s) %u hour(s) %u minute(s)|uptime=%lu"), updays, uphours, upminutes, uptime); 206 strncmp(value_list, "days", strlen("days") + 1)) {
207 if (check_critical_value==TRUE && uptime <= critical_value) 207
208 return_code=STATE_CRITICAL; 208 output_message = strdup (_("wrong -l argument"));
209 else if (check_warning_value==TRUE && uptime <= warning_value) 209 } else {
210 return_code=STATE_WARNING; 210 xasprintf(&send_buffer, "%s&3", req_password);
211 else 211 fetch_data (server_address, server_port, send_buffer);
212 return_code=STATE_OK; 212 uptime=strtoul(recv_buffer,NULL,10);
213 updays = uptime / 86400;
214 uphours = (uptime % 86400) / 3600;
215 upminutes = ((uptime % 86400) % 3600) / 60;
216
217 if (!strncmp(value_list, "minutes", strlen("minutes")))
218 uptime = uptime / 60;
219 else if (!strncmp(value_list, "hours", strlen("hours")))
220 uptime = uptime / 3600;
221 else if (!strncmp(value_list, "days", strlen("days")))
222 uptime = uptime / 86400;
223 /* else uptime in seconds, nothing to do */
224
225 xasprintf(&output_message,_("System Uptime - %u day(s) %u hour(s) %u minute(s) |uptime=%lu"),updays, uphours, upminutes, uptime);
226
227 if (check_critical_value==TRUE && uptime <= critical_value)
228 return_code=STATE_CRITICAL;
229 else if (check_warning_value==TRUE && uptime <= warning_value)
230 return_code=STATE_WARNING;
231 else
232 return_code=STATE_OK;
233 }
213 break; 234 break;
214 235
215 case CHECK_USEDDISKSPACE: 236 case CHECK_USEDDISKSPACE:
@@ -713,7 +734,9 @@ void print_help(void)
713 printf (" %s\n", "ie: -l 60,90,95,120,90,95"); 734 printf (" %s\n", "ie: -l 60,90,95,120,90,95");
714 printf (" %s\n", "UPTIME ="); 735 printf (" %s\n", "UPTIME =");
715 printf (" %s\n", _("Get the uptime of the machine.")); 736 printf (" %s\n", _("Get the uptime of the machine."));
716 printf (" %s\n", _("No specific parameters. No warning or critical threshold")); 737 printf (" %s\n", _("-l <unit> "));
738 printf (" %s\n", _("<unit> = seconds, minutes, hours, or days. (default: minutes)"));
739 printf (" %s\n", _("Thresholds will use the unit specified above."));
717 printf (" %s\n", "USEDDISKSPACE ="); 740 printf (" %s\n", "USEDDISKSPACE =");
718 printf (" %s\n", _("Size and percentage of disk use.")); 741 printf (" %s\n", _("Size and percentage of disk use."));
719 printf (" %s\n", _("Request a -l parameter containing the drive letter only.")); 742 printf (" %s\n", _("Request a -l parameter containing the drive letter only."));
diff --git a/plugins/check_real.c b/plugins/check_real.c
index 1816bf56..00bd4d20 100644
--- a/plugins/check_real.c
+++ b/plugins/check_real.c
@@ -163,17 +163,17 @@ main (int argc, char **argv)
163 163
164 /* Part I - Server Check */ 164 /* Part I - Server Check */
165 165
166 /* send the OPTIONS request */ 166 /* send the DESCRIBE request */
167 sprintf (buffer, "DESCRIBE rtsp://%s:%d%s RTSP/1.0\n", host_name, 167 sprintf (buffer, "DESCRIBE rtsp://%s:%d%s RTSP/1.0\r\n", host_name,
168 server_port, server_url); 168 server_port, server_url);
169 result = send (sd, buffer, strlen (buffer), 0); 169 result = send (sd, buffer, strlen (buffer), 0);
170 170
171 /* send the header sync */ 171 /* send the header sync */
172 sprintf (buffer, "CSeq: 2\n"); 172 sprintf (buffer, "CSeq: 2\r\n");
173 result = send (sd, buffer, strlen (buffer), 0); 173 result = send (sd, buffer, strlen (buffer), 0);
174 174
175 /* send a newline so the server knows we're done with the request */ 175 /* send a newline so the server knows we're done with the request */
176 sprintf (buffer, "\n"); 176 sprintf (buffer, "\r\n");
177 result = send (sd, buffer, strlen (buffer), 0); 177 result = send (sd, buffer, strlen (buffer), 0);
178 178
179 /* watch for the REAL connection string */ 179 /* watch for the REAL connection string */
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 2c62a230..9d966faa 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -104,6 +104,8 @@ int errcode, excode;
104 104
105char *server_address = NULL; 105char *server_address = NULL;
106char *community = NULL; 106char *community = NULL;
107char **contextargs = NULL;
108char *context = NULL;
107char **authpriv = NULL; 109char **authpriv = NULL;
108char *proto = NULL; 110char *proto = NULL;
109char *seclevel = NULL; 111char *seclevel = NULL;
@@ -128,6 +130,7 @@ size_t nunits = 0;
128size_t unitv_size = OID_COUNT_STEP; 130size_t unitv_size = OID_COUNT_STEP;
129int numoids = 0; 131int numoids = 0;
130int numauthpriv = 0; 132int numauthpriv = 0;
133int numcontext = 0;
131int verbose = 0; 134int verbose = 0;
132int usesnmpgetnext = FALSE; 135int usesnmpgetnext = FALSE;
133char *warning_thresholds = NULL; 136char *warning_thresholds = NULL;
@@ -297,8 +300,8 @@ main (int argc, char **argv)
297 snmpcmd = strdup (PATH_TO_SNMPGET); 300 snmpcmd = strdup (PATH_TO_SNMPGET);
298 } 301 }
299 302
300 /* 10 arguments to pass before authpriv options + 1 for host and numoids. Add one for terminating NULL */ 303 /* 10 arguments to pass before context and authpriv options + 1 for host and numoids. Add one for terminating NULL */
301 command_line = calloc (10 + numauthpriv + 1 + numoids + 1, sizeof (char *)); 304 command_line = calloc (10 + numcontext + numauthpriv + 1 + numoids + 1, sizeof (char *));
302 command_line[0] = snmpcmd; 305 command_line[0] = snmpcmd;
303 command_line[1] = strdup ("-Le"); 306 command_line[1] = strdup ("-Le");
304 command_line[2] = strdup ("-t"); 307 command_line[2] = strdup ("-t");
@@ -310,23 +313,27 @@ main (int argc, char **argv)
310 command_line[8] = "-v"; 313 command_line[8] = "-v";
311 command_line[9] = strdup (proto); 314 command_line[9] = strdup (proto);
312 315
316 for (i = 0; i < numcontext; i++) {
317 command_line[10 + i] = contextargs[i];
318 }
319
313 for (i = 0; i < numauthpriv; i++) { 320 for (i = 0; i < numauthpriv; i++) {
314 command_line[10 + i] = authpriv[i]; 321 command_line[10 + numcontext + i] = authpriv[i];
315 } 322 }
316 323
317 xasprintf (&command_line[10 + numauthpriv], "%s:%s", server_address, port); 324 xasprintf (&command_line[10 + numcontext + numauthpriv], "%s:%s", server_address, port);
318 325
319 /* This is just for display purposes, so it can remain a string */ 326 /* This is just for display purposes, so it can remain a string */
320 xasprintf(&cl_hidden_auth, "%s -Le -t %d -r %d -m %s -v %s %s %s:%s", 327 xasprintf(&cl_hidden_auth, "%s -Le -t %d -r %d -m %s -v %s %s %s %s:%s",
321 snmpcmd, timeout_interval, retries, strlen(miblist) ? miblist : "''", proto, "[authpriv]", 328 snmpcmd, timeout_interval, retries, strlen(miblist) ? miblist : "''", proto, "[context]", "[authpriv]",
322 server_address, port); 329 server_address, port);
323 330
324 for (i = 0; i < numoids; i++) { 331 for (i = 0; i < numoids; i++) {
325 command_line[10 + numauthpriv + 1 + i] = oids[i]; 332 command_line[10 + numcontext + numauthpriv + 1 + i] = oids[i];
326 xasprintf(&cl_hidden_auth, "%s %s", cl_hidden_auth, oids[i]); 333 xasprintf(&cl_hidden_auth, "%s %s", cl_hidden_auth, oids[i]);
327 } 334 }
328 335
329 command_line[10 + numauthpriv + 1 + numoids] = NULL; 336 command_line[10 + numcontext + numauthpriv + 1 + numoids] = NULL;
330 337
331 if (verbose) 338 if (verbose)
332 printf ("%s\n", cl_hidden_auth); 339 printf ("%s\n", cl_hidden_auth);
@@ -567,6 +574,18 @@ main (int argc, char **argv)
567 len = sizeof(perfstr)-strlen(perfstr)-1; 574 len = sizeof(perfstr)-strlen(perfstr)-1;
568 strncat(perfstr, show, len>ptr-show ? ptr-show : len); 575 strncat(perfstr, show, len>ptr-show ? ptr-show : len);
569 576
577 if (warning_thresholds) {
578 strncat(perfstr, ";", sizeof(perfstr)-strlen(perfstr)-1);
579 strncat(perfstr, warning_thresholds, sizeof(perfstr)-strlen(perfstr)-1);
580 }
581
582 if (critical_thresholds) {
583 if (!warning_thresholds)
584 strncat(perfstr, ";", sizeof(perfstr)-strlen(perfstr)-1);
585 strncat(perfstr, ";", sizeof(perfstr)-strlen(perfstr)-1);
586 strncat(perfstr, critical_thresholds, sizeof(perfstr)-strlen(perfstr)-1);
587 }
588
570 if (type) 589 if (type)
571 strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1); 590 strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1);
572 strncat(perfstr, " ", sizeof(perfstr)-strlen(perfstr)-1); 591 strncat(perfstr, " ", sizeof(perfstr)-strlen(perfstr)-1);
@@ -646,6 +665,7 @@ process_arguments (int argc, char **argv)
646 {"retries", required_argument, 0, 'e'}, 665 {"retries", required_argument, 0, 'e'},
647 {"miblist", required_argument, 0, 'm'}, 666 {"miblist", required_argument, 0, 'm'},
648 {"protocol", required_argument, 0, 'P'}, 667 {"protocol", required_argument, 0, 'P'},
668 {"context", required_argument, 0, 'N'},
649 {"seclevel", required_argument, 0, 'L'}, 669 {"seclevel", required_argument, 0, 'L'},
650 {"secname", required_argument, 0, 'U'}, 670 {"secname", required_argument, 0, 'U'},
651 {"authproto", required_argument, 0, 'a'}, 671 {"authproto", required_argument, 0, 'a'},
@@ -675,7 +695,7 @@ process_arguments (int argc, char **argv)
675 } 695 }
676 696
677 while (1) { 697 while (1) {
678 c = getopt_long (argc, argv, "nhvVOt:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:L:U:a:x:A:X:", 698 c = getopt_long (argc, argv, "nhvVOt:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:N:L:U:a:x:A:X:",
679 longopts, &option); 699 longopts, &option);
680 700
681 if (c == -1 || c == EOF) 701 if (c == -1 || c == EOF)
@@ -713,6 +733,9 @@ process_arguments (int argc, char **argv)
713 case 'P': /* SNMP protocol version */ 733 case 'P': /* SNMP protocol version */
714 proto = optarg; 734 proto = optarg;
715 break; 735 break;
736 case 'N': /* SNMPv3 context */
737 context = optarg;
738 break;
716 case 'L': /* security level */ 739 case 'L': /* security level */
717 seclevel = optarg; 740 seclevel = optarg;
718 break; 741 break;
@@ -960,6 +983,13 @@ validate_arguments ()
960 authpriv[1] = strdup (community); 983 authpriv[1] = strdup (community);
961 } 984 }
962 else if ( strcmp (proto, "3") == 0 ) { /* snmpv3 args */ 985 else if ( strcmp (proto, "3") == 0 ) { /* snmpv3 args */
986 if (!(context == NULL)) {
987 numcontext = 2;
988 contextargs = calloc (numcontext, sizeof (char *));
989 contextargs[0] = strdup ("-n");
990 contextargs[1] = strdup (context);
991 }
992
963 if (seclevel == NULL) 993 if (seclevel == NULL)
964 xasprintf(&seclevel, "noAuthNoPriv"); 994 xasprintf(&seclevel, "noAuthNoPriv");
965 995
@@ -1103,6 +1133,8 @@ print_help (void)
1103 printf (" %s\n", _("Use SNMP GETNEXT instead of SNMP GET")); 1133 printf (" %s\n", _("Use SNMP GETNEXT instead of SNMP GET"));
1104 printf (" %s\n", "-P, --protocol=[1|2c|3]"); 1134 printf (" %s\n", "-P, --protocol=[1|2c|3]");
1105 printf (" %s\n", _("SNMP protocol version")); 1135 printf (" %s\n", _("SNMP protocol version"));
1136 printf (" %s\n", "-N, --context=CONTEXT");
1137 printf (" %s\n", _("SNMPv3 context"));
1106 printf (" %s\n", "-L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]"); 1138 printf (" %s\n", "-L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]");
1107 printf (" %s\n", _("SNMPv3 securityLevel")); 1139 printf (" %s\n", _("SNMPv3 securityLevel"));
1108 printf (" %s\n", "-a, --authproto=[MD5|SHA]"); 1140 printf (" %s\n", "-a, --authproto=[MD5|SHA]");
@@ -1210,6 +1242,6 @@ print_usage (void)
1210 printf ("%s -H <ip_address> -o <OID> [-w warn_range] [-c crit_range]\n",progname); 1242 printf ("%s -H <ip_address> -o <OID> [-w warn_range] [-c crit_range]\n",progname);
1211 printf ("[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]\n"); 1243 printf ("[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]\n");
1212 printf ("[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]\n"); 1244 printf ("[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]\n");
1213 printf ("[-m miblist] [-P snmp version] [-L seclevel] [-U secname] [-a authproto]\n"); 1245 printf ("[-m miblist] [-P snmp version] [-N context] [-L seclevel] [-U secname]\n");
1214 printf ("[-A authpasswd] [-x privproto] [-X privpasswd]\n"); 1246 printf ("[-a authproto] [-A authpasswd] [-x privproto] [-X privpasswd]\n");
1215} 1247}
diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c
index b6187d61..3658965e 100644
--- a/plugins/check_ssh.c
+++ b/plugins/check_ssh.c
@@ -253,18 +253,18 @@ ssh_connect (char *haddr, int hport, char *remote_version, char *remote_protocol
253 253
254 if (remote_version && strcmp(remote_version, ssh_server)) { 254 if (remote_version && strcmp(remote_version, ssh_server)) {
255 printf 255 printf
256 (_("SSH WARNING - %s (protocol %s) version mismatch, expected '%s'\n"), 256 (_("SSH CRITICAL - %s (protocol %s) version mismatch, expected '%s'\n"),
257 ssh_server, ssh_proto, remote_version); 257 ssh_server, ssh_proto, remote_version);
258 close(sd); 258 close(sd);
259 exit (STATE_WARNING); 259 exit (STATE_CRITICAL);
260 } 260 }
261 261
262 if (remote_protocol && strcmp(remote_protocol, ssh_proto)) { 262 if (remote_protocol && strcmp(remote_protocol, ssh_proto)) {
263 printf 263 printf
264 (_("SSH WARNING - %s (protocol %s) protocol version mismatch, expected '%s'\n"), 264 (_("SSH CRITICAL - %s (protocol %s) protocol version mismatch, expected '%s'\n"),
265 ssh_server, ssh_proto, remote_protocol); 265 ssh_server, ssh_proto, remote_protocol);
266 close(sd); 266 close(sd);
267 exit (STATE_WARNING); 267 exit (STATE_CRITICAL);
268 } 268 }
269 269
270 elapsed_time = (double)deltime(tv) / 1.0e6; 270 elapsed_time = (double)deltime(tv) / 1.0e6;
@@ -307,10 +307,10 @@ print_help (void)
307 printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); 307 printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
308 308
309 printf (" %s\n", "-r, --remote-version=STRING"); 309 printf (" %s\n", "-r, --remote-version=STRING");
310 printf (" %s\n", _("Warn if string doesn't match expected server version (ex: OpenSSH_3.9p1)")); 310 printf (" %s\n", _("Alert if string doesn't match expected server version (ex: OpenSSH_3.9p1)"));
311 311
312 printf (" %s\n", "-P, --remote-protocol=STRING"); 312 printf (" %s\n", "-P, --remote-protocol=STRING");
313 printf (" %s\n", _("Warn if protocol doesn't match expected protocol version (ex: 2.0)")); 313 printf (" %s\n", _("Alert if protocol doesn't match expected protocol version (ex: 2.0)"));
314 314
315 printf (UT_VERBOSE); 315 printf (UT_VERBOSE);
316 316
diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index 88a2a2ad..25e0bacd 100644
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
@@ -1,6 +1,6 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* Monitoring check_disk plugin 3* Monitoring check_swap plugin
4* 4*
5* License: GPL 5* License: GPL
6* Copyright (c) 2000 Karl DeBisschop (kdebisschop@users.sourceforge.net) 6* Copyright (c) 2000 Karl DeBisschop (kdebisschop@users.sourceforge.net)
@@ -352,6 +352,7 @@ main (int argc, char **argv)
352 percent_used = 100 * ((double) used_swap_mb) / ((double) total_swap_mb); 352 percent_used = 100 * ((double) used_swap_mb) / ((double) total_swap_mb);
353 } else { 353 } else {
354 percent_used = 100; 354 percent_used = 100;
355 status = "- Swap is either disabled, not present, or of zero size. ";
355 } 356 }
356 357
357 result = max_state (result, check_swap (percent_used, free_swap_mb)); 358 result = max_state (result, check_swap (percent_used, free_swap_mb));