서버 모니터링 도구 Munin

Munin



Munin은 Perl로 작성된 리소스 모니터링 도구입니다. RRDtool로 그래프를 작성하고 있습니다.

버전 정보



안정 버전은 2017-10-21 릴리스의 2.0.34이며 EPEL 저장소에서 제공됩니다.
최신 평가판은 2017-01-21 릴리스의 2.99.3이 된다.
CentOS에서는 EPEL 리포지토리에 2.0.33을 설치할 수 있습니다.

기원





Munin은 무닌으로 발음하고 북유럽 신화의 신 오딘에 동반하는 한 쌍의 와타리 유리의 "기억"를 의미하는 한쪽. 두 날은 새벽에 밖으로 나와 정보를 모은 후 밤에 돌아와 오딘의 귀에 뉴스를 속삭인다고 한다. 1 자원 감시 툴로서 좀처럼 센스가 좋은 네이밍.
그래서 로고의 이미지는 까마귀였다.

Munin node (client)



설치


yum install epel-release
yum install munin-node

EPEL 리포지토리에서 제공되는 패키지는 최신 안정 버전의 2.0.25가 된다.

플러그인



확인


munin-node-configure --suggest

출력 예
Plugin                     | Used | Suggestions
------                     | ---- | -----------
acpi                       | no   | no [cannot read []
amavis                     | no   | no
apache_accesses            | no   | no [apache server-status not found. check if mod_status is enabled]
apache_processes           | no   | no [apache server-status not found. check if mod_status is enabled]
apache_volume              | no   | no [apache server-status not found. check if mod_status is enabled]
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 [could not find logdir]
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
fw_packets                 | yes  | yes
hddtemp_smartctl           | no   | no
http_loadtime              | no   | no
if_                        | yes  | yes (enp0s3 enp0s8)
if_err_                    | yes  | yes (enp0s3 enp0s8)
interrupts                 | yes  | yes
ip_                        | no   | no [could not run iptables as user nobody]
ipmi_                      | no   | no [missing ipmitool command]
irqstats                   | yes  | yes
load                       | yes  | yes
lpstat                     | no   | no [lpstat not found]
memory                     | yes  | yes
munin_stats                | no   | yes
mysql_                     | no   | no
netstat                    | no   | no [netstat program not found]
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://localhost/nginx_status]
nginx_status               | no   | no [no nginx status on http://localhost/nginx_status]
ntp_kernel_err             | no   | no
ntp_kernel_pll_freq        | no   | no
ntp_kernel_pll_off         | no   | no
ntp_offset                 | no   | no [no ntpq program]
ntp_states                 | no   | no [ntpq not found]
nvidia_                    | no   | no [no nvclock executable at /usr/bin/nvclock, please configure]
open_files                 | yes  | yes
open_inodes                | yes  | yes
pgbouncer_connections      | no   | no
pgbouncer_requests         | no   | no
postfix_mailqueue          | yes  | yes
postfix_mailvolume         | yes  | yes
postgres_autovacuum        | no   | no
postgres_bgwriter          | no   | no
postgres_cache_            | no   | no
postgres_checkpoints       | no   | no
postgres_connections_      | no   | no
postgres_connections_db    | no   | no
postgres_locks_            | no   | no
postgres_oldest_prepared_xact_ | no   | no
postgres_prepared_xacts_   | no   | no
postgres_querylength_      | no   | no
postgres_scans_            | no   | no
postgres_size_             | no   | no
postgres_transactions_     | no   | no
postgres_tuples_           | no   | no
postgres_users             | no   | no
postgres_xlog              | no   | no
proc                       | no   | no
proc_pri                   | yes  | yes
processes                  | yes  | yes
ps_                        | no   | no
qmailqstat                 | no   | no
selinux_avcstat            | no   | no [missing /selinux/avc/cache_stats file]
sendmail_mailqueue         | no   | no
sendmail_mailstats         | no   | no [no mailstats command]
sendmail_mailtraffic       | no   | no [no mailstats command]
slapd_                     | no   | no [Net::LDAP not found]
slapd_bdb_cache_           | no   | no [Can't execute db_stat file '/usr/bin/db4.6_stat']
slony_lag_                 | no   | no
smart_                     | no   | no [smartmontools not found]
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
uptime                     | yes  | yes
users                      | yes  | yes
varnish_                   | no   | no [varnishstat could not be found]
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                        | no   | no [Could not find statefile.  Please read 'munindoc yum']

Apache Status 사용


cat << _EOF_ > /etc/httpd/conf.d/server-status.conf
<Location "/server-status">
    SetHandler server-status
    Require host localhost
</Location>
_EOF_
systemctl restart httpd

Apache를 모니터링하려면 server-status를 활성화해야 합니다.ExtendedStatus는 Apache 2.3.6부터 mod_status 모듈이로드 될 때 기본적으로 On로 전환됩니다.

추가


munin-node-configure -shell | sh

자동 시작 설정 및 시작


systemctl enable munin-node
systemctl start munin-node

Munin master (server)



설치


yum install httpd munin

설정 조정


chown apache:munin /var/log/munin

나중에 Apache를 설치하면 확대 그래프를 볼 수 없으므로 로그 디렉토리의 소유자를 변경합니다.

성능 개선



cron 처리 분할


sed -i '/munin-cron/s/^/#/' /etc/cron.d/munin
cat << _EOF_ >> /etc/cron.d/munin
*/5 * * * *     munin test -x /usr/bin/munin-cron && /usr/share/munin/munin-update
5 */1 * * *     munin test -x /usr/bin/munin-cron && /usr/share/munin/munin-graph --cron
10 07 * * *     munin test -x /usr/bin/munin-cron && /usr/share/munin/munin-html
_EOF_

그래프 재생성을 5분 간격에서 1시간 간격으로, HTML 재생성을 5분 간격에서 1일 간격으로 변경하여 성능을 향상시킵니다.
최신 그래프가 보고 싶은 경우는 그래프를 클릭하여 확대 그래프를 확인하면 된다.

불필요한 플러그인 제거


unlink /etc/munin/plugins/entropy
unlink /etc/munin/plugins/interrupts
unlink /etc/munin/plugins/irqstats

별로 보이지 않는 그래프는 제외하는 것이 부하가 가벼워진다.

자동 시작 설정 및 시작


systemctl enable httpd
systemctl start httpd

BASIC 인증


htpasswd /etc/munin/munin-htpasswd <username>

기본 화면 예





템플릿



Munstrap


curl -L https://github.com/jonnymccullagh/munstrap/archive/master.tar.gz -o munstrap.tar.gz
mkdir /etc/munin/munstrap
tar vzxf munstrap.tar.gz --strip=1 -C /etc/munin/munstrap
sed -i /etc/munin/munin.conf -e '/^tmpldir/s/^/#/' -e '/^staticdir/s/^/#/'
sed -i '/#tmpldir/a tmpldir /etc/munin/munstrap/templates' /etc/munin/munin.conf
sed -i '/#staticdir/a staticdir /etc/munin/munstrap/static' /etc/munin/munin.conf



카테고리가 탭화되기도 하고 약간이지만 깔끔하다.

munin_dynamic_template


curl -L https://github.com/DaveMDS/munin_dynamic_template/archive/master.tar.gz -o munin_dynamic_template.tar.gz
mkdir /etc/munin/munin_dynamic_template
tar vzxf munin_dynamic_template.tar.gz --strip=1 --exclude="munin1" -C /etc/munin/munin_dynamic_template
sed -i /etc/munin/munin.conf -e '/^tmpldir/s/^/#/' -e '/^staticdir/s/^/#/'
sed -i '/#tmpldir/a tmpldir /etc/munin/munin_dynamic_template/munin2' /etc/munin/munin.conf
sed -i '/#staticdir/a staticdir /etc/munin/munin_dynamic_template/munin2/static' /etc/munin/munin.conf





modern-munin


curl -L https://github.com/sjoudry/modern-munin/archive/master.tar.gz -o modern-munin.tar.gz
mkdir /etc/munin/modern-munin
tar vzxf modern-munin.tar.gz --strip=1 -C /etc/munin/modern-munin
sed -i /etc/munin/munin.conf -e '/^tmpldir/s/^/#/' -e '/^staticdir/s/^/#/'
sed -i '/#tmpldir/a tmpldir /etc/munin/modern-munin' /etc/munin/munin.conf
sed -i '/#staticdir/a staticdir /etc/munin/modern-munin/static' /etc/munin/munin.conf

munin-b3


curl -L https://code.not-your-server.de/munin-b3.git/tags/0.3.2.tar.gz -o munin-b3.tar.gz
mkdir /etc/munin/munin-b3
tar vzxf munin-b3.tar.gz --strip=1 -C /etc/munin/munin-b3
sed -i /etc/munin/munin.conf -e '/^tmpldir/s/^/#/' -e '/^staticdir/s/^/#/'
sed -i '/#tmpldir/a tmpldir /etc/munin/munin-b3/templates' /etc/munin/munin.conf
sed -i '/#staticdir/a staticdir /etc/munin/munin-b3/static' /etc/munin/munin.conf





Munin JQuery Template


curl -L https://github.com/mallocator/Munin-JQuery-Template/archive/master.tar.gz -o munin-jquery-template.tar.gz
mkdir /etc/munin/munin-jquery-template
tar vzxf munin-jquery-template.tar.gz --strip=1 -C /etc/munin/munin-jquery-template
sed -i /etc/munin/munin.conf -e '/^tmpldir/s/^/#/' -e '/^staticdir/s/^/#/'
sed -i '/#tmpldir/a tmpldir /etc/munin/munin-jquery-template/templates' /etc/munin/munin.conf
ln -s /etc/munin/munin-jquery-template/templates/assets /var/www/html/munin/
ln -s /etc/munin/munin-jquery-template/templates/style.css /var/www/html/munin/


드래그 앤 드롭을 할 수 있거나 시도로는 재미 있지만, 설정과 사용이 다소 유감.
확대 그래프는 링크되어 있지 않은 모양.

모니터링 관련 기사


  • 서버 모니터링 도구 Munin
  • 서버 모니터링 도구 Xymon
  • 서버 모니터링 도구 Zabbix



  • htps : // 그럼.ぃきぺぢ아. 오 rg/우키/%에 3% 83% 95% 에 3% 82% 에 에% 3% 83% B3% 에 3% 81% 3% 83% B3 

    좋은 웹페이지 즐겨찾기