From: Alex Dehnert Date: Mon, 9 Oct 2023 04:23:57 +0000 (+0000) Subject: Allow some services to have public notifications and others private X-Git-Url: https://dehnerts.com/gitweb/?a=commitdiff_plain;h=ec44f5f2dc025260fb03f567dc1f65fec5461f7e;p=sysconfig%2Fnagios3.git Allow some services to have public notifications and others private --- diff --git a/conf.d/zephyr.cfg b/conf.d/zephyr.cfg index 21db066..d9c83e9 100644 --- a/conf.d/zephyr.cfg +++ b/conf.d/zephyr.cfg @@ -1,11 +1,16 @@ +# -n: Don't send pings +# -d: Don't try to auth +# -S: sender (use non-default to allow muting separately in e.g. Zulip) +# -s: zsig + # 'host-notify-by-zephyr' command definition define command{ command_name host-notify-by-zephyr - command_line /usr/bin/printf "%b" "Host $HOSTSTATE$ $NOTIFICATIONTYPE$ alert for $HOSTNAME$!\n$HOSTOUTPUT$\n$LONGHOSTOUTPUT$" | /usr/bin/zwrite -d -s "Nagios" -i "nagios.$HOSTALIAS$" "$CONTACTADDRESS1$" + command_line /usr/bin/printf "%b" "Host $HOSTSTATE$ $NOTIFICATIONTYPE$ alert for $HOSTNAME$!\n$HOSTOUTPUT$\n$LONGHOSTOUTPUT$" | /usr/bin/zwrite -n -d -S nagios-adehnert -s "Nagios" -c "$CONTACTEMAIL$" -i "nagios.$HOSTALIAS$" "$CONTACTADDRESS1$" } # 'notify-by-zephyr' command definition define command{ command_name notify-by-zephyr - command_line /usr/bin/printf "%b" "$NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$\n$SERVICEOUTPUT$\n$LONGSERVICEOUTPUT$" | /usr/bin/zwrite -d -s "Nagios" -i "nagios.$HOSTALIAS$.$SERVICEDESC$" "$CONTACTADDRESS1$" + command_line /usr/bin/printf "%b" "$NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$\n$SERVICEOUTPUT$\n$LONGSERVICEOUTPUT$" | /usr/bin/zwrite -n -d -S nagios-adehnert -s "Nagios" -c "$CONTACTEMAIL$" -i "nagios.$HOSTALIAS$.$SERVICEDESC$" "$CONTACTADDRESS1$" } diff --git a/local.d/adehnert-host.cfg b/local.d/adehnert-host.cfg index 44db200..d22a1fd 100644 --- a/local.d/adehnert-host.cfg +++ b/local.d/adehnert-host.cfg @@ -1,6 +1,7 @@ define host{ name adehnert-host use generic-host + contact_groups adehnert-pub notification_interval 240 max_check_attempts 5 register 0 @@ -63,6 +64,7 @@ define service { hostgroup_name adehnert-minions service_description SERVICES-ALL check_command check_byssh_generic!check_services_all + contact_groups adehnert-priv } define service { diff --git a/local.d/contacts.cfg b/local.d/contacts.cfg index f15c7b5..9d7b852 100644 --- a/local.d/contacts.cfg +++ b/local.d/contacts.cfg @@ -10,6 +10,12 @@ define contactgroup { members adehnert-pub-zephyr } +define contactgroup { + contactgroup_name adehnert-priv + alias adehnert-priv + members adehnert-priv-zephyr +} + define contact { contact_name adehnert-pub-zephyr alias adehnert-pub-zephyr @@ -20,6 +26,21 @@ define contact { service_notification_commands notify-by-zephyr host_notification_commands host-notify-by-zephyr email adehnert-auto + # Intentionally blank, so message is public + address1 +} + + +define contact { + contact_name adehnert-priv-zephyr + alias adehnert-priv-zephyr + service_notification_period 24x7 + host_notification_period 24x7 + service_notification_options w,u,c,r + host_notification_options d,u,r + service_notification_commands notify-by-zephyr + host_notification_commands host-notify-by-zephyr + email message address1 adehnert }