Apache & Nginx: Monitoring Apache & Nginx with OpsDash

Quick Start

1. Install the OpsDash Smart Agent on the Apache or Nginx server that you wish to monitor. If you need instructions for how to do this, here they are: Debian/Ubuntu, CentOS/RHEL, Generic.

2. Edit the OpsDash Smart Agent configuration file at /etc/opsdash/agent.cfg and add a new service:

# choose a good, unique name for the service (here my-apache-1 is used)
service "my-apache-1" {
type = "apache"
logs = "/var/log/httpd/access_log, /var/log/apache2/*access.log"
# choose a good, unique name for the service (here my-nginx-1 is used)
service "my-nginx-1" {
type = "nginx"
logs = "/var/log/nginx/access.log, /var/log/nginx/my-vhosts-*.log"

The value of "logs" is a comma-separated list of paths to access logs (in the "combined" log format). Shell-like wildcards are allowed.

3. Reload the OpsDash Smart Agent so that it picks up the new configuration:

sudo service opsdash-agent reload

4. You should see the service my-apache-1 appear under https://app.opsdash.com/sources within a minute or so, if there is active traffic. Clicking on it should take you to the dashboard at https://app.opsdash.com/source/my-apache-1. If it does not, check the agent log file at /var/log/opsdash/agent.log.

Periods of no traffic

If there are periods of no traffic to the Apache/Nginx server, the service is appear as down. If such periods are expected, you can ask OpsDash to ignore if this service goes "down" and not to raise alerts. To do this, go to the Notifications page and enter the name of the service in the "do not check if it is down" text box, like this:

File Permissions

The OpsDash Smart Agent runs as the user "opsdash" by default. The user "opsdash" is also added as a member of the "adm" group on Debian-based systems. This user must be able to read the log files specified in the configuration. Depending on the version of Apache/Nginx and the distro that you're using, you may need to explicitly set the permissions on the directories and/or log files.