munin-node-configureコマンドを覚えた

munin-node-configureコマンドで便利な使い方

結構/usr/share/munin/plugins/*の中のプラグインで使えるやつって意外と少ないですよね。
例えばapache関連だとserver_statusが有効になってなかったりとか

私も昔よく引っかかってました。

いろいろいじってそのプラグインが使えるかどうかを
シェルやperlで実行してちゃんと出力があるか確認して/etc/munin/pluginsに置いて
グラフが生成されるか確認という手間のかかることをしていました

それをmunin-node-configureがすべて解決してくれます。

/usr/share/munin/plugins/*にあるスクリプトが動くかどうか確認する方法は以下の通りにやってください


 # munin-node-configure -suggest
Plugin | Used | Suggestions

acpi | no | no [cannot read /proc/acpi/thermal_zone/*/temperature]
amavis | no | no
apache_accesses | yes | no [ExtendedStatus option for apache mod_status is missing on port 80]
apache_accesses.orig | no | no [Port 80: Can't connect to :127.0.0.180:80 (Bad hostname ':127.0.0.180')]
apache_processes | yes | no [ExtendedStatus option for apache mod_status is missing on port 80]
apache_processes.orig | no | no [Port 80: Can't connect to 127.0.0.1:80 (connect: Connection refused)]
apache_volume | yes | no [ExtendedStatus option for apache mod_status is missing on port 80]
apache_volume.orig | no | no [Port 80: Can't connect to 127.0.0.1:80 (connect: Connection refused)]
apc_envunit_ | no | no [no units to monitor]
bonding_err_ | no | no [No /proc/net/bonding]
courier_mta_mailqueue | no | no [spooldir not found]
courier_mta_mailstats | no | no [could not find executable]
courier_mta_mailvolume | no | no [could not find executable]
cps_ | no | no
cpu | yes | yes
cpuspeed | no | no [missing /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state]
cupsys_pages | no | no [logfile not found]
df | yes | yes
df_inode | yes | yes
diskstats | yes | yes
entropy | yes | yes
exim_mailqueue | no | no [no exiqgrep]
exim_mailstats | no | no ['/usr/sbin/exim -bP log_file_path' returned an error]
fail2ban | no | no [/usr/bin/fail2ban-client not found]
forks | yes | yes
fw_conntrack | no | no
fw_forwarded_local | no | no [/proc/net/ip_conntrack missing or not readable]
fw_packets | yes | yes
hddtemp_smartctl | no | no [first drive not supported, configure the plugin]
http_loadtime | yes | yes
if_ | yes | yes (eth0)
if_err_ | yes | yes (eth0)
interrupts | yes | yes
iostat | yes | yes
iostat_ios | yes | yes
ip_ | no | no [could not run iptables as user munin]
ipmi_ | no | no [no /usr/bin/ipmitool]
irqstats | yes | yes
jmx_ | no | no [java runtime not found at /usr/bin/java]
load | yes | yes
lpstat | no | no [scheduler is not running]
memory | yes | yes
mongostat | no | no
mongostat2 | yes | no
munin_stats | yes | yes
mysql_ | yes | no [Missing dependency Cache::Cache]
netstat | yes | yes
nfs4_client | no | no [no /proc/net/rpc/nfs]
nfs_client | no | no
nfsd | no | no [no /proc/net/rpc/nfsd]
nfsd4 | no | no [no /proc/net/rpc/nfsd]
nginx_request | no | no [no nginx status on http://test.com/nginx_status]
nginx_status | no | no [no nginx status on http://localhost/nginx_status]
ntp_kernel_err | yes | yes
ntp_kernel_pll_freq | yes | yes
ntp_kernel_pll_off | yes | yes
ntp_offset | yes | yes
nvidia_ | no | no [no nvclock executable at /usr/bin/nvclock, please configure]
open_files | yes | yes
open_inodes | yes | yes
postfix_mailqueue | no | yes
postfix_mailvolume | no | yes
postgres_bgwriter | no | no [DBD::Pg not found, and cannot do psql yet]
postgres_cache_ | no | no [DBD::Pg not found, and cannot do psql yet]
postgres_checkpoints | no | no [DBD::Pg not found, and cannot do psql yet]
postgres_connections_ | no | no [DBD::Pg not found, and cannot do psql yet]
postgres_connections_db | no | no [DBD::Pg not found, and cannot do psql yet]
postgres_locks_ | no | no [DBD::Pg not found, and cannot do psql yet]
postgres_querylength_ | no | no [DBD::Pg not found, and cannot do psql yet]
postgres_scans_ | no | no [DBD::Pg not found, and cannot do psql yet]
postgres_size_ | no | no [DBD::Pg not found, and cannot do psql yet]
postgres_transactions_ | no | no [DBD::Pg not found, and cannot do psql yet]
postgres_tuples_ | no | no [DBD::Pg not found, and cannot do psql yet]
postgres_users | no | no [DBD::Pg not found, and cannot do psql yet]
postgres_xlog | no | no [DBD::Pg not found, and cannot do psql yet]
proc_pri | yes | yes
processes | yes | yes
ps_ | yes | no
qmailqstat | no | no
selinux_avcstat | no | no [missing /selinux/avc/cache_stats file]
sendmail_mailqueue | yes | yes
sendmail_mailstats | yes | yes
sendmail_mailtraffic | yes | yes
slapd_ | no | no [Needs LDAPv3]
slapd_bdb_cache_ | no | no [Can't execute db_stat file '/usr/bin/db4.6_stat']
slony_lag_ | no | no [DBD::Pg not found, and cannot do psql yet]
smart_ | no | no [no drives accessible]
snort_alerts | no | no [/var/snort/snort.stats not readable]
snort_bytes_pkt | no | no [/var/snort/snort.stats not readable]
snort_drop_rate | no | no [/var/snort/snort.stats not readable]
snort_pattern_match | no | no [/var/snort/snort.stats not readable]
snort_pkts | no | no [/var/snort/snort.stats not readable]
snort_traffic | no | no [/var/snort/snort.stats not readable]
squeezebox_ | no | no [no connection on localhost port 9090]
squid_cache | no | no [could not connect: Connection refused]
squid_objectsize | no | no [could not connect: Connection refused]
squid_requests | no | no [could not connect: Connection refused]
squid_traffic | no | no [could not connect: Connection refused]
swap | yes | yes
threads | yes | yes
tomcat_ | no | no
uptime | yes | yes
users | yes | yes
varnish_ | no | no [which varnishstat returns blank]
vmstat | yes | yes
vserver_cpu_ | no | no [/proc/virtual/info not found]
vserver_loadavg | no | no [/proc/virtual/info not found]
vserver_resources | no | no [/proc/virtual/info not found]
yum | yes | yes
zimbra_ | no | no [No Text::CSV_XS]
# The following plugins caused errors:
# mongostat:
# Timed out during autoconf
# mongostat2:
# Timed out during autoconf

これだけ見てもらえばある程度わかると思いますが
結構noが多いです。

デフォルトで入っているスクリプトでもこれだけ使えません
左から
プラグイン名、使用しているか、使えるか、詳細
という順に出力されます。

例えばNginxはstatusがonになっていないのでその詳細が出ています

nginx_status               | no   | no [no nginx status on http://localhost/nginx_status]


使用できるものがわかったところで、それをすべてlnコマンドで
シンボリックリンクを貼るのは数が多いとめんどくさいですね
そんなときに -shell オプションが便利です

私の環境で実行すると下記のようになります


# munin-node-configure -shell
ln -s '/usr/share/munin/plugins/postfix_mailqueue' '/etc/munin/plugins/postfix_mailqueue'
ln -s '/usr/share/munin/plugins/postfix_mailvolume' '/etc/munin/plugins/postfix_mailvolume'
# The following plugins caused errors:
# mongostat:
# Timed out during autoconf
# mongostat2:
# Timed out during autoconf

postfixプラグインが使用できるのに追加されていないようです。
コマンドをそのまま出力してくれるのでパイプでつないでshを実行すれば
自動でシンボリックリンクを貼ってくれます

# munin-node-configure -shell | sh

こんな感じですね。
これだとlnコマンドを実行してくれるだけなのでコマンドを実行しても何も出力されません
なので最後にmunin-node-configureをオプションなしで実行します


今回はpostfixだけだったのでpostfixgrepをかけて有効になっているか確認します

# munin-node-configure |grep postfix
postfix_mailqueue | yes |
postfix_mailstats | no |
postfix_mailvolume | yes |

真ん中のはコマンドが実行されていないのでnoで問題ありません。
他の2つは-shellで有効にできるものだったので|shで有効にできたことがわかりました。

便利ですねこれ

キャパシティプランニング ― リソースを最大限に活かすサイト分析・予測・配置

キャパシティプランニング ― リソースを最大限に活かすサイト分析・予測・配置