How to configure and integrate Apache with Telegraf on ubuntu 18.04 LTS - TechBeginner

Welcome to TechBeginner.in, Tech Beginner provides technical blog for Online Linux Tutorials, Ubuntu Tutorials, Redhat Tutorials and CentOS 7, Configuration of server like Web Server, Application server, Database server, Window server, networking, html, css, java script, php, wordpress, opencart, magento, joomla and etc.

How to configure and integrate Apache with Telegraf on ubuntu 18.04 LTS

Share This


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.

 
https://www.techbeginner.in/2020/12/how-to-install-prometheus-on-ubuntu.html
https://www.techbeginner.in/2021/01/how-to-install-telegraf-on-ubuntu-1804.html
https://www.techbeginner.in/2019/12/how-to-install-apache2-using-ubuntu-1604.html

 

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. 


Step 1: Enable Apache2 Plugin in Telegraf


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)
[[inputs.apache]]
  ## 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.


Step 2: Restart the Telegraf


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


Conclusion

We have successfully integrate Apache with Telegraf in our Ubuntu 18.04 server.

No comments:

Post a Comment