Home General TopicsHow to Monitor Website URLs Using Nagios check_http Command ?

How to Monitor Website URLs Using Nagios check_http Command ?

by Bella

Monitoring a web server alone does not always guarantee that a website is functioning correctly. A service like Apache may appear online while the website itself displays errors, malicious content, or broken pages.

Nagios URL monitoring solves this issue by checking the actual webpage content instead of simply verifying whether the web service is running.

Nagios URL Monitoring Capabilities

Nagios provides advanced monitoring features for web services, including:

  • Complete monitoring of HTTP and HTTPS URLs
  • Full web transaction monitoring
  • Keyword-based webpage validation
  • Performance and availability tracking

Benefits of URL Monitoring with Nagios

Implementing URL monitoring helps administrators:

  • Improve server and application availability
  • Detect network outages quickly
  • Identify protocol or service failures
  • Monitor real user website experience
  • Track web server performance
  • Detect hacked or modified webpages

Monitoring a Website URL Using check_http

Nagios includes the check_http plugin, which allows monitoring of a specific webpage instead of just checking whether Apache is running.

This method is useful when:

  • A website is hacked or injected with malicious code
  • PHP or application errors occur
  • Pages return unexpected content

You can configure Nagios to verify whether a specific keyword exists on a webpage. If the keyword is missing, Nagios reports the service as failed.

Example Configuration

define service{
use urlmonitoring-service
host_name server.supportpro.com
service_description url_check
check_command check_http!-H supportpro.com -t 30 -R "Cpanel and WHM" -f follow
}

This configuration checks whether the phrase “Cpanel and WHM” exists on the webpage.
If the page fails to load or the keyword is missing, Nagios triggers an alert.

Monitoring HTTPS (SSL/TLS) URLs

For websites using SSL certificates, include the --ssl option:

define service{
use urlmonitoring-service
host_name server.supportpro.com
service_description url_check
check_command check_http!-H supportpro.com -t 30 -R "Cpanel and WHM" -f follow --ssl
}

Monitoring Password-Protected Pages

If a webpage is protected using HTTP authentication, credentials must be provided.

define service{
use urlmonitoring-service
host_name server.supportpro.com
service_description url_check_protected
check_command check_http!-H supportpro.com -a user:password -t 30 -R "Cpanel and WHM" -f follow --ssl
}

Replace user:password with valid authentication credentials.

Creating a Service Template

Ensure the monitoring template exists in your Nagios configuration:

define service{
name urlmonitoring-service
max_check_attempts 5
check_interval 15
retry_interval 2
check_period 24x7
notification_interval 30
notification_period 24x7
register 0
}

This template defines monitoring intervals, retry attempts, and notification settings.

Conclusion

Nagios URL monitoring provides deeper insight into website health by validating actual page content rather than only service availability. Using the check_http plugin helps quickly detect downtime, application errors, security issues, and performance problems.

If you require help, contact SupportPRO Server Admin

Partner with SupportPRO for 24/7 proactive cloud support that keeps your business secure, scalable, and ahead of the curve.

Contact Us today!
guy server checkup

You may also like

Leave a Comment