This is a multi-part message in MIME format.
------=_NextPart_000_0177_01C9CB2C.C2DCF570
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Hi,
i have a servicedefinition which looks like that:
define service {
service_description os_linux_fs_check_ping
host_name nagsrv
use os_linux_default,pnp-preview-popup
check_command \
check_nrpe_arg!30!\
check_fs_ping!/mnt/account-p,/mnt/prepro-p,/mnt/webapp-ssl,/mnt/rollout-p
}
Now i found out that the leading blanks (the same applies for tabs) are
retained also in the macro $SERVICECHECKCOMMAND$. I write the checkresults
to a spoolfile with
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$....
\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\t....
where it comes out as:
....SERVICECHECKCOMMAND::check_nrpe_arg!30! check_fs_ping....
If you postprocess these data, some tools might be confused by the white
space. (PNP for example, but it has a workaround for this in the upcoming
release)
I attached a patch for base/utils.c(mmap_fgets_multiline) (v3.10) which cuts
off leading white space from continuation lines. Whoever feels responsible
for the Nagios code, he might have a look at it. And maybe give a feedback?
Possibly by the end of this decade? Huhu, anybody at home?
Gerhard
------=_NextPart_000_0177_01C9CB2C.C2DCF570
Content-Type: application/octet-stream;
name="nagios-3.1.0.stripspacefromcont.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="nagios-3.1.0.stripspacefromcont.patch"
diff -Naur nagios-3.1.0/base/utils.c =
nagios-3.1.0.stripspacefromcont/base/utils.c=0A=
--- nagios-3.1.0/base/utils.c 2009-01-25 15:42:34.000000000 +0100=0A=
+++ nagios-3.1.0.stripspacefromcont/base/utils.c 2009-05-02 =
12:56:50.000000000 +0200=0A=
@@ -3498,6 +3498,7 @@=0A=
char *mmap_fgets_multiline(mmapfile *temp_mmapfile){=0A=
char *buf=3DNULL;=0A=
char *tempbuf=3DNULL;=0A=
+ char *tmptempbuf=3DNULL;=0A=
int len=3D0;=0A=
int len2=3D0;=0A=
int end=3D0;=0A=
@@ -3520,6 +3521,13 @@=0A=
buf[len]=3D'\x0';=0A=
}=0A=
else{=0A=
+ /* strip leading white space from continuation lines */=0A=
+ tmptempbuf=3DNULL;=0A=
+ if(*tempbuf=3D=3D' ' || *tempbuf=3D=3D'\t'){=0A=
+ tmptempbuf=3Dtempbuf;=0A=
+ while(*tempbuf=3D=3D' ' || *tempbuf=3D=3D'\t')=0A=
+ *tempbuf++;=0A=
+ }=0A=
len=3Dstrlen(tempbuf);=0A=
len2=3Dstrlen(buf);=0A=
if((buf=3D(char *)realloc(buf,len+len2+1))=3D=3DNULL)=0A=
@@ -3527,6 +3535,9 @@=0A=
strcat(buf,tempbuf);=0A=
len+=3Dlen2;=0A=
buf[len]=3D'\x0';=0A=
+ if(tmptempbuf!=3DNULL){=0A=
+ tempbuf=3Dtmptempbuf;=0A=
+ }=0A=
}=0A=
=0A=
if(len=3D=3D0)=0A=
------=_NextPart_000_0177_01C9CB2C.C2DCF570--
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]