[Nagios-devel] Inherit service contacts from host

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] Inherit service contacts from host

Post by Guest »


--sHrvAb52M6C8blB9
Content-Type: multipart/mixed; boundary="UHN/qo2QbUvPLonB"
Content-Disposition: inline


--UHN/qo2QbUvPLonB
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

I've written some patch to include host contacts when senting
notification about some service of that host. It adds config option
"notify_host_contacts" to service definition. Maybe it will be useful
for someone else. Attached patch is against nagios-3.1.0 (not cvs head),
but I think it isn't problem. What do you think?

--=20
Regargs,
Marek Marczykowski | gg:2873965
marmarek at staszic waw pl | xmpp:marmarek at staszic waw pl


--UHN/qo2QbUvPLonB
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
filename="nagios-3.1.0-service_notify_host_contacts.patch"
Content-Transfer-Encoding: quoted-printable

diff -ur nagios-3.1.0.orig/base/notifications.c nagios-3.1.0/base/notificat=
ions.c
--- nagios-3.1.0.orig/base/notifications.c 2008-11-30 18:22:58.000000000 +0=
100
+++ nagios-3.1.0/base/notifications.c 2009-02-21 16:56:27.000000000 +0100
@@ -112,6 +112,11 @@
/* create the contact notification list for this service */
create_notification_list_from_service(svc,options,&escalated);
=20
+ if (svc->notify_host_contacts) {
+ /* create the contact notification list for this host */
+ create_notification_list_from_host(svc->host_ptr,options,&escalated);
+ }
+
#ifdef USE_EVENT_BROKER
/* send data to event broker */
end_time.tv_sec=3D0L;
diff -ur nagios-3.1.0.orig/common/objects.c nagios-3.1.0/common/objects.c
--- nagios-3.1.0.orig/common/objects.c 2008-11-30 18:22:59.000000000 +0100
+++ nagios-3.1.0/common/objects.c 2009-02-21 16:47:02.000000000 +0100
@@ -1762,7 +1762,7 @@
=20
=20
/* add a new service to the list in memory */
-service *add_service(char *host_name, char *description, char *display_nam=
e, char *check_period, int initial_state, int max_attempts, int parallelize=
, int accept_passive_checks, double check_interval, double retry_interval, =
double notification_interval, double first_notification_delay, char *notifi=
cation_period, int notify_recovery, int notify_unknown, int notify_warning,=
int notify_critical, int notify_flapping, int notify_downtime, int notific=
ations_enabled, int is_volatile, char *event_handler, int event_handler_ena=
bled, char *check_command, int checks_enabled, int flap_detection_enabled, =
double low_flap_threshold, double high_flap_threshold, int flap_detection_o=
n_ok, int flap_detection_on_warning, int flap_detection_on_unknown, int fla=
p_detection_on_critical, int stalk_on_ok, int stalk_on_warning, int stalk_o=
n_unknown, int stalk_on_critical, int process_perfdata, int failure_predict=
ion_enabled, char *failure_prediction_options, int check_freshness, int fre=
shness_threshold, char *notes, char *notes_url, char *action_url, char *ico=
n_image, char *icon_image_alt, int retain_status_information, int retain_no=
nstatus_information, int obsess_over_service){
+service *add_service(char *host_name, char *description, char *display_nam=
e, char *check_period, int initial_state, int max_attempts, int parallelize=
, int accept_passive_checks, double check_interval, double retry_interval, =
double notification_interval, double first_notification_delay, char *notifi=
cation_period, int notify_recovery, int notify_unknown, int notify_warning,=
int notify_critical, int notify_flapping, int notify_downtime, int notific=
ations_enabled, int notify_host_contacts, int is_volatile, char *event_hand=
ler, int event_handler_enabled, char *check_command, int checks_enabled, in=
t flap_detection_enabled, double low_flap_threshold, double high_flap_thres=
hold, int flap_detection_on_ok, int flap_detection_on_warning, int flap_det=
ection_on_unknown, int flap_detection_on_critical, int stalk_on_ok, int sta=
lk_on_warning, int stalk_on_unknown, int stalk_on_critical, int process_per=
fdata, int failure_prediction_enabled, char *failure_prediction_options, in=
t check_freshness, int freshness_threshold, char *notes, char *notes_url, c=
ha

...[email truncated]...


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