In this post, We will configure and integrate Apache2 web server monitoring metrics with Telegraf on ubuntu 18.04 LTS
I believe you have already installed and configure prometheus ,Telegraf and MongoDB on your machine if not so then go through the given url to setup prometheus with telegraf on your machine.
Apache2 is free and opensource HTTP Server, casually called Apache, is a free and open-source cross-stage web worker programming, delivered under the terms of Apache License 2.0. Apache is created and kept up by an open local area of engineers under the support of the Apache Software Foundation.
By default telegraf we have got the telegraf.d directory on /etc/telegraf/telegraf.d in this path, You need to create a apache2.conf configuration file and add the following mongodb plugin syntax by following the given command.
sudo vim /etc/telegraf/telegraf.d/apache2.conf
Paste the given code to enable the Apache2 plugin in telegraf.
# Read Apache status information (mod_status)
## An array of URLs to gather from, must be directed at the machine
## readable version of the mod_status page including the auto query string.
## Default is "http://localhost/server-status?auto".
urls = ["http://localhost/server-status?auto"]
## Credentials for basic HTTP authentication.
# username = "myuser"
# password = "mypassword"
## Maximum time to receive response.
# response_timeout = "5s"
## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
## Use TLS but skip chain & host verification
# insecure_skip_verify = false
Here you can uncomments the other parameter to use the username and password for Apache2 monitoring user as per your requirement, Save and exit from the vim text editor.
You need to restart the Telegraf service to get new changes for Apache2 metric in prometheus, Use the following command for the same.
sudo systemctl restart telegraf
We have successfully integrate Apache with Telegraf in our Ubuntu 18.04 server.