Page 1 of 1

Re: [Nagios-devel] when is a notification command run?

Posted: Sun Jan 27, 2008 5:53 am
by Guest
This is a cryptographically signed message in MIME format.

--------------ms040609050305050200020102
Content-Type: multipart/mixed; boundary="------------010409070600000004080109"

This is a multi-part message in MIME format.
--------------010409070600000004080109
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi Antonio,

Antonio Grassi schrieb:
>
> Does this mean that notifications are sent only if the system is
> configured to log notifications, or am I missunderstanding the code?
>

I assume you were right. Regarding the sources the effectiv "my_system"
call to execute the command is only available if "log_notifications" is
true.

I guess just moving the end of the if clause a few lines earlier should
do the trick.

I've attached a unified diff against the latest CVS code.

Regards,
Hendrik

--------------010409070600000004080109
Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0";
name="notification.c.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="notification.c.patch"

--- base/notifications.c.orig 2008-01-27 14:39:53.000000000 +0100
+++ base/notifications.c 2008-01-27 14:42:03.000000000 +0100
@@ -737,21 +737,21 @@

my_free(temp_buffer);
my_free(processed_buffer);
+ }

- /* run the command */
- my_system(processed_command,notification_timeout,&early_timeout,&exectime,NULL,0);
-
- /* check to see if the notification command timed out */
- if(early_timeout==TRUE){
- logit(NSLOG_SERVICE_NOTIFICATION | NSLOG_RUNTIME_WARNING,TRUE,"Warning: Contact '%s' service notification command '%s' timed out after %d seconds\n",cntct->name,processed_command,notification_timeout);
- }
+ /* run the command */
+ my_system(processed_command,notification_timeout,&early_timeout,&exectime,NULL,0);

- /* free memory */
- my_free(command_name);
- my_free(raw_command);
- my_free(processed_command);
+ /* check to see if the notification command timed out */
+ if(early_timeout==TRUE){
+ logit(NSLOG_SERVICE_NOTIFICATION | NSLOG_RUNTIME_WARNING,TRUE,"Warning: Contact '%s' service notification command '%s' timed out after %d seconds\n",cntct->name,processed_command,notification_timeout);
}

+ /* free memory */
+ my_free(command_name);
+ my_free(raw_command);
+ my_free(processed_command);
+
/* get end time */
gettimeofday(&method_end_time,NULL);


--------------010409070600000004080109--

--------------ms040609050305050200020102
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIFuDCC
AtgwggJBoAMCAQICCQCm2uXMgNJKLDANBgkqhkiG9w0BAQUFADBPMQswCQYDVQQGEwJERTEM
MAoGA1UECBMDTlJXMRwwGgYDVQQKExNCYWVja2VyIElUIFNlcnZpY2VzMRQwEgYDVQQDEwtp
bnRlcm5hbCBDQTAeFw0wNzA4MDgxMzExMThaFw0wODA4MDcxMzExMThaMHsxCzAJBgNVBAYT
AkRFMQwwCgYDVQQIEwNOUlcxHDAaBgNVBAoTE0JhZWNrZXIgSVQgU2VydmljZXMxGDAWBgNV
BAMTD0hlbmRyaWsgQmFlY2tlcjEmMCQGCSqGSIb3DQEJARYXYW5kdXJpbkBwcm9jZXNzLXpl
cm8uZGUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJ9MdGOUbOUVjqr6sVAmSmwM4pl4
RCpOhRkLcZsxqS01xSdtsk60O9zKTNIM23A05WTECJwQL9jtdf2yjEpRrdBlwXGnU+muYZX7
L64RrdjqCRRdNqUlaM1YBRFTGKLSEjBfiF3B5SI6U19Gs4JdVH/Tnq9F/VmL7wPTBPT6HQfH
AgMBAAGjgY8wgYwwCQYDVR0TBAIwADARBglghkgBhvhCAQEEBAMCBaAwLAYJYIZIAYb4QgEN
BB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBQeM6m5375Z0mi+
4fR2vjs/33lYVzAfBgNVHSMEGDAWgBS3rNDUwCvH3HcY6lNfn7uOxsWp4DANBgkqhkiG9w0B
AQUFAAOBgQC/NdkSRFIVzD21pqbGnX3NpG0l77QI5/GUraeWTiAUI1MCb+coUg7ySWqRwYl3
lVyrRY8vpf45xNib8LncgzoP4M6/T/YUWeYv+YIzrePEJS0oEUIwJcKTsdflVzoeiUipa64r
G2xpp/pln+zcRK75elz0ELKlp5YMc0IJpwXAMDCCAtgwggJBoAMCAQICCQCm2uXMgNJKLDAN
BgkqhkiG9w0BAQUFADBPMQswCQYDVQQGEwJERTEMMAoGA1UECBMDTlJXMRwwGgYDVQQKExNC
YWVja2VyIElUIFNlcnZpY2VzMRQwEgYDVQQDEwtpbnRlcm5hbCBDQTAeFw0wNzA4MDgxMzEx
MThaFw0wODA4MDcxMzExMThaMHsxCzAJBgNVBAYTAkRFMQwwCgYDVQQIEwNOUlcxHDAaBgNV
BAoTE0JhZWNrZXIgSVQgU2VydmljZXMxGDAWBgNVBAMTD0hlbmRyaWsgQmFlY2tlcjEmMCQG
CSqGSIb3DQEJARYXYW5kdXJpbkBwcm9jZXNzL

...[email truncated]...


This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]