Website URL status with Nagios check_website plugin

Nagios check_website plugin
Nagios check_website plugin

Monitor Website URL with Nagios

In this article, we are going to cover two things “Nagios Service Groups” & “Nagios Check_website Plugin”

These two elements are very important features of Nagios monitoring.

Before we start configuring the Nagios Service Groups.  Please go through the below URL’s which helps to install and configure Nagios server and gives you some more information about Nagios plugins.

Read: Steps to install Nagios core on Linux

Read: Monitor Remote Host using Nagios and NRPE Service

Nagios Service Group

It is basically used to group one or multiple services together so we will able to check all the services in one place.
Service groups are a very useful Nagios feature and easy to configure.

Syntax :

define servicegroup
servicegroup_name WebSites
alias Live Web Sites
members websites_check,,websites_check,

Require Directive in Service Group

  • servicegroup_name – define the name of Service Group.
  • alias – helps to easily identify a particular service group.
  • members – used to define a list of services with the host in this group. Make sure Host & services should be separated by commas.

Here, we are going to use the service group to create a website URL monitoring group. We can be able to monitor the hundreds of website URL in one place. Nagios will send us the uptime alerts for website URLs.

Nagios check_website plugin is meant to verify that the index page is being served properly. Many plugins may check to see if port 80 is responding for a domain or if the site comes up without realizing if it is erroring out due to a DB tie-in, etc.

This creates a file in “/tmp” that has the actual content output from the index. If it is not responding correctly or with an error, it will provide a critical error.

Step 1: Download Nagios Check_website Plugin

Download the check_website plugin with a below-provided link. Save this plugin under the “/usr/local/nagios/libexec”. 

Basically, all the Nagios plugins reside under the same directory or path.

$ cd /usr/local/nagios/libexec
$ wget
$ unzip
$ chown nagios.nagioscmd check_website
$ chmod +x check_website

Step 2: Create Websitecheck.cfg File

To monitor live website URL you need to first create a configuration file and define the host in that file. The configuration file is not present on the server.

You need to manually create “websitecheck.cfg” file and add the definitions to monitor the website.

Go to the “/usr/local/nagios/etc/objects” & create file “websitecheck.cfg” . You can be able to add N number of websites in the configuration file.

$ cd /usr/local/nagios/etc/objects/
$ vim websitecheck.cfg

#Add the below lines to define Host.

define host{

use linux-server
host_name websites_check
alias websites_check

#Add Service to check the website.

define service{
use local-service
host_name websites_check
check_command check_website!

define service{
use local-service
host_name websites_check
check_command check_website!

Step 3: Create servicegroup.cfg File

This configuration file basically helps to define multiple services in a single file as a group.

Servicegroup.cfg file also resides under the “/usr/local/nagios/etc/objects/”. 

This is the main configuration file to define groups.

$ cd /usr/local/nagios/etc/objects/

$ vim servicegroup.cfg

#Add Servicegroups

define servicegroup{
servicegroup_name WebSites
alias Live Web Sites
members websites_check,,websites_check,

Step 4: Add command in commands.cfg File

As you can see above we have used the check_website command in websitecheck.cfg file.

This command we need to define in the command.cfg file.

Without adding command you will not able to fetch or check website URL status.

Now open “commands.cfg” file and add check_website command,

$ cd /usr/local/nagios/etc/objects/

$ vim commands.cfg

#Add Check_website command

define command{
command_name check_website
command_line $USER1$/check_http -H $ARG1$ -e "HTTP/1.1 200" -t 60

Step 5: Set Permissions & Restart the Service

Once the all above file has created. Give necessary permissions to those files so it will work without any issues.

$ chown -R  nagios.nagioscmd /usr/local/nagios/etc/objects
$ chmod 664 websitechecks.cfg servicegroup.cfg commands.cfg

Run syntax check command & restart the service,

$ /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

$ /etc/init.d/nagios restart

Now go to the browser and open Nagios web interface.

In right-hand navigation pane click on “Service Groups → website_check”.

Nagios check_website plugin

These are the 5 simple steps to configure service groups on the Nagios server.

If you’re facing any difficulties while configuring Service Groups. Please do comment queries or problems via the comment section, till then stay tuned to for more such valuable articles.


Welcome to Linuxgrow. I'm Prashant, a tech-blogger from Mumbai, India. I started Linuxgrow as a passion and to share my knowledge about technologies. Here at Linuxgrow, I write about Linux technologies, Aws Cloud, Wordpress blogging and scripting knowledge. You can read more about me at About us page. Thank You :)

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *