Datadog made Apache monitoring simple, all we need to do is agent installation and some basic configuration. It enables us to monitor host status, Apache instance status, CPU and Disc space utilization and even other metrics like requests served per second, total number of connections performed etc.
Here are the detailed instructions to configure Datadog for Apache monitoring.
Prerequisites :
-
- Sudo access
- Read access to dd-agent user (to access Apache logs)
- Open firewalls between Datadog and your Apache hosts.
- Install Datadog agent on all your hosts.
Sudo DD_AGENT_MAJOR_VERSION=7 DD_API_KEY=xxxxx DD_HOST_TAGS=’env:Dev,svc:service,bu:BusinessUnit,app:ApplicationName,region:XXX,availability-zone:xxx,emailID’ bash -c “$(curl -L https://s3.amazonaws.com/dd-agent/scripts/install_script.sh)”
- Install mod_status on Apache servers and enable ExtendedStatus.
Backup ‘httpd.conf’ file and update it for each Apache instance.
Uncomment “LoadModule status_module modules/mod_status.so” and add below lines..
<Location /server-status>
SetHandler server-status
Allow from *.datadoghq.com
</Location>
ExtendedStatus On
- Restart Apache instance
- Add Apache instances in the yaml file and restart agent.
vi /etc/datadog-agent/conf.d/apache.d/conf.yaml
instances:
– apache_status_url: http://host:port/server-status?auto
service: apache_instance_name
– apache_status_url: http://host:port/server-status?auto
service: apache_instance_name
- Restart agent and verify status
sudo restart datadog-agent
sudo datadog-agent status
- Configure log files to monitor and restart agent
vi /etc/datadog-agent/datadog.yaml
logs_enabled: true
vi /etc/datadog-agent/conf.d/apache.d/conf.yaml
logs:
– type: file
path: /var/log/apache2/access.log
source: apache
service: apache
– type: file
path: /var/log/apache2/error.log
source: apache
service: apache
- Create Dashboards, Monitors.
(will share detailed instructions on how to create monitors and dashboards in my next blog. See below screenshots to find these options and how do dashboards and monitors look like.).