[icinga-checkins] icinga.org: icinga-core/master: core: add the notification type by string to debug logs; set CUSTOM=8, STALKING= 9
git at icinga.org
git at icinga.org
Thu Mar 21 17:12:37 CET 2013
Module: icinga-core
Branch: master
Commit: 9d5f21de569a1101cf5bfdb10692832c4c93e30e
URL: https://git.icinga.org/?p=icinga-core.git;a=commit;h=9d5f21de569a1101cf5bfdb10692832c4c93e30e
Author: Michael Friedrich <michael.friedrich at netways.de>
Date: Sun Mar 10 19:17:55 2013 +0100
core: add the notification type by string to debug logs; set CUSTOM=8, STALKING=9
fixes #3818
---
Changelog | 2 ++
base/notifications.c | 18 ++++++++++++++++--
include/icinga.h | 4 ++--
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/Changelog b/Changelog
index fe98861..e83308c 100644
--- a/Changelog
+++ b/Changelog
@@ -22,6 +22,7 @@ ENHANCEMENTS
* core: refuse to start if neb modules fail to load (Andreas Ericsson) #3812 - MF
* core: keep logfile open, reducing open/close performance decreases (Andreas Ericsson) #3390 - MF
* core: enhance illegal macro character processing performance (Andreas Ericsson) #3389 - MF
+* core: add the notification type by string to debug logs; set CUSTOM=8, STALKING=9 (Andreas Ericsson) #3818 - MF
* classic ui: Add "set_expire_ack_by_default" to cgi configuration #3476 - CF
* classic ui: Add "send_ack_notifications" to cgi configuration (TheCry) #3467 - CF
@@ -88,6 +89,7 @@ CHANGES
* core: -v param can be used more than once #3510
* core: 'Warning: Host ... has no service associated with it!' now happens only in icinga -vv icinga.cfg #3510
* core: refuse to start if neb modules fail to load #3812
+* core: notification type nr CUSTOM=8 and STALKING=9 (reflected in idoutils tables) #3818
* ido2db.cfg:
** use_transactions #3527
diff --git a/base/notifications.c b/base/notifications.c
index 3e4402c..ec87ba6 100644
--- a/base/notifications.c
+++ b/base/notifications.c
@@ -56,6 +56,20 @@ int check_escalation_condition(escalation_condition*);
int dummy; /* reduce compiler warnings */
+const char *notification_reason_name (unsigned int reason_type) {
+ static const char *names[] = {
+ "NORMAL", "ACKNOWLEDGEMENT",
+ "FLAPPINGSTART", "FLAPPINGSTOP", "FLAPPINGDISABLED",
+ "DOWNTIMESTART", "DOWNTIMEEND", "DOWNTIMECANCELLED",
+ "CUSTOM", "STALKING"
+ };
+
+ if (reason_type < sizeof(names))
+ return names[reason_type];
+
+ return "(unknown)";
+}
+
/******************************************************************/
/***************** SERVICE NOTIFICATION FUNCTIONS *****************/
/******************************************************************/
@@ -82,7 +96,7 @@ int service_notification(service *svc, int type, char *not_author, char *not_dat
time(¤t_time);
gettimeofday(&start_time, NULL);
- log_debug_info(DEBUGL_NOTIFICATIONS, 0, "** Service Notification Attempt ** Host: '%s', Service: '%s', Type: %d, Options: %d, Current State: %d, Last Notification: %s", svc->host_name, svc->description, type, options, svc->current_state, ctime(&svc->last_notification));
+ log_debug_info(DEBUGL_NOTIFICATIONS, 0, "** Service Notification Attempt ** Host: '%s', Service: '%s', Type: %s, Options: %d, Current State: %d, Last Notification: %s", svc->host_name, svc->description, notification_reason_name(type), options, svc->current_state, ctime(&svc->last_notification));
/* if we couldn't find the host, return an error */
if ((temp_host = svc->host_ptr) == NULL) {
@@ -1279,7 +1293,7 @@ int host_notification(host *hst, int type, char *not_author, char *not_data, int
time(¤t_time);
gettimeofday(&start_time, NULL);
- log_debug_info(DEBUGL_NOTIFICATIONS, 0, "** Host Notification Attempt ** Host: '%s', Type: %d, Options: %d, Current State: %d, Last Notification: %s", hst->name, type, options, hst->current_state, ctime(&hst->last_host_notification));
+ log_debug_info(DEBUGL_NOTIFICATIONS, 0, "** Host Notification Attempt ** Host: '%s', Type: %s, Options: %d, Current State: %d, Last Notification: %s", hst->name, notification_reason_name(type), options, hst->current_state, ctime(&hst->last_host_notification));
/* check viability of sending out a host notification */
diff --git a/include/icinga.h b/include/icinga.h
index b2664f5..f16d8c1 100644
--- a/include/icinga.h
+++ b/include/icinga.h
@@ -211,8 +211,8 @@ extern "C" {
#define NOTIFICATION_DOWNTIMESTART 5
#define NOTIFICATION_DOWNTIMEEND 6
#define NOTIFICATION_DOWNTIMECANCELLED 7
-#define NOTIFICATION_CUSTOM 99
-#define NOTIFICATION_STALKING 16211
+#define NOTIFICATION_CUSTOM 8
+#define NOTIFICATION_STALKING 9
More information about the icinga-checkins
mailing list