Tools: Essential Guide: Setup Apache Exporter on Centos

Tools: Essential Guide: Setup Apache Exporter on Centos

Download binary terbaru

Menambahkan user

Membuat folder config

Buat service

Reload dan restart service

Konfigurasi Apache

Restart Apache

Konfigurasi Firewall

Uji Coba Pada postingan ini kita akan membahas cara untuk install apache_exporteruntuk memonitoring web server. Dengan itu monitoring Apache menjadi jauh lebih mudah dengan Apache Exporter, yang dapat diintegrasikan dengan Prometheus untuk mendapatkan metrics secara real-time. Berikut langkah-langkah instalasi dan konfigurasi di CentOS 7. https://github.com/Lusitaniae/apache_exporter/releases/latest Jika Require all granted aktif, maka endpoint bisa diakses dari mana saja. untuk uji coba cukup akses metrics dari web browser

http://{ip_server}:9117

nanti akan muncul kondisi server kita, tinggal di kombinasikan dengan prometheus. selamat mencoba, semoga bermanfaat. Templates let you quickly answer FAQs or store snippets for re-use. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse

Code Block

Copy

https://github.com/Lusitaniae/apache_exporter/releases/download/v{VERSI}/apache_exporter-{VERSI}.linux-amd64.tar.gz https://github.com/Lusitaniae/apache_exporter/releases/download/v{VERSI}/apache_exporter-{VERSI}.linux-amd64.tar.gz https://github.com/Lusitaniae/apache_exporter/releases/download/v{VERSI}/apache_exporter-{VERSI}.linux-amd64.tar.gz wget https://github.com/Lusitaniae/apache_exporter/releases/download/v1.0.12/apache_exporter-1.0.12.linux-amd64.tar.gz tar -xzf apache_exporter-1.0.12.linux-amd64.tar.gz cd apache_exporter-1.0.12.linux-amd64 cp apache_exporter /usr/sbin/ wget https://github.com/Lusitaniae/apache_exporter/releases/download/v1.0.12/apache_exporter-1.0.12.linux-amd64.tar.gz tar -xzf apache_exporter-1.0.12.linux-amd64.tar.gz cd apache_exporter-1.0.12.linux-amd64 cp apache_exporter /usr/sbin/ wget https://github.com/Lusitaniae/apache_exporter/releases/download/v1.0.12/apache_exporter-1.0.12.linux-amd64.tar.gz tar -xzf apache_exporter-1.0.12.linux-amd64.tar.gz cd apache_exporter-1.0.12.linux-amd64 cp apache_exporter /usr/sbin/ useradd apache_exporter -s /sbin/nologin useradd apache_exporter -s /sbin/nologin useradd apache_exporter -s /sbin/nologin mkdir -p /etc/sysconfig mkdir -p /etc/sysconfig mkdir -p /etc/sysconfig echo 'OPTIONS="--scrape_uri=http://{IP Server}/server-status/?auto"' | sudo tee /etc/sysconfig/apache_exporter echo 'OPTIONS="--scrape_uri=http://{IP Server}/server-status/?auto"' | sudo tee /etc/sysconfig/apache_exporter echo 'OPTIONS="--scrape_uri=http://{IP Server}/server-status/?auto"' | sudo tee /etc/sysconfig/apache_exporter nano /etc/systemd/system/apache_exporter.service nano /etc/systemd/system/apache_exporter.service nano /etc/systemd/system/apache_exporter.service [Unit] Description=Apache Exporter After=network.target httpd.service [Service] User=apache_exporter EnvironmentFile=/etc/sysconfig/apache_exporter ExecStart=/usr/sbin/apache_exporter $OPTIONS Restart=on-failure [Install] WantedBy=multi-user.target [Unit] Description=Apache Exporter After=network.target httpd.service [Service] User=apache_exporter EnvironmentFile=/etc/sysconfig/apache_exporter ExecStart=/usr/sbin/apache_exporter $OPTIONS Restart=on-failure [Install] WantedBy=multi-user.target [Unit] Description=Apache Exporter After=network.target httpd.service [Service] User=apache_exporter EnvironmentFile=/etc/sysconfig/apache_exporter ExecStart=/usr/sbin/apache_exporter $OPTIONS Restart=on-failure [Install] WantedBy=multi-user.target systemctl daemon-reload systemctl enable apache_exporter systemctl start apache_exporter systemctl daemon-reload systemctl enable apache_exporter systemctl start apache_exporter systemctl daemon-reload systemctl enable apache_exporter systemctl start apache_exporter /etc/httpd/conf.d/server-status.conf /etc/httpd/conf.d/server-status.conf /etc/httpd/conf.d/server-status.conf ExtendedStatus On <Location "/server-status"> SetHandler server-status Order deny,allow Allow from 10.10.1.0/24 127.0.0.1 # Require all granted </Location> ExtendedStatus On <Location "/server-status"> SetHandler server-status Order deny,allow Allow from 10.10.1.0/24 127.0.0.1 # Require all granted </Location> ExtendedStatus On <Location "/server-status"> SetHandler server-status Order deny,allow Allow from 10.10.1.0/24 127.0.0.1 # Require all granted </Location> systemctl restart httpd systemctl restart httpd systemctl restart httpd firewall-cmd --permanent --zone=public --add-port=9117/tcp firewall-cmd --permanent --zone=public --add-port=9117/tcp firewall-cmd --permanent --zone=public --add-port=9117/tcp firewall-cmd --reload firewall-cmd --reload firewall-cmd --reload