Re: Testing the upcoming release
Jochen Bern <Jochen.Bern-RMkW/[email protected]>
| Newsgroups | gmane.network.nagios.plugins.devel |
|---|---|
| Organization | LINworks GmbH |
| Message-ID | <[email protected]> |
On 06/25/2012 08:39 AM, Holger Weiß wrote: > We'd like to cut the 1.4.16 release this week. If you could spare a bit > of time to test the current snapshot and report any regressions from the > 1.4.15 release, that would be awesome: > http://nagiosplug.sourceforge.net/snapshot/nagios-plugins-master.tar.gz Would you be willing to include a quick fix to improve spec- as well as backwards compatibility of check_snmp? 1.4.14: > $ nagios-plugins-1.4.14/plugins/check_snmp $TARGET $QUERY -l 'Battery Left,Uptime' > Battery Left WARNING - *222000* 185115360 | iso.3.6.1.4.1.318.1.1.1.2.2.3.0=222000 iso.3.6.1.2.1.1.3.0=185115360 1.4.15: > $ nagios-plugins-1.4.15/plugins/check_snmp $TARGET $QUERY -l 'Battery Left,Uptime' > SNMP OK - Uptime Timeticks: (222000) 0:37:00.00 Timeticks: (185116320) 21 days, 10:12:43.20 | Your version (note syntax err in perfdata): > $ nagios-plugins-1.4.15-74-gcf07/plugins/check_snmp $TARGET $QUERY -l 'Battery Left,Uptime' > SNMP WARNING - Battery Left *222000* Uptime 185117890 | Battery Left=222000 Uptime=185117890 Patch: > $ nagios-plugins-1.4.15-74oneQuarter/plugins/check_snmp $TARGET $QUERY -l 'Battery Left,Uptime' > SNMP WARNING - Battery Left *222000* Uptime 185121060 | 'Battery Left'=222000 Uptime=185121060 > $ nagios-plugins-1.4.15-74oneQuarter/plugins/check_snmp $TARGET $QUERY -l 'Battery Left,Uptime' --perf-oids > SNMP WARNING - Battery Left *222000* Uptime 185121850 | iso.3.6.1.4.1.318.1.1.1.2.2.3.0=222000 iso.3.6.1.2.1.1.3.0=185121850 Kind regards, J. Bern -- Jochen Bern, Systemingenieur --- LINworks GmbH <http://www.LINworks.de/> Postfach 100121, 64201 Darmstadt | Robert-Koch-Str. 9, 64331 Weiterstadt PGP (1024D/4096g) FP = D18B 41B1 16C0 11BA 7F8C DCF7 E1D5 FAF4 444E 1C27 Tel. +49 6151 9067-231, Zentr. -0, Fax -299 - Amtsg. Darmstadt HRB 85202 Unternehmenssitz Weiterstadt, Geschäftsführer Metin Dogan, Oliver Michel ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________________ Nagios Plugin Development Mailing List Nagiosplug-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Unsubscribe at https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel ::: Please include plugins version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null
nagios-plugins-1.4.15-SnmpPerfdata-patch.txt
(text/plain, 2.2 KB)
--- nagios-plugins-1.4.15-74-gcf07/plugins/check_snmp.c 2012-06-25 19:00:02.000000000 +0200
+++ nagios-plugins-1.4.15-74oneQuarter/plugins/check_snmp.c 2012-06-26 18:52:38.000000000 +0200
@@ -141,6 +141,7 @@
int rate_multiplier = 1;
state_data *previous_state;
double previous_value[MAX_OIDS];
+int perf_labels = 1;
int
@@ -485,11 +486,18 @@
ptr = NULL;
strtod(show, &ptr);
if (ptr > show) {
- if (nlabels >= (size_t)1 && (size_t)i < nlabels && labels[i] != NULL)
+ if (perf_labels && nlabels >= (size_t)1 && (size_t)i < nlabels && labels[i] != NULL)
temp_string=labels[i];
else
temp_string=oidname;
- strncat(perfstr, temp_string, sizeof(perfstr)-strlen(perfstr)-1);
+ if (strpbrk (temp_string, " ='") == NULL) {
+ strncat(perfstr, temp_string, sizeof(perfstr)-strlen(perfstr)-1);
+ } else {
+ strncat(perfstr, "'", sizeof(perfstr)-strlen(perfstr)-1);
+ /* FIXME: Char stuffing "foo'bar" --> "'foo''bar'" still missing */
+ strncat(perfstr, temp_string, sizeof(perfstr)-strlen(perfstr)-1);
+ strncat(perfstr, "'", sizeof(perfstr)-strlen(perfstr)-1);
+ }
strncat(perfstr, "=", sizeof(perfstr)-strlen(perfstr)-1);
len = sizeof(perfstr)-strlen(perfstr)-1;
strncat(perfstr, show, len>ptr-show ? ptr-show : len);
@@ -583,6 +591,7 @@
{"rate", no_argument, 0, L_CALCULATE_RATE},
{"rate-multiplier", required_argument, 0, L_RATE_MULTIPLIER},
{"invert-search", no_argument, 0, L_INVERT_SEARCH},
+ {"perf-oids", no_argument, 0, 'O'},
{0, 0, 0, 0}
};
@@ -600,7 +609,7 @@
}
while (1) {
- c = getopt_long (argc, argv, "nhvVt:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:L:U:a:x:A:X:",
+ 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:",
longopts, &option);
if (c == -1 || c == EOF)
@@ -798,6 +807,9 @@
case L_INVERT_SEARCH:
invert_search=1;
break;
+ case 'O':
+ perf_labels=0;
+ break;
}
}
@@ -1063,6 +1075,9 @@
printf (" %s\n", "-e, --retries=INTEGER");
printf (" %s\n", _("Number of retries to be used in the requests"));
+ printf (" %s\n", "-O, --perf-oids");
+ printf (" %s\n", _("Label performance data with OIDs instead of --label's"));
+
printf (UT_VERBOSE);
printf ("\n");