summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins-root/check_icmp.c5
-rw-r--r--plugins/check_apt.c80
-rw-r--r--plugins/check_procs.c102
3 files changed, 91 insertions, 96 deletions
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c
index 2f03552..728d4a0 100644
--- a/plugins-root/check_icmp.c
+++ b/plugins-root/check_icmp.c
@@ -35,6 +35,11 @@
35#include <arpa/inet.h> 35#include <arpa/inet.h>
36#include <signal.h> 36#include <signal.h>
37 37
38#include "common.h"
39#include "runcmd.h"
40#include "utils.h"
41#include "regex.h"
42
38/** sometimes undefined system macros (quite a few, actually) **/ 43/** sometimes undefined system macros (quite a few, actually) **/
39#ifndef MAXTTL 44#ifndef MAXTTL
40# define MAXTTL 255 45# define MAXTTL 255
diff --git a/plugins/check_apt.c b/plugins/check_apt.c
index 2de8e77..902b455 100644
--- a/plugins/check_apt.c
+++ b/plugins/check_apt.c
@@ -30,9 +30,9 @@
30* You should have received a copy of the GNU General Public License 30* You should have received a copy of the GNU General Public License
31* along with this program; if not, write to the Free Software 31* along with this program; if not, write to the Free Software
32* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 32* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
33 33*
34 $Id$ 34* $Id$
35 35*
36******************************************************************************/ 36******************************************************************************/
37 37
38const char *progname = "check_apt"; 38const char *progname = "check_apt";
@@ -115,7 +115,7 @@ int main (int argc, char **argv) {
115 result = max_state(result, STATE_OK); 115 result = max_state(result, STATE_OK);
116 } 116 }
117 117
118 printf("APT %s: %d packages available for %s (%d critical updates). %s%s%s%s\n", 118 printf(_("APT %s: %d packages available for %s (%d critical updates). %s%s%s%s\n"),
119 state_text(result), 119 state_text(result),
120 packages_available, 120 packages_available,
121 (upgrade==DIST_UPGRADE)?"dist-upgrade":"upgrade", 121 (upgrade==DIST_UPGRADE)?"dist-upgrade":"upgrade",
@@ -228,21 +228,21 @@ int run_upgrade(int *pkgcount, int *secpkgcount){
228 regres=regcomp(&ireg, include_ptr, REG_EXTENDED); 228 regres=regcomp(&ireg, include_ptr, REG_EXTENDED);
229 if(regres!=0) { 229 if(regres!=0) {
230 regerror(regres, &ireg, rerrbuf, 64); 230 regerror(regres, &ireg, rerrbuf, 64);
231 die(STATE_UNKNOWN, "%s: Error compiling regexp: %s", progname, rerrbuf); 231 die(STATE_UNKNOWN, _("%s: Error compiling regexp: %s"), progname, rerrbuf);
232 } 232 }
233 233
234 if(do_exclude!=NULL){ 234 if(do_exclude!=NULL){
235 regres=regcomp(&ereg, do_exclude, REG_EXTENDED); 235 regres=regcomp(&ereg, do_exclude, REG_EXTENDED);
236 if(regres!=0) { 236 if(regres!=0) {
237 regerror(regres, &ereg, rerrbuf, 64); 237 regerror(regres, &ereg, rerrbuf, 64);
238 die(STATE_UNKNOWN, "%s: Error compiling regexp: %s", 238 die(STATE_UNKNOWN, _("%s: Error compiling regexp: %s"),
239 progname, rerrbuf); 239 progname, rerrbuf);
240 } 240 }
241 } 241 }
242 regres=regcomp(&sreg, crit_ptr, REG_EXTENDED); 242 regres=regcomp(&sreg, crit_ptr, REG_EXTENDED);
243 if(regres!=0) { 243 if(regres!=0) {
244 regerror(regres, &ereg, rerrbuf, 64); 244 regerror(regres, &ereg, rerrbuf, 64);
245 die(STATE_UNKNOWN, "%s: Error compiling regexp: %s", 245 die(STATE_UNKNOWN, _("%s: Error compiling regexp: %s"),
246 progname, rerrbuf); 246 progname, rerrbuf);
247 } 247 }
248 248
@@ -255,7 +255,7 @@ int run_upgrade(int *pkgcount, int *secpkgcount){
255 if(result != 0){ 255 if(result != 0){
256 exec_warning=1; 256 exec_warning=1;
257 result = STATE_UNKNOWN; 257 result = STATE_UNKNOWN;
258 fprintf(stderr, "'%s' exited with non-zero status.\n", 258 fprintf(stderr, _("'%s' exited with non-zero status.\n"),
259 cmdline); 259 cmdline);
260 } 260 }
261 261
@@ -324,7 +324,7 @@ int run_update(void){
324 if(result != 0){ 324 if(result != 0){
325 exec_warning=1; 325 exec_warning=1;
326 result = STATE_CRITICAL; 326 result = STATE_CRITICAL;
327 fprintf(stderr, "'%s' exited with non-zero status.\n", 327 fprintf(stderr, _("'%s' exited with non-zero status.\n"),
328 cmdline); 328 cmdline);
329 } 329 }
330 330
@@ -419,38 +419,36 @@ print_help (void)
419 419
420 printf(_(UT_TIMEOUT), timeout_interval); 420 printf(_(UT_TIMEOUT), timeout_interval);
421 421
422 printf(_("\n\ 422 printf (" %s\n", "-U, --upgrade=OPTS");
423 -U, --upgrade=OPTS\n\ 423 printf (" %s\n", _("[Default] Perform an upgrade. If an optional OPTS argument is provided,"));
424 [Default] Perform an upgrade. If an optional OPTS argument is provided,\n\ 424 printf (" %s\n", _("apt-get will be run with these command line options instead of the"));
425 apt-get will be run with these command line options instead of the\n\ 425 printf (" %s", _("default "));
426 default (%s).\n\ 426 printf ("(%s).\n", UPGRADE_DEFAULT_OPTS);
427 Note that you may be required to have root privileges if you do not use\n\ 427 printf (" %s\n", _("Note that you may be required to have root privileges if you do not use"));
428 the default options.\n\ 428 printf (" %s\n", _("the default options."));
429 -d, --dist-upgrade=OPTS\n\ 429 printf (" %s\n", "-d, --dist-upgrade=OPTS");
430 Perform a dist-upgrade instead of normal upgrade. Like with -U OPTS\n\ 430 printf (" %s\n", _("Perform a dist-upgrade instead of normal upgrade. Like with -U OPTS"));
431 can be provided to override the default options.\n\ 431 printf (" %s\n", _("can be provided to override the default options."));
432 -n, --no-upgrade\n\ 432 printf (" %s\n", " -n, --no-upgrade");
433 Do not run the upgrade. Probably not useful (without -u at least).\n\ 433 printf (" %s\n", _("Do not run the upgrade. Probably not useful (without -u at least)."));
434 -i, --include=REGEXP\n\ 434 printf (" %s\n", "-i, --include=REGEXP");
435 Include only packages matching REGEXP. Can be specified multiple times;\n\ 435 printf (" %s\n", _("Include only packages matching REGEXP. Can be specified multiple times"));
436 the values will be combined together. Any patches matching this list\n\ 436 printf (" %s\n", _("the values will be combined together. Any patches matching this list"));
437 cause the plugin to return WARNING status. Others will be ignored.\n\ 437 printf (" %s\n", _("cause the plugin to return WARNING status. Others will be ignored."));
438 Default is to include all packages.\n\ 438 printf (" %s\n", _("Default is to include all packages."));
439 -e, --exclude=REGEXP\n\ 439 printf (" %s\n", "-e, --exclude=REGEXP");
440 Exclude packages matching REGEXP from the list of packages that would\n\ 440 printf (" %s\n", _("Exclude packages matching REGEXP from the list of packages that would"));
441 otherwise be included. Can be specified multiple times; the values\n\ 441 printf (" %s\n", _("otherwise be included. Can be specified multiple times; the values"));
442 will be combined together. Default is to exclude no packages.\n\ 442 printf (" %s\n", _("will be combined together. Default is to exclude no packages."));
443 -c, --critical=REGEXP\n\ 443 printf (" %s\n", "-c, --critical=REGEXP");
444 If the full package information of any of the upgradable packages match\n\ 444 printf (" %s\n", _("If the full package information of any of the upgradable packages match"));
445 this REGEXP, the plugin will return CRITICAL status. Can be specified\n\ 445 printf (" %s\n", _("this REGEXP, the plugin will return CRITICAL status. Can be specified"));
446 multiple times like above. Default is a regexp matching security\n\ 446 printf (" %s\n", _("multiple times like above. Default is a regexp matching security"));
447 upgrades for Debian and Ubuntu:\n\ 447 printf (" %s\n", _("upgrades for Debian and Ubuntu:"));
448 \t%s\n\ 448 printf (" \t\%s\n", SECURITY_RE);
449 Note that the package must first match the include list before its\n\ 449 printf (" %s\n", _("Note that the package must first match the include list before its"));
450 information is compared against the critical list.\n\ 450 printf (" %s\n\n\n", _("information is compared against the critical list."));
451 \n\n"), 451
452 UPGRADE_DEFAULT_OPTS, SECURITY_RE);
453
454 printf ("%s\n\n", _("The following options require root privileges and should be used with care:")); 452 printf ("%s\n\n", _("The following options require root privileges and should be used with care:"));
455 printf (" %s\n", "-u, --update=OPTS"); 453 printf (" %s\n", "-u, --update=OPTS");
456 printf (" %s\n", _("First perform an 'apt-get update'. An optional OPTS parameter overrides")); 454 printf (" %s\n", _("First perform an 'apt-get update'. An optional OPTS parameter overrides"));
diff --git a/plugins/check_procs.c b/plugins/check_procs.c
index 31a2bed..2c8c379 100644
--- a/plugins/check_procs.c
+++ b/plugins/check_procs.c
@@ -677,54 +677,47 @@ print_help (void)
677 677
678 print_usage (); 678 print_usage ();
679 679
680 printf(_("\n\ 680 printf ("%s\n", _("Required Arguments:"));
681Required Arguments:\n\ 681 printf (" %s\n", "-w, --warning=RANGE");
682 -w, --warning=RANGE\n\ 682 printf (" %s\n", _("Generate warning state if metric is outside this range"));
683 Generate warning state if metric is outside this range\n\ 683 printf (" %s\n", "-c, --critical=RANGE");
684 -c, --critical=RANGE\n\ 684 printf (" %s\n", _("Generate critical state if metric is outside this range"));
685 Generate critical state if metric is outside this range\n")); 685
686 686 printf ("%s\n", _("Optional Arguments:"));
687 printf(_("\n\ 687 printf (" %s\n", "-m, --metric=TYPE");
688Optional Arguments:\n\ 688 printf (" %s\n", _("Check thresholds against metric. Valid types:"));
689 -m, --metric=TYPE\n\ 689 printf (" %s\n", _("PROCS - number of processes (default)"));
690 Check thresholds against metric. Valid types:\n\ 690 printf (" %s\n", _("VSZ - virtual memory size"));
691 PROCS - number of processes (default)\n\ 691 printf (" %s\n", _("RSS - resident set memory size"));
692 VSZ - virtual memory size\n\ 692 printf (" %s\n", _("CPU - percentage cpu"));
693 RSS - resident set memory size\n\
694 CPU - percentage cpu\n"));
695/* only linux etime is support currently */ 693/* only linux etime is support currently */
696#if defined( __linux__ ) 694#if defined( __linux__ )
697 printf(_("\ 695 printf (" %s\n", _("ELAPSED - time elapsed in seconds"));
698 ELAPSED - time elapsed in seconds\n"));
699#endif /* defined(__linux__) */ 696#endif /* defined(__linux__) */
700 printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); 697 printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
701 698
702 printf(_("\ 699 printf (" %s\n", "-v, --verbose");
703 -v, --verbose\n\ 700 printf (" %s\n", _("Extra information. Up to 3 verbosity levels"));
704 Extra information. Up to 3 verbosity levels\n")); 701
705 702 printf ("%s\n", "Optional Filters:");
706 printf(_("\n\ 703 printf (" %s\n", "-s, --state=STATUSFLAGS");
707Optional Filters:\n\ 704 printf (" %s\n", _("Only scan for processes that have, in the output of `ps`, one or"));
708 -s, --state=STATUSFLAGS\n\ 705 printf (" %s\n", _("more of the status flags you specify (for example R, Z, S, RS,"));
709 Only scan for processes that have, in the output of `ps`, one or\n\ 706 printf (" %s\n", _("RSZDT, plus others based on the output of your 'ps' command)."));
710 more of the status flags you specify (for example R, Z, S, RS,\n\ 707 printf (" %s\n", "-p, --ppid=PPID");
711 RSZDT, plus others based on the output of your 'ps' command).\n\ 708 printf (" %s\n", _("Only scan for children of the parent process ID indicated."));
712 -p, --ppid=PPID\n\ 709 printf (" %s\n", "-z, --vsz=VSZ");
713 Only scan for children of the parent process ID indicated.\n\ 710 printf (" %s\n", _("Only scan for processes with vsz higher than indicated."));
714 -z, --vsz=VSZ\n\ 711 printf (" %s\n", "-r, --rss=RSS");
715 Only scan for processes with vsz higher than indicated.\n\ 712 printf (" %s\n", _("Only scan for processes with rss higher than indicated."));
716 -r, --rss=RSS\n\ 713 printf (" %s\n", "-P, --pcpu=PCPU");
717 Only scan for processes with rss higher than indicated.\n")); 714 printf (" %s\n", _("Only scan for processes with pcpu higher than indicated."));
718 715 printf (" %s\n", "-u, --user=USER");
719 printf(_("\ 716 printf (" %s\n", _("Only scan for processes with user name or ID indicated."));
720 -P, --pcpu=PCPU\n\ 717 printf (" %s\n", "-a, --argument-array=STRING");
721 Only scan for processes with pcpu higher than indicated.\n\ 718 printf (" %s\n", _("Only scan for processes with args that contain STRING."));
722 -u, --user=USER\n\ 719 printf (" %s\n", "-C, --command=COMMAND");
723 Only scan for processes with user name or ID indicated.\n\ 720 printf (" %s\n", _("Only scan for exact matches of COMMAND (without path)."));
724 -a, --argument-array=STRING\n\
725 Only scan for processes with args that contain STRING.\n\
726 -C, --command=COMMAND\n\
727 Only scan for exact matches of COMMAND (without path).\n"));
728 721
729 printf(_("\n\ 722 printf(_("\n\
730RANGEs are specified 'min:max' or 'min:' or ':max' (or 'max'). If\n\ 723RANGEs are specified 'min:max' or 'min:' or ':max' (or 'max'). If\n\
@@ -738,18 +731,17 @@ the specified threshold ranges. The process count can be filtered by\n\
738process owner, parent process PID, current state (e.g., 'Z'), or may\n\ 731process owner, parent process PID, current state (e.g., 'Z'), or may\n\
739be the total number of running processes\n\n")); 732be the total number of running processes\n\n"));
740 733
741 printf(_("\ 734 printf ("%s\n", _("Examples:"));
742Examples:\n\ 735 printf (" %s\n", "check_procs -w 2:2 -c 2:1024 -C portsentry");
743 check_procs -w 2:2 -c 2:1024 -C portsentry\n\ 736 printf (" %s\n", _("Warning if not two processes with command name portsentry."));
744 Warning if not two processes with command name portsentry. Critical\n\ 737 printf (" %s\n\n", _("Critical if < 2 or > 1024 processes"));
745 if < 2 or > 1024 processes\n\n\ 738 printf (" %s\n", "check_procs -w 10 -a '/usr/local/bin/perl' -u root");
746 check_procs -w 10 -a '/usr/local/bin/perl' -u root\n\ 739 printf (" %s\n", _("Warning alert if > 10 processes with command arguments containing"));
747 Warning alert if > 10 processes with command arguments containing \n\ 740 printf (" %s\n\n", _("'/usr/local/bin/perl' and owned by root"));
748 '/usr/local/bin/perl' and owned by root\n\n\ 741 printf (" %s\n", "check_procs -w 50000 -c 100000 --metric=VSZ");
749 check_procs -w 50000 -c 100000 --metric=VSZ\n\ 742 printf (" %s\n\n", _("Alert if vsz of any processes over 50K or 100K"));
750 Alert if vsz of any processes over 50K or 100K\n\ 743 printf (" %s\n", "check_procs -w 10 -c 20 --metric=CPU");
751 check_procs -w 10 -c 20 --metric=CPU\n\ 744 printf (" %s\n\n", _("Alert if cpu of any processes over 10%% or 20%%"));
752 Alert if cpu of any processes over 10%% or 20%%\n\n"));
753 745
754 printf (_(UT_SUPPORT)); 746 printf (_(UT_SUPPORT));
755} 747}