--ZgsfP6ejcHXtpYqZ
Content-Type: multipart/mixed; boundary="tR2cvQ13k2aMxNOa"
Content-Disposition: inline
--tR2cvQ13k2aMxNOa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
The attached patch against today's 2.0 CVS snapshot creates a
new macro named "SERVICECHECKCOMMAND". The purposes of this
macro is to make the command name used to check a given service
available as a macro. My purposes for implementing this was to
allow performance data processing scripts to make decisions on
how to parse the perf data of a given plugin from something
other than the Service Description, which is considered to be
freeform human readable as opposed to 'categorical'. There will
be a lot less variation in the check_command than in the service
description.
The expected output is to supply the first potion of the check
command, ie if the command is "check_ftp!foo!bar" the result
would be "check_ftp".
Thanks,
-Jason Martin
--=20
This message is PGP/MIME signed.
--tR2cvQ13k2aMxNOa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="newsvcmacro.patch"
Content-Transfer-Encoding: quoted-printable
diff -U 3 -urN nagios-cvs/base/utils.c nagios-cvs2/base/utils.c
--- nagios-cvs/base/utils.c Mon Apr 5 20:14:39 2004
+++ nagios-cvs2/base/utils.c Mon Aug 9 13:48:34 2004
@@ -514,6 +514,9 @@
else if(!strcmp(temp_buffer,"SERVICEDOWNTIME"))
selected_macro=3Dmacro_x[MACRO_SERVICEDOWNTIME];
=20
+ else if(!strcmp(temp_buffer,"SERVICECHECKCOMMAND"))
+ selected_macro=3Dmacro_x[MACRO_SERVICECHECKCOMMAND];
+
/* on-demand service macros */
else if(strstr(temp_buffer,"SERVICE") && strstr(temp_buffer,":")){
grab_on_demand_macro(temp_buffer);
@@ -654,6 +657,11 @@
free(macro_x[MACRO_SERVICEDESC]);
macro_x[MACRO_SERVICEDESC]=3Dstrdup(svc->description);
=20
+ /* get the service description */
+ if(macro_x[MACRO_SERVICECHECKCOMMAND]!=3DNULL)
+ free(macro_x[MACRO_SERVICECHECKCOMMAND]);
+ macro_x[MACRO_SERVICECHECKCOMMAND]=3Dstrdup(svc->service_check_com=
mand);
+
/* get the plugin output */
if(macro_x[MACRO_SERVICEOUTPUT]!=3DNULL)
free(macro_x[MACRO_SERVICEOUTPUT]);
@@ -851,6 +859,7 @@
=20
strip(macro_x[MACRO_SERVICEOUTPUT]);
strip(macro_x[MACRO_SERVICEPERFDATA]);
+ strip(macro_x[MACRO_SERVICECHECKCOMMAND]);
=20
#ifdef DEBUG0
printf("grab_service_macros() end\n");
diff -U 3 -urN nagios-cvs/include/nagios.h.in nagios-cvs2/include/nagios.h.=
in
--- nagios-cvs/include/nagios.h.in Thu Mar 11 20:52:06 2004
+++ nagios-cvs2/include/nagios.h.in Mon Aug 9 13:47:51 2004
@@ -49,7 +49,7 @@
#define MAX_STATEID_LENGTH 2
#define MAX_PERCENTCHANGE_LENGTH 8
=20
-#define MACRO_X_COUNT 60 /* size of macro_x[] array */
+#define MACRO_X_COUNT 61 /* size of macro_x[] array */
=20
#define MACRO_HOSTNAME 0
#define MACRO_HOSTALIAS 1
@@ -111,6 +111,7 @@
#define MACRO_LASTHOSTUP 57
#define MACRO_LASTHOSTDOWN 58
#define MACRO_LASTHOSTUNREACHABLE 59
+#define MACRO_SERVICECHECKCOMMAND 60
=20
=20
=20
--tR2cvQ13k2aMxNOa--
--ZgsfP6ejcHXtpYqZ
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: --no-verbose
iD8DBQFBF+TOl2ODWuqVSBMRAjVSAJ4ygzfWE83kAziVXP+6D1WVAhubNgCfQ6R7
NmqNeV8utakZPBcKqYxKLBg=
=cKFi
-----END PGP SIGNATURE-----
--ZgsfP6ejcHXtpYqZ--
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]