diff options
Diffstat (limited to 'web/attachments/95707-nagios.patch')
-rw-r--r-- | web/attachments/95707-nagios.patch | 203 |
1 files changed, 203 insertions, 0 deletions
diff --git a/web/attachments/95707-nagios.patch b/web/attachments/95707-nagios.patch new file mode 100644 index 0000000..445b6e4 --- /dev/null +++ b/web/attachments/95707-nagios.patch | |||
@@ -0,0 +1,203 @@ | |||
1 | Only in nagios-plugins-1.4.0alpha1-rm: autom4te-2.53.cache | ||
2 | Only in nagios-plugins-1.4.0alpha1-rm: autom4te.cache | ||
3 | diff -r -u nagios-plugins-1.4.0alpha1/configure nagios-plugins-1.4.0alpha1-rm/configure | ||
4 | --- nagios-plugins-1.4.0alpha1/configure 2003-11-30 18:55:45.000000000 -0800 | ||
5 | +++ nagios-plugins-1.4.0alpha1-rm/configure 2004-07-14 21:40:45.000000000 -0700 | ||
6 | @@ -15537,13 +15537,13 @@ | ||
7 | echo "$as_me:$LINENO: result: $ac_cv_ps_command" >&5 | ||
8 | echo "${ECHO_T}$ac_cv_ps_command" >&6 | ||
9 | |||
10 | -elif ps -weo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \ | ||
11 | - egrep -i "^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+" >/dev/null | ||
12 | +elif ps -weo 'stat comm vsz rss user uid ppid etime args' 2>/dev/null | \ | ||
13 | + egrep -i "^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+" >/dev/null | ||
14 | then | ||
15 | - ac_cv_ps_varlist="procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos" | ||
16 | - ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid ppid vsz rss pcpu comm args'" | ||
17 | - ac_cv_ps_format="%s %d %d %d %d %f %s %n" | ||
18 | - ac_cv_ps_cols=8 | ||
19 | + ac_cv_ps_varlist="procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos" | ||
20 | + ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid ppid vsz rss pcpu etime comm args'" | ||
21 | + ac_cv_ps_format="%s %d %d %d %d %f %s %s %n" | ||
22 | + ac_cv_ps_cols=9 | ||
23 | echo "$as_me:$LINENO: result: $ac_cv_ps_command" >&5 | ||
24 | echo "${ECHO_T}$ac_cv_ps_command" >&6 | ||
25 | |||
26 | diff -r -u nagios-plugins-1.4.0alpha1/configure.in nagios-plugins-1.4.0alpha1-rm/configure.in | ||
27 | --- nagios-plugins-1.4.0alpha1/configure.in 2003-11-30 18:55:32.000000000 -0800 | ||
28 | +++ nagios-plugins-1.4.0alpha1-rm/configure.in 2004-07-14 06:23:16.000000000 -0700 | ||
29 | @@ -644,13 +644,13 @@ | ||
30 | AC_MSG_RESULT([$ac_cv_ps_command]) | ||
31 | |||
32 | dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND | ||
33 | -elif ps -weo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \ | ||
34 | - egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null | ||
35 | +elif ps -weo 'stat comm vsz rss user uid ppid etime args' 2>/dev/null | \ | ||
36 | + egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null | ||
37 | then | ||
38 | - ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]" | ||
39 | - ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid ppid vsz rss pcpu comm args'" | ||
40 | - ac_cv_ps_format="%s %d %d %d %d %f %s %n" | ||
41 | - ac_cv_ps_cols=8 | ||
42 | + ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]" | ||
43 | + ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid ppid vsz rss pcpu etime comm args'" | ||
44 | + ac_cv_ps_format="%s %d %d %d %d %f %s %s %n" | ||
45 | + ac_cv_ps_cols=9 | ||
46 | AC_MSG_RESULT([$ac_cv_ps_command]) | ||
47 | |||
48 | dnl FreeBSD | ||
49 | Only in nagios-plugins-1.4.0alpha1/pkg/solaris: pkginfo | ||
50 | diff -r -u nagios-plugins-1.4.0alpha1/plugins/check_nagios.c nagios-plugins-1.4.0alpha1-rm/plugins/check_nagios.c | ||
51 | --- nagios-plugins-1.4.0alpha1/plugins/check_nagios.c 2003-08-21 23:22:38.000000000 -0700 | ||
52 | +++ nagios-plugins-1.4.0alpha1-rm/plugins/check_nagios.c 2004-07-14 06:27:19.000000000 -0700 | ||
53 | @@ -52,6 +52,7 @@ | ||
54 | int procrss = 0; | ||
55 | float procpcpu = 0; | ||
56 | char procstat[8]; | ||
57 | + char procetime[MAX_INPUT_BUFFER]; | ||
58 | char procprog[MAX_INPUT_BUFFER]; | ||
59 | char *procargs; | ||
60 | int pos, cols; | ||
61 | diff -r -u nagios-plugins-1.4.0alpha1/plugins/check_procs.c nagios-plugins-1.4.0alpha1-rm/plugins/check_procs.c | ||
62 | --- nagios-plugins-1.4.0alpha1/plugins/check_procs.c 2003-11-30 18:46:01.000000000 -0800 | ||
63 | +++ nagios-plugins-1.4.0alpha1-rm/plugins/check_procs.c 2004-07-14 21:36:09.000000000 -0700 | ||
64 | @@ -47,14 +47,15 @@ | ||
65 | #define VSZ 64 | ||
66 | #define RSS 128 | ||
67 | #define PCPU 256 | ||
68 | - | ||
69 | +#define ELAPSED 512 | ||
70 | /* Different metrics */ | ||
71 | char *metric_name; | ||
72 | enum metric { | ||
73 | METRIC_PROCS, | ||
74 | METRIC_VSZ, | ||
75 | METRIC_RSS, | ||
76 | - METRIC_CPU | ||
77 | + METRIC_CPU, | ||
78 | + METRIC_ELAPSED | ||
79 | }; | ||
80 | enum metric metric = METRIC_PROCS; | ||
81 | |||
82 | @@ -85,8 +86,10 @@ | ||
83 | int procppid = 0; | ||
84 | int procvsz = 0; | ||
85 | int procrss = 0; | ||
86 | + int procseconds = 0; | ||
87 | float procpcpu = 0; | ||
88 | char procstat[8]; | ||
89 | + char procetime[MAX_INPUT_BUFFER]; | ||
90 | char procprog[MAX_INPUT_BUFFER]; | ||
91 | char *procargs; | ||
92 | char *temp_string; | ||
93 | @@ -156,10 +159,14 @@ | ||
94 | temp_string = strtok (NULL, "/"); | ||
95 | } | ||
96 | |||
97 | + /* we need to convert the elapsed time to seconds */ | ||
98 | + procseconds = convert_to_seconds(procetime); | ||
99 | + | ||
100 | if (verbose >= 3) | ||
101 | - printf ("%d %d %d %d %d %.2f %s %s %s\n", | ||
102 | + printf ("%d %d %d %d %d %.2f %s %s %s %s\n", | ||
103 | procs, procuid, procvsz, procrss, | ||
104 | - procppid, procpcpu, procstat, procprog, procargs); | ||
105 | + procppid, procpcpu, procstat, | ||
106 | + procetime, procprog, procargs); | ||
107 | |||
108 | /* Ignore self */ | ||
109 | if (strcmp (procprog, progname) == 0) { | ||
110 | @@ -198,6 +205,8 @@ | ||
111 | /* TODO? float thresholds for --metric=CPU */ | ||
112 | else if (metric == METRIC_CPU) | ||
113 | i = check_thresholds ((int)procpcpu); | ||
114 | + else if (metric == METRIC_ELAPSED) | ||
115 | + i = check_thresholds (procseconds); | ||
116 | |||
117 | if (metric != METRIC_PROCS) { | ||
118 | if (i == STATE_WARNING) { | ||
119 | @@ -297,6 +306,7 @@ | ||
120 | {"vsz", required_argument, 0, 'z'}, | ||
121 | {"rss", required_argument, 0, 'r'}, | ||
122 | {"pcpu", required_argument, 0, 'P'}, | ||
123 | + {"elapsed", required_argument, 0, 'e'}, | ||
124 | {"argument-array", required_argument, 0, 'a'}, | ||
125 | {"help", no_argument, 0, 'h'}, | ||
126 | {"version", no_argument, 0, 'V'}, | ||
127 | @@ -448,7 +458,12 @@ | ||
128 | metric = METRIC_CPU; | ||
129 | break; | ||
130 | } | ||
131 | - printf (_("%s: metric must be one of PROCS, VSZ, RSS, CPU!\n\n"), | ||
132 | + else if ( strcmp(optarg, "ELAPSED") == 0) { | ||
133 | + metric = METRIC_ELAPSED; | ||
134 | + break; | ||
135 | + } | ||
136 | + | ||
137 | + printf (_("%s: metric must be one of PROCS, VSZ, RSS, CPU, ELAPSED!\n\n"), | ||
138 | progname); | ||
139 | print_usage (); | ||
140 | exit (STATE_UNKNOWN); | ||
141 | @@ -646,6 +661,62 @@ | ||
142 | printf (_(UT_SUPPORT)); | ||
143 | } | ||
144 | |||
145 | +/* convert the elapsed time to seconds */ | ||
146 | +int convert_to_seconds(char *etime) { | ||
147 | + | ||
148 | + char *ptr; | ||
149 | + int total; | ||
150 | + | ||
151 | + int hyphcnt; | ||
152 | + int coloncnt; | ||
153 | + int days; | ||
154 | + int hours; | ||
155 | + int minutes; | ||
156 | + int seconds; | ||
157 | + | ||
158 | + hyphcnt = 0; | ||
159 | + coloncnt = 0; | ||
160 | + days = 0; | ||
161 | + hours = 0; | ||
162 | + minutes = 0; | ||
163 | + seconds = 0; | ||
164 | + | ||
165 | + for (ptr = etime; *ptr != '\0'; ptr++) { | ||
166 | + | ||
167 | + if (*ptr == '-') { | ||
168 | + hyphcnt++; | ||
169 | + continue; | ||
170 | + } | ||
171 | + if (*ptr == ':') { | ||
172 | + coloncnt++; | ||
173 | + continue; | ||
174 | + } | ||
175 | + } | ||
176 | + | ||
177 | + if (hyphcnt > 0) { | ||
178 | + sscanf(etime, "%d-%d:%d:%d", | ||
179 | + &days, &hours, &minutes, &seconds); | ||
180 | + } else { | ||
181 | + if (coloncnt == 2) { | ||
182 | + sscanf(etime, "%d:%d:%d", | ||
183 | + &hours, &minutes, &seconds); | ||
184 | + } else if (coloncnt == 1) { | ||
185 | + sscanf(etime, "%d:%d", | ||
186 | + &minutes, &seconds); | ||
187 | + } | ||
188 | + } | ||
189 | + | ||
190 | + total = (days * 86400) + | ||
191 | + (hours * 3600) + | ||
192 | + (minutes * 60) + | ||
193 | + seconds; | ||
194 | + | ||
195 | + if (verbose >= 3) { | ||
196 | + printf("seconds: %d\n", total); | ||
197 | + } | ||
198 | + return total; | ||
199 | +} | ||
200 | + | ||
201 | void | ||
202 | print_usage (void) | ||
203 | { | ||