[Nagios-devel] External Escalations for services and hosts
Posted: Thu Mar 27, 2003 7:07 am
--=-mEgIifPPQFH5sPpQiGQm
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
PROBLEM:
Where I work we have the ability to reply from our pagers. At minimum
we can send a fixed response of "Yes" or "No. We thought it would be
cool to be able to reply to a page from Nagios and either acknowledge or
escalate the problem. While a way existed to acknowledge a problem via
the external command file, there was no way to escalate it. So, I went
ahead an added the code necessary to do so.
NAGIOS CHANGES:
To escalate a problem (thus notifying the next level of support that you
cannot address this issue) you simply stick an "ESCALATE_SVC_PROBLEM"
command in the external command file. Internally it is treated almost
the same as an ACKNOWLEDGMENT but does not quiet the notifications, and
bumps the escalation level up 1 level. The code changes are fairly
simple.
ADDITIONAL APPLICATION:
I have also implemented a simple java program which will pop mail from a
mail server and look for replies to Nagios notifications and then
acknowledge or escalate the problem appropriately via the external
command file. It does some basic verification that the user replying is
a known and expected user, that there is really a problem that can be
acknowledged or escalated, and that it was within a given time limit.
To set it up, you basically make the reply-to address of your mail be
something like [email protected] and then configure the program
to pop mail from that account and insert commands into the external
command file. See the source for more detail. (You will need javamail
(mail.jar and activation.jar) from sun to compile it)
TEST STATUS:
I originally implemented this against 1.0b6, but have pulled my changes
forward to 1.0 and then to head revisions in cvs. I built and tested
the code again against Nagios 1.0. However, I only verified that it
compiles against head revisions in cvs.
FILES:
Attached are 4 files:
Escalations-1.0.patch: A -u3 patch against the Nagios 1.0 release
available via the website. (Compiled and tested)
Escalations-CVS-Head.patch: A -u3 patch against the head of cvs as of
3/27/03 at 8:00MST. (This compiles and most likely works.) (I do not
have time to fully test it)
NagiosMailCommandCheck.java: The java program to check for replies to
Nagios notifications. (Works against 1.0b6 as well as 1.0 and as long
as the status.log has not changed format, it should still work.)
known_users.properties: A sample properties file used for user
verification. Spaces in address names must be replaced with underscores
for it to work. To find the exact string needed I simply mailed my
pager from my regular mail client, replied, and then looked in the mail
header for the exact string that was sent, and then added that to the
properties file. Or you can try it and if the mail message does not have
a known user, it will print out the email information, and you can copy
the information from the "FROM:" line (changing spaces to underscores)
into the properties file.
It would be great to see the external escalations merged into the
official Nagios code, and the additional mail check program included as
an addon.
If you have any questions, please do not hesitate to contact me.
|)ave
--=-mEgIifPPQFH5sPpQiGQm
Content-Disposition: attachment; filename=Escalations-1.0.patch
Content-Type: text/x-patch; name=Escalations-1.0.patch; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
diff -r -u3 nagios-1.0/base/checks.c nagios-1.0.Synixs/base/checks.c
--- nagios-1.0/base/checks.c 2002-11-17 18:15:13.000000000 -0700
+++ nagios-1.0.Synixs/base/checks.c 2003-03-17 09:53:31.000000000 -0700
@@ -835,7 +835,7 @@
state_was_logged=TRUE;
/* notify contacts about the service recovery */
- service_notification(temp_service,NULL);
+ service_notification(temp_service,NULL,FALSE);
/* run the service event handler to handle the hard state change */
handle_service_event(temp_service,HARD_STATE);
@@ -928,7 +928,7 @@
log_host_event(temp_host,temp_host->status,HARD_STATE);
/* possibly re-send host notifications... */
- hos
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
PROBLEM:
Where I work we have the ability to reply from our pagers. At minimum
we can send a fixed response of "Yes" or "No. We thought it would be
cool to be able to reply to a page from Nagios and either acknowledge or
escalate the problem. While a way existed to acknowledge a problem via
the external command file, there was no way to escalate it. So, I went
ahead an added the code necessary to do so.
NAGIOS CHANGES:
To escalate a problem (thus notifying the next level of support that you
cannot address this issue) you simply stick an "ESCALATE_SVC_PROBLEM"
command in the external command file. Internally it is treated almost
the same as an ACKNOWLEDGMENT but does not quiet the notifications, and
bumps the escalation level up 1 level. The code changes are fairly
simple.
ADDITIONAL APPLICATION:
I have also implemented a simple java program which will pop mail from a
mail server and look for replies to Nagios notifications and then
acknowledge or escalate the problem appropriately via the external
command file. It does some basic verification that the user replying is
a known and expected user, that there is really a problem that can be
acknowledged or escalated, and that it was within a given time limit.
To set it up, you basically make the reply-to address of your mail be
something like [email protected] and then configure the program
to pop mail from that account and insert commands into the external
command file. See the source for more detail. (You will need javamail
(mail.jar and activation.jar) from sun to compile it)
TEST STATUS:
I originally implemented this against 1.0b6, but have pulled my changes
forward to 1.0 and then to head revisions in cvs. I built and tested
the code again against Nagios 1.0. However, I only verified that it
compiles against head revisions in cvs.
FILES:
Attached are 4 files:
Escalations-1.0.patch: A -u3 patch against the Nagios 1.0 release
available via the website. (Compiled and tested)
Escalations-CVS-Head.patch: A -u3 patch against the head of cvs as of
3/27/03 at 8:00MST. (This compiles and most likely works.) (I do not
have time to fully test it)
NagiosMailCommandCheck.java: The java program to check for replies to
Nagios notifications. (Works against 1.0b6 as well as 1.0 and as long
as the status.log has not changed format, it should still work.)
known_users.properties: A sample properties file used for user
verification. Spaces in address names must be replaced with underscores
for it to work. To find the exact string needed I simply mailed my
pager from my regular mail client, replied, and then looked in the mail
header for the exact string that was sent, and then added that to the
properties file. Or you can try it and if the mail message does not have
a known user, it will print out the email information, and you can copy
the information from the "FROM:" line (changing spaces to underscores)
into the properties file.
It would be great to see the external escalations merged into the
official Nagios code, and the additional mail check program included as
an addon.
If you have any questions, please do not hesitate to contact me.
|)ave
--=-mEgIifPPQFH5sPpQiGQm
Content-Disposition: attachment; filename=Escalations-1.0.patch
Content-Type: text/x-patch; name=Escalations-1.0.patch; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
diff -r -u3 nagios-1.0/base/checks.c nagios-1.0.Synixs/base/checks.c
--- nagios-1.0/base/checks.c 2002-11-17 18:15:13.000000000 -0700
+++ nagios-1.0.Synixs/base/checks.c 2003-03-17 09:53:31.000000000 -0700
@@ -835,7 +835,7 @@
state_was_logged=TRUE;
/* notify contacts about the service recovery */
- service_notification(temp_service,NULL);
+ service_notification(temp_service,NULL,FALSE);
/* run the service event handler to handle the hard state change */
handle_service_event(temp_service,HARD_STATE);
@@ -928,7 +928,7 @@
log_host_event(temp_host,temp_host->status,HARD_STATE);
/* possibly re-send host notifications... */
- hos
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]