Instance Name must match exactly.
The instance name you set in the script (
EASYNAG_INSTANCE
/ EASYNAG_DEFAULT_INSTANCE) must be
identical to the instance name configured in the
easyNag app. If they don't match, notification actions (acknowledge,
downtime, …) and the direct jump to the affected host or service from
a push notification will not work.
checkmk
Python notification script with per-user User Key via Custom User Attributes
easynag_checkmk.py
Python
Download
1
Create Custom User Attributes in checkmk
Navigate to
Setup → Users → Custom user attributes → Add
attribute. Create two attributes — these will appear as individual
fields on each user's profile page.
| Name | Title | Type | Topic / Available in notifications |
|---|---|---|---|
| EASYNAG_USER_KEY | easyNag User Key | Simple Text | Identity - Yes |
| EASYNAG_INSTANCE | easyNag Instance Name | Simple Text | Identity - Yes |
For each attribute, make sure to enable
"Make this variable available in notifications"
— otherwise they won't be passed to the script as
NOTIFY_CONTACT_* environment variables.
2
Set values for each user
Navigate to Setup → Users → Edit user and
fill in both fields for every user who should receive push
notifications. Each user can have their own individual User
Key and Instance name.
easyNag User Key: Found in the easyNag app
under Settings → Manage Notifications → User Key
easyNag Instance Name: The name of your easyNag monitoring instance (e.g.
easyNag Instance Name: The name of your easyNag monitoring instance (e.g.
MyCheckmk)
3
Deploy the script
Place the script in the
local/ notifications
directory so it survives checkmk updates.
# Copy to notifications directory cp easynag_checkmk.py ~/local/share/check_mk/notifications/easynag chmod +x ~/local/share/check_mk/notifications/easynag # Create log directory mkdir -p /var/log/monitoring chown $(whoami) /var/log/monitoring
4
Create a Notification Rule
Navigate to Setup → Notifications → Add rule.
Users without a User Key set are silently skipped.
Notification method: Select
Contact selection: All contacts — or specific users / groups
Conditions: Leave empty for all events, or restrict as needed
easynagContact selection: All contacts — or specific users / groups
Conditions: Leave empty for all events, or restrict as needed
5
Test the notification
NOTIFY_CONTACT_EASYNAG_USER_KEY="abcdef1234567890abcdef1234567" \ NOTIFY_CONTACT_EASYNAG_INSTANCE="MyCheckmk" \ NOTIFY_WHAT=SERVICE \ NOTIFY_NOTIFICATIONTYPE=PROBLEM \ NOTIFY_HOSTNAME="www.example.com" \ NOTIFY_SERVICESTATE=CRITICAL \ NOTIFY_SERVICEDESC=HTTP \ NOTIFY_SERVICEOUTPUT="HTTP CRITICAL - Connection refused" \ NOTIFY_SHORTDATETIME="$(date '+%Y-%m-%d %H:%M')" \ NOTIFY_CONTACTNAME="testuser" \ NOTIFY_NOTIFICATIONAUTHORALIAS="" \ NOTIFY_NOTIFICATIONCOMMENT="" \ ~/local/share/check_mk/notifications/easynag # Check the log tail -f /var/log/monitoring/notifications.log
A push notification should appear on your device.
Icinga 2
Setup push notifications using a custom NotificationCommand object
easynag_icinga2.shBash
Download
1
Deploy the script and set the default Instance name
Copy the script and set
EASYNAG_DEFAULT_INSTANCE at the top. This name is
used when no per-user instance is set.
cp easynag_icinga2.sh /etc/icinga2/scripts/easynag-notification.sh chmod +x /etc/icinga2/scripts/easynag-notification.sh
EASYNAG_DEFAULT_INSTANCE="MyIcinga" # fallback — overridable per user
2
Set User Key and optional Instance name per user
Each user needs
vars.easynag_user_key set to
their personal easyNag User Key. Optionally set
vars.easynag_instance to override the instance
name in their push notifications. Users without a User Key are
silently skipped.
object User "user1" { display_name = "User1" vars.easynag_user_key = "abcdef1234567890abcdef1234567" vars.easynag_instance = "MyIcinga" // overrides script default } object User "user2" { display_name = "User2" vars.easynag_user_key = "zyxwvu9876543210zyxwvu9876543" // no easynag_instance — uses script default }
The User Key is found in the easyNag app under
Settings → Manage Notifications → User Key.
3
Create the NotificationCommand and Apply rules
Set
host.vars.easynag_notify = true on any host
you want to receive alerts for.
object NotificationCommand "easynag" { command = [ "/etc/icinga2/scripts/easynag-notification.sh" ] env = { // per-user vars EASYNAG_USER_KEY = "$user.vars.easynag_user_key$" EASYNAG_INSTANCE = "$user.vars.easynag_instance$" // notification context ICINGA_NOTIFICATIONTYPE = "$notification.type$" ICINGA_HOSTNAME = "$host.name$" ICINGA_HOSTSTATE = "$host.state$" ICINGA_HOSTOUTPUT = "$host.output$" ICINGA_SERVICEDESC = "$service.display_name$" ICINGA_SERVICESTATE = "$service.state$" ICINGA_SERVICEOUTPUT = "$service.output$" ICINGA_LONGDATETIME = "$icinga.long_date_time$" ICINGA_NOTIFICATIONAUTHORNAME = "$notification.author$" ICINGA_NOTIFICATIONCOMMENT = "$notification.comment$" ICINGA_CONTACTNAME = "$user.name$" } } apply Notification "easynag-host" to Host { command = "easynag" types = [ Problem, Recovery, Acknowledgement ] users = [ "user1", "user2" ] assign where host.vars.easynag_notify == true } apply Notification "easynag-service" to Service { command = "easynag" types = [ Problem, Recovery, Acknowledgement ] users = [ "user1", "user2" ] assign where host.vars.easynag_notify == true }
4
Validate, reload and test
icinga2 daemon --validate && systemctl reload icinga2 # Manual test — replace the user key with your real key from Settings → Manage Notifications → User Key EASYNAG_USER_KEY="your-real-user-key-here" \ EASYNAG_INSTANCE="MyIcinga" \ ICINGA_NOTIFICATIONTYPE=PROBLEM \ ICINGA_HOSTNAME=www.example.com \ ICINGA_HOSTSTATE=DOWN \ ICINGA_HOSTOUTPUT="PING CRITICAL - Packet loss = 100%" \ ICINGA_LONGDATETIME="$(date '+%Y-%m-%d %H:%M')" \ ICINGA_CONTACTNAME=testuser \ /etc/icinga2/scripts/easynag-notification.sh
Nagios Core
Single script for host and service notifications
easynag_nagios_core.shBash
Download
1
Deploy the script and set the default Instance name
Copy the script and set
EASYNAG_INSTANCE at the
top. This is the fallback used when no per-contact instance is
set.
cp easynag_nagios_core.sh /usr/local/nagios/libexec/easynag_notify.sh chmod +x /usr/local/nagios/libexec/easynag_notify.sh
EASYNAG_INSTANCE="MyNagios" # fallback — overridable per contact
2
Set User Key and optional Instance name per contact
Each contact needs
_EASYNAG_USER_KEY set to their
personal easyNag User Key. Optionally set
_EASYNAG_INSTANCE to give a contact a different
instance name in their push notifications — if omitted, the
script default is used.
define contact { contact_name user1 alias User1 _EASYNAG_USER_KEY abcdef1234567890abcdef1234567 ; required _EASYNAG_INSTANCE MyNagios ; optional — overrides script default host_notification_commands notify-host-by-easynag service_notification_commands notify-service-by-easynag host_notification_options d,u,r,f,s service_notification_options w,u,c,r,f,s host_notifications_enabled 1 service_notifications_enabled 1 host_notification_period 24x7 service_notification_period 24x7 } define contact { contact_name user2 alias User2 _EASYNAG_USER_KEY zyxwvu9876543210zyxwvu9876543 ; required ; no _EASYNAG_INSTANCE — uses script default host_notification_commands notify-host-by-easynag service_notification_commands notify-service-by-easynag host_notification_options d,u,r,f,s service_notification_options w,u,c,r,f,s host_notifications_enabled 1 service_notifications_enabled 1 host_notification_period 24x7 service_notification_period 24x7 } define contactgroup { contactgroup_name admins members user1,user2 }
The User Key is found in the easyNag app under
Settings → Manage Notifications → User Key.
Contacts without
_EASYNAG_USER_KEY are silently
skipped.
3
Define notification commands
define command { command_name notify-host-by-easynag command_line /usr/local/nagios/libexec/easynag_notify.sh "$_CONTACTEASYNAG_USER_KEY$" "HOST" "$NOTIFICATIONTYPE$" "$HOSTNAME$" "$HOSTSTATE$" "$HOSTOUTPUT$" "$SHORTDATETIME$" "$NOTIFICATIONAUTHOR$" "$NOTIFICATIONCOMMENT$" "" "$_CONTACTEASYNAG_INSTANCE$" } define command { command_name notify-service-by-easynag command_line /usr/local/nagios/libexec/easynag_notify.sh "$_CONTACTEASYNAG_USER_KEY$" "SERVICE" "$NOTIFICATIONTYPE$" "$HOSTNAME$" "$SERVICESTATE$" "$SERVICEOUTPUT$" "$SHORTDATETIME$" "$NOTIFICATIONAUTHOR$" "$NOTIFICATIONCOMMENT$" "$SERVICEDESC$" "$_CONTACTEASYNAG_INSTANCE$" }
4
Validate, reload and test
nagios -v /etc/nagios/nagios.cfg && systemctl reload nagios # Manual test /usr/local/nagios/libexec/easynag_notify.sh \ "abcdef1234567890abcdef1234567" \ "SERVICE" \ "PROBLEM" \ "www.example.com" \ "CRITICAL" \ "HTTP CRITICAL - Connection refused" \ "$(date '+%m-%d-%Y %H:%M:%S')" \ "" "" \ "HTTP" \ "MyNagios"
Nagios XI
Setup push notifications via Core Config Manager — two commands (host & service), User Key and Instance set per contact
easynag_nagios_xi.shBash
Download
1
Deploy the script and set the Instance name
Copy the script to the Nagios plugins directory and set
EASYNAG_INSTANCE at the top to match the instance
name in your easyNag app.
cp easynag_nagios_xi.sh /usr/local/nagios/libexec/easynag_notify.sh chmod +x /usr/local/nagios/libexec/easynag_notify.sh
EASYNAG_INSTANCE="MyNagiosXI" # must match the instance name in the easyNag app
2
Create Notification Commands in Core Config Manager
Navigate to
Configure → Core Config Manager → Commands → Add
New. Create two commands — one for hosts, one for services. The
User Key is read from the contact's custom variable
$_CONTACTEASYNAG_USER_KEY$.
/usr/local/nagios/libexec/easynag_notify.sh \ --what HOST --type "$NOTIFICATIONTYPE$" \ --hostname "$HOSTNAME$" --state "$HOSTSTATE$" \ --output "$HOSTOUTPUT$" --date "$SHORTDATETIME$" \ --author "$NOTIFICATIONAUTHOR$" --comment "$NOTIFICATIONCOMMENT$" \ --user-key "$_CONTACTEASYNAG_USER_KEY$" --instance "$_CONTACTEASYNAG_INSTANCE$"
/usr/local/nagios/libexec/easynag_notify.sh \ --what SERVICE --type "$NOTIFICATIONTYPE$" \ --hostname "$HOSTNAME$" --service "$SERVICEDESC$" \ --state "$SERVICESTATE$" --output "$SERVICEOUTPUT$" \ --date "$SHORTDATETIME$" \ --author "$NOTIFICATIONAUTHOR$" --comment "$NOTIFICATIONCOMMENT$" \ --user-key "$_CONTACTEASYNAG_USER_KEY$" --instance "$_CONTACTEASYNAG_INSTANCE$"
3
Configure each contact
Navigate to
Configure → Core Config Manager → Contacts → Edit
for each user who should receive push notifications. Three
things need to be set:
Custom Variables → _EASYNAG_USER_KEY
(required): The contact's personal easyNag User Key — found in
the app under
Settings → Manage Notifications → User Key.
Custom Variables → _EASYNAG_INSTANCE (optional): Instance name override for this contact. If left empty, the script default (
Notification tab: Set Host notification command to
Custom Variables → _EASYNAG_INSTANCE (optional): Instance name override for this contact. If left empty, the script default (
EASYNAG_INSTANCE) is
used.Notification tab: Set Host notification command to
notify-host-by-easynag and
Service notification command to
notify-service-by-easynag.
4
Apply configuration and test
Click
Apply Configuration in Core Config Manager to
activate the changes, then run a manual test to confirm the
notification reaches your device.
# Replace with your real User Key from Settings → Manage Notifications → User Key /usr/local/nagios/libexec/easynag_notify.sh \ --what SERVICE --type PROBLEM \ --hostname www.example.com --service HTTP \ --state CRITICAL \ --output "HTTP CRITICAL - Connection refused" \ --date "$(date '+%Y-%m-%d %H:%M')" \ --user-key "your-real-user-key-here"
A push notification should appear on your device
immediately.
Centreon
Setup push notifications via Centreon notification commands and contact configuration
easynag_centreon.shBash
Download
1
Deploy the script and set the Instance name
Copy the script to the Centreon plugins directory and set
EASYNAG_INSTANCE at the top to match the instance
name in your easyNag app.
cp easynag_centreon.sh /usr/lib/centreon/plugins/easynag_notify.sh chmod +x /usr/lib/centreon/plugins/easynag_notify.sh chown centreon-engine:centreon-engine /usr/lib/centreon/plugins/easynag_notify.sh
EASYNAG_INSTANCE="MyCentreon" # must match the instance name in the easyNag app
2
Create Notification Commands
Navigate to
Configuration → Commands → Notifications → Add. Create two commands — one for hosts, one for services. The
User Key is read from the contact's
Address1 field via
$CONTACTADDRESS1$.
/usr/lib/centreon/plugins/easynag_notify.sh \ --what HOST --type "$NOTIFICATIONTYPE$" \ --hostname "$HOSTNAME$" --state "$HOSTSTATE$" \ --output "$HOSTOUTPUT$" --date "$SHORTDATETIME$" \ --author "$NOTIFICATIONAUTHOR$" --comment "$NOTIFICATIONCOMMENT$" \ --user-key "$CONTACTADDRESS1$" --instance "$CONTACTADDRESS2$"
/usr/lib/centreon/plugins/easynag_notify.sh \ --what SERVICE --type "$NOTIFICATIONTYPE$" \ --hostname "$HOSTNAME$" --service "$SERVICEDESC$" \ --state "$SERVICESTATE$" --output "$SERVICEOUTPUT$" \ --date "$SHORTDATETIME$" \ --author "$NOTIFICATIONAUTHOR$" --comment "$NOTIFICATIONCOMMENT$" \ --user-key "$CONTACTADDRESS1$" --instance "$CONTACTADDRESS2$"
3
Configure each contact
Navigate to
Configuration → Users → Contacts → Edit
for each user who should receive push notifications. Two
things need to be set:
Additional information tab → Address1:
Enter the contact's personal easyNag User Key (found in the app
under
Settings → Manage Notifications → User Key).
Additional information tab → Address2 (optional): Instance name override for this contact. If left empty, the script default (
Notification tab: Set Host notification commands to
Additional information tab → Address2 (optional): Instance name override for this contact. If left empty, the script default (
EASYNAG_INSTANCE)
is used.Notification tab: Set Host notification commands to
host-notify-by-easynag and
Service notification commands to
service-notify-by-easynag.
4
Export configuration and test
Export via
Configuration → Pollers → Export configuration, then run a manual test to confirm the notification reaches
your device.
# Replace with your real User Key from Settings → Manage Notifications → User Key /usr/lib/centreon/plugins/easynag_notify.sh \ --what SERVICE --type PROBLEM \ --hostname www.example.com --service HTTP \ --state CRITICAL \ --output "HTTP CRITICAL - Connection refused" \ --date "$(date '+%Y-%m-%d %H:%M')" \ --user-key "your-real-user-key-here"
A push notification should appear on your device
immediately.