====== 02 Munin ======
Munin はシンプルなシステムの監視とパフォーマンスデータの可視化を提供するツールです。
===== インストール =====
==== epelインストール ====
dnf install epel-release
==== muninインストール ====
dnf install munin munin-node
==== 設定 ====
[localhost]
address 127.0.0.1
use_node_name yes
[Node1]
address 192.168.0.10
use_node_name yes
==== munin起動 ====
systemctl enable --now munin-node
==== munin-cron ====
このmunin-cronでデータを集めます。
*/5 * * * * munin /usr/bin/munin-cron
===== HTTP サーバーの設定 =====
dnf install httpd
systemctl enable --now httpd
Alias /munin /var/www/html/munin
Options None
Require all granted
systemctl restart httpd
===== 他のホストへの接続テスト =====
telnet 192.168.0.10 4949
# munin node at hogehoge.com
list
apache_accesses apache_processes apache_volume cpu df df_inode entropy forks fw_conntrack fw_forwarded_local fw_packets if_ens3 if_ens4 if_ens5 interrupts irqstats load memory open_files open_inodes postfix_mailqueue postfix_mailvolume proc_pri processes swap threads uptime users vmstat
fetch apache_accesses
accesses80.value 37929933
===== 監視設定 =====
SSL証明書の有効期限を監視、アラートを飛ばす
curl -L -o /usr/share/munin/plugins/ssl_certificate_expiry https://raw.githubusercontent.com/munin-monitoring/contrib/refs/heads/master/plugins/ssl/ssl-certificate-expiry
chmod +x /usr/share/munin/plugins/ssl_certificate_expiry
ln -s /usr/share/munin/plugins/ssl_certificate_expiry /etc/munin/plugins/ssl_certificate_expiry_www.fl8.jp
# cat /etc/munin/plugin-conf.d/munin-node
[ssl_certificate_expiry_*]
env.services www.fl8.jp
env.port 443
env.warning 14:
env.critical 7:
有効期限が14日以内になったら、Warning
有効期限が7日以内になったら、Critical
==== アラート通知設定 ====
アラートメール送信元: munin@fl8.jp
Cc: matsui@fl8.jp
To: matsui@flateight.com
# tail -1 /etc/munin/munin.conf
contact.mail.command mail -s "Munin Alert: [${var:group}]:${var:host} ${var:worst}" -r munin@fl8.jp -c matsui@fl8.jp matsui@flateight.com
{{tag>監視 Munin}}