Re: [Nagios-devel] Patch for handling pipes nicely + fix bug in
Posted: Mon Mar 12, 2007 9:00 am
This is a multi-part message in MIME format.
------=_NextPart_000_0025_01C764A6.3521E130
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf
> Of Ethan Galstad
> Sent: March 12, 2007 11:56
> To: Nagios Developers List
> Subject: Re: [Nagios-devel] Patch for handling pipes nicely +
> fix bug in config parsing
>
> Thomas Guyot-Sionnest wrote:
> > Hi Ethan, list,
> >
> > I made a patch to make Nagios handle nicely perfdata_file
> as pipes. What
> > it does is add a new file mode; i.e.:
> >
> > host_perfdata_file_mode=p
> > service_perfdata_file_mode=p
> >
> > When set to "p", it will use open with O_NONBLOCK | O_RDWR,
> then fdopen
> > on the fd, so that the fd will be left with O_NONBLOCK.
> This will allow
> > Nagios to open the pipe without blocking even if there's no
> reader. It
> > will also avoid loosing data if the reader goes away for a
> short period
> > of time (ex. performance data daemon restart)
> >
> > While testing it I also found out there's a bug in the argument
> > processing. strstr returns the pointer to the search string. so that
> > if(!strstr(...)) is like saying if(string not there). The
> original code
> > looked like this:
> >
> > if(!strstr(varvalue,"w"))
> > xpddefault_host_perfdata_file_append=FALSE;
> >
> > So I changed that to explicitly check if the value is not NULL. This
> > explains why with "w" I was seeing O_APPEND from strace
> >
> > If you accept this patch I'll submit a complete patch
> including doc and
> > sample config modifications. I can also backport it to the
> 2-x branch if
> > you're willing to accept it.
> >
> > Thanks,
> >
> > Thomas
> >
>
> Thanks! I'll get this applied to the Nagios 3 CVS code today.
Thanks! I'll work on the doc and config patch during the week. I guess
you'll patch the 2-x branch with at least the strstr fix. Would you like a
"piped perfdata" patch for the 2-x branch as well?
Thomas
------=_NextPart_000_0025_01C764A6.3521E130
Content-Type: application/x-pkcs7-signature;
name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="smime.p7s"
MIAGCSqGSIb3DQEHAqCAMIACAQEx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XJ2aWNlcyBEaXZpc2lvbjEkMCIGA1UEAxMbVGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIENBMSsw
KQYJKoZIhvcNAQkBFhxwZXJzb25hbC1mcmVlbWFpbEB0aGF3dGUuY29tMB4XDTk2MDEwMTAwMDAw
MFoXDTIwMTIzMTIzNTk1OVowgdExCzAJBgNVBAYTAlpBMRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUx
EjAQBgNVBAcTCUNhcGUgVG93bjEaMBgGA1UEChMRVGhhd3RlIENvbnN1bHRpbmcxKDAmBgNVBAsT
H0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2aXNpb24xJDAiBgNVBAMTG1RoYXd0ZSBQZXJzb25h
bCBGcmVlbWFpbCBDQTErMCkGCSqGSIb3DQEJARYccGVyc29uYWwtZnJlZW1haWxAdGhhd3RlLmNv
bTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA1GnX1LCUZFtx6UfYDFG26nKRsIRefS0Nj3sS
34UldSh0OkIsYyeflXtL734Zhx2G6qPduc6WZBrCFG5ErHzmj+hND3EfQDimAKOHePb5lIZererA
Xnbr2RSjXW56fAylS1V/Bhkpf56aJtVquzgkCGqYx7Hao5iR/Xnb5VrEHLkCAwEAAaMTMBEwDwYD
VR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQDH7JJ+Tvj1lqVnYiqk8E0R
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
------=_NextPart_000_0025_01C764A6.3521E130
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf
> Of Ethan Galstad
> Sent: March 12, 2007 11:56
> To: Nagios Developers List
> Subject: Re: [Nagios-devel] Patch for handling pipes nicely +
> fix bug in config parsing
>
> Thomas Guyot-Sionnest wrote:
> > Hi Ethan, list,
> >
> > I made a patch to make Nagios handle nicely perfdata_file
> as pipes. What
> > it does is add a new file mode; i.e.:
> >
> > host_perfdata_file_mode=p
> > service_perfdata_file_mode=p
> >
> > When set to "p", it will use open with O_NONBLOCK | O_RDWR,
> then fdopen
> > on the fd, so that the fd will be left with O_NONBLOCK.
> This will allow
> > Nagios to open the pipe without blocking even if there's no
> reader. It
> > will also avoid loosing data if the reader goes away for a
> short period
> > of time (ex. performance data daemon restart)
> >
> > While testing it I also found out there's a bug in the argument
> > processing. strstr returns the pointer to the search string. so that
> > if(!strstr(...)) is like saying if(string not there). The
> original code
> > looked like this:
> >
> > if(!strstr(varvalue,"w"))
> > xpddefault_host_perfdata_file_append=FALSE;
> >
> > So I changed that to explicitly check if the value is not NULL. This
> > explains why with "w" I was seeing O_APPEND from strace
> >
> > If you accept this patch I'll submit a complete patch
> including doc and
> > sample config modifications. I can also backport it to the
> 2-x branch if
> > you're willing to accept it.
> >
> > Thanks,
> >
> > Thomas
> >
>
> Thanks! I'll get this applied to the Nagios 3 CVS code today.
Thanks! I'll work on the doc and config patch during the week. I guess
you'll patch the 2-x branch with at least the strstr fix. Would you like a
"piped perfdata" patch for the 2-x branch as well?
Thomas
------=_NextPart_000_0025_01C764A6.3521E130
Content-Type: application/x-pkcs7-signature;
name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="smime.p7s"
MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIIzjCCAlYw
ggG/oAMCAQICEF6WlTyD2iR9R4J/yf+4yw4wDQYJKoZIhvcNAQEFBQAwYjELMAkGA1UEBhMCWkEx
JTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQ
ZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBMB4XDTA2MTAxNjE1MTgxNVoXDTA3MTAxNjE1MTgx
NVowQjEfMB0GA1UEAxMWVGhhd3RlIEZyZWVtYWlsIE1l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mljZXMgRGl2aXNpb24xJDAiBgNVBAMTG1RoYXd0ZSBQZXJzb25h
bCBGcmVlbWFpbCBDQTErMCkGCSqGSIb3DQEJARYccGVyc29uYWwtZnJlZW1haWxAdGhhd3RlLmNv
bTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA1GnX1LCUZFtx6UfYDFG26nKRsIRefS0Nj3sS
34UldSh0OkIsYyeflXtL734Zhx2G6qPduc6WZBrCFG5ErHzmj+hND3EfQDimAKOHePb5lIZererA
Xnbr2RSjXW56fAylS1V/Bhkpf56aJtVquzgkCGqYx7Hao5iR/Xnb5VrEHLkCAwEAAaMTMBEwDwYD
VR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQDH7JJ+Tvj1lqVnYiqk8E0R
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]