Home » Categories » Products » Nagios Core » Documentation » Notifications

Nagios Core - Nagios URL In Notifications


This KB article shows you how to provide a URL for the Nagios host or service object in your notifications. This allows your end users to go directly to the object they are being notified about.

This functionality was introduced in Nagios Core 4.3.3.


Editing Files

In many steps of this article you will be required to edit files. This documentation will use the vi text editor. When using the vi editor:

  • To make changes press i on the keyboard first to enter insert mode
  • Press Esc to exit insert mode
  • When you have finished, save the changes in vi by typing :wq and press Enter


Nagios Configuration

There is a configuration directive called website_url that needs to be defined in nagios.cfg before you can use the URL in your notifications.

Execute the following command to open the nagios.cfg file in vi:

vi /usr/local/nagios/etc/nagios.cfg


Add the following line to the file:


Change xxx.xxx.xxx.xxx to the IP Address or DNS record of your Nagios Core server, for example:



Save your changes and close the nagios.cfg file.


The next step is to update your host and service notification commands to use the relevant macros. In this example these are defined in the commands.cfg file. Execute the following command to open the file in vi:

vi /usr/local/nagios/etc/objects/commands.cfg


For the host notification command you use the $HOSTINFOURL$ as per the following example:

define command{
        command_name    notify-host-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\n
Host Info URL: $HOSTINFOURL$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$


For the service notification command you use the $SERVICEINFOURL$ as per the following example:

define command{
        command_name    notify-service-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\n
Service Info URL: $SERVICEINFOURL$\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$


Save your changes and close the commands.cfg file.


Restart the nagios service for these changes to take effect. If you are unsure of the command required for restarting the nagios service please refer to the following KB article:

Nagios Core - Installing Nagios Core From Source


Example Notifications

When a notification is now sent there will be a link available for that object in Nagios Core, here are two examples:


***** Nagios *****

Notification Type: CUSTOM
Host: localhost
State: UP
Info: PING OK - Packet loss = 0%, RTA = 0.04 ms

Date/Time: Mon Oct 23 12:58:34 AEDT 2017
Host Info URL: http://core-015/nagios/cgi-bin/extinfo.cgi?type=1&host=localhost



***** Nagios *****

Notification Type: CUSTOM

Service: PING
Host: localhost
State: OK

Date/Time: Mon Oct 23 12:58:53 AEDT 2017
Service Info URL: http://core-015/nagios/cgi-bin/extinfo.cgi?type=2&host=localhost&service=PING
Additional Info:

PING OK - Packet loss = 0%, RTA = 0.05 ms



Final Thoughts

For any support related questions please visit the Nagios Support Forums at:


5 (1)
Article Rating (1 Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
Attachments Attachments
There are no attachments for this article.
Related Articles RSS Feed
Nagios Core - TCP Wrapper Integration
Viewed 1343 times since Mon, Feb 1, 2016
Nagios XI - Integrating On-Call Schedules with Nagios - NWC13
Viewed 1948 times since Tue, Feb 9, 2016
Nagios Core - Notification Escalations
Viewed 2170 times since Mon, Feb 1, 2016
Nagios Core - Notifications
Viewed 2735 times since Sun, Jan 31, 2016
Nagios Core - On-Call Rotations
Viewed 1711 times since Mon, Feb 1, 2016
Twilio SMS Integration
Viewed 1215 times since Fri, Apr 26, 2019