説明†サーバーのあるプロセスが死んだ(プロセス数が0)になったら、mackerelで通知させたい場合の手順です。 パターン1(グラフ設定なし、公式サイト記載あり)†http://help-ja.mackerel.io/entry/howto/check/process
# yum install mackerel-check-plugins # cd /etc/mackerel-egent/ # cp -p mackerel-agent.conf mackerel-agent.conf.`date +%Y%m%d` # vi mackerel-agent.conf ---以下追記 [plugin.checks.check_cron] command = "/usr/local/bin/check-procs --pattern crond" --- # /etc/init.d/mackerel-agent restart パターン2(グラフ設定あり)†# cd /etc/mackerel-agent # vim process.count.httpd.sh --- #!/bin/bash name="process.count.httpd" monitor_time=`date +%s` count=`ps aux | grep httpd | grep -v grep | wc -l` echo -e "${name}\t${count}\t${monitor_time}" --- # vim mackerel-agent.conf ---以下を追記 [plugin.metrics.httpd-procs] command = "/etc/mackerel-agent/process.count.httpd.sh" # /etc/init.d mackerel-agent restart
|