MRTG, SNMP をインストール------------------------------------------------------[root@falcon21 ~]# yum -y install net-snmp net-snmp-utils mrtg[root@falcon21 ~]# vi /etc/snmp/snmpd.conf41 #com2sec notConfigUser default public42 com2sec local localhost private42 com2sec mynetwork 192.168.2.0/24 public50 #group notConfigGroup v2c notConfigUser51 group MyROGroup v1 local52 group MyROGroup v2c local53 group MyROGroup v1 mynetwork54 group MyROGroup v2c mynetwork61 #view systemview included .1.3.6.1.2.1.25.1.1 62 view all included .1 8068 #access notConfigGroup "" any noauth exact systemview none none69 access MyROGroup "" any noauth exact all none non70 access MyRWGroup "" any noauth exact all all none201 # processes running on the host. The syntax looks something like:202 proc httpd //httpd プロセス表示 331 disk / 10000***************************************[root@falcon21 ~]# cfgmaker --ifref=descr --ifdesc=descr public@192.168.2.103 > /etc/mrtg/mrtg.cfg[root@falcon21 ~]# vi /etc/mrtg/mrtg.cfg# Created by# /usr/bin/cfgmaker --ifref=descr --ifdesc=descr public@192.168.2.103### Global Config Options# for UNIX# WorkDir: /home/http/mrtg WorkDir: /var/www/mrtg# or for NT# WorkDir: c:\mrtgdata### Global Defaults# to get bits instead of bytes and graphs growing to the right# Options[_]: growright, bits Options[_]: growright, noinfo EnableIPv6: no Language:eucjp####################################################################### System: falcon21.space# Description: Linux falcon21.space 2.6.32-696.1.1.el6.i686#1 SMP Tue Apr 11 16:37:48 UTC 2017 i686# Contact: Root <root@localhost> (configure /etc/snmp/snmp.local.conf)# Location: Unknown (edit /etc/snmp/snmpd.conf)######################################################################### Interface 1 >> Descr: 'lo' | Name: 'lo' | Ip: '127.0.0.1' | Eth: ''### ### The following interface is commented out because:### * it is a Software Loopback interface## Target[192.168.2.103_lo]: \lo:public@192.168.2.103:# SetEnv[192.168.2.103_lo]: MRTG_INT_IP="127.0.0.1" MRTG_INT_DESCR="lo"# MaxBytes[192.168.2.103_lo]: 1250000# Title[192.168.2.103_lo]: lo -- falcon21.space# PageTop[192.168.2.103_lo]: <h1>lo -- falcon21.space</h1># <div id="sysdetails"># <table># <tr># <td>System:</td># <td>falcon21.space in Unknown (edit /etc/snmp/snmpd.conf)</td># </tr># <tr># <td>Maintainer:</td># <td>Root <root@localhost> (configure /etc/snmp/snmp.local.conf)</td># </tr># <tr># <td>Description:</td># <td>lo </td># </tr># <tr># <td>ifType:</td># <td>softwareLoopback (24)</td># </tr># <tr># <td>ifName:</td># <td>lo</td># </tr># <tr># <td>Max Speed:</td># <td>1250.0 kBytes/s</td># </tr># <tr># <td>Ip:</td># <td>127.0.0.1 (localhost.localdomain)</td># </tr># </table># </div>### Interface 2 >> Descr: 'eth0' | Name: 'eth0' | Ip: '192.168.2.103' | Eth: '00-1a-4d-9d-c6-9e' ###Target[eth0]: \eth0:public@192.168.2.103:SetEnv[eth0]: MRTG_INT_IP="192.168.2.103" MRTG_INT_DESCR="eth0"MaxBytes[eth0]: 12500000Title[eth0]: eth0トラフィックPageTop[eth0]: <h1>eth0トラフィック</h1>### CPU ロードアベレージ###Target[CPU]: .1.3.6.1.4.1.2021.10.1.5.1&.1.3.6.1.4.1.2021.10.1.5.2:private@localhostMaxBytes[CPU]: 100Unscaled[CPU]: dwmyOptions[CPU]: gauge, growright, nopercentYLegend[CPU]: Load AverageShortLegend[CPU]: (%)LegendI[CPU]: Load Average 1 minLegendO[CPU]: Load Average 5 minLegend1[CPU]: Load Average 1 minLegend2[CPU]: Load Average 5 minTitle[CPU]: CPU Load AveragePageTop[CPU]: <h1>CPU Load Average</h1>### 空きメモリ状況 ###Target[mem]: .1.3.6.1.4.1.2021.4.6.0&.1.3.6.1.4.1.2021.4.4.0:private@localhostMaxBytes1[Mem]: 3953792MaxBytes2[Mem]: 4095996Unscaled[Mem]: dwmyOptions[Mem]: gauge, growrightYLegend[Mem]: Mem Free(Bytes)ShortLegend[Mem]: Byteskilo[Mem]: 1024kMG[Mem]: k,M,G,T,PLegendI[Mem]: RealLegendO[Mem]: SwapLegend1[Mem]: MemoryFree [MBytes] Legend2[Mem]:Swap Free [MBytes]Title[Mem]: Memory Free PageTop[Mem]: <H1>Memory Free</H1>### ディスク空き状況 ###Target[disk]: .1.3.6.1.4.1.2021.9.1.9.1&.1.3.6.1.4.1.2021.9.1.9.1:private@localhostMaxBytes[Disk]: 51478268kMG[Disk]: k,M,G,T,PUnscaled[Disk]: dwmyOptions[Disk]: gauge, absolute, growright, nopercentYLegend[Disk]: Disk Free(Bytes)ShortLegend[Disk]: BytesLegendI[Disk]: / Disk Free [Bytes]LegendO[Disk]:Legend1[Disk]: / Disk Free [Bytes]Legend2[Disk]: Title[Disk]: DiskFree PageTop[Disk]: <H1>Disk Free</H1>### httpd のプロセス数 ###Target[httpd]: .1.3.6.1.4.1.2021.2.1.5.1&.1.3.6.1.4.1.2021.2.1.4.1:private@localhostMaxBytes[httpd]: 50Unscaled[httpd]: dwmyOptions[httpd]: gauge, growright, nopercentYLegend[httpd]: CountShortLegend[httpd]: proc(s).Title[httpd]: Httpd ProcessesLegendI[httpd]: Processes LegendO[httpd]:Legend1[httpd]: Httpd ProcessesLegend2[httpd]: PageTop[httpd]: <h1>Httpd Processes</h1>****************************[root@falcon21 ~]# mrtg[root@falcon21 ~]# mrtg[root@falcon21 ~]# mrtg--------------設定ファイルの文字コードをEUCに変換[root@falcon21 ~]# cp /etc/mrtg/mrtg.cfg /etc/mrtg/mrtg.cfg.org[root@falcon21 ~]# nkf -e /etc/mrtg/mrtg.cfg.org > /etc/mrtg/mrtg.cfg---------------MRTG起動スクリプト作成[root@falcon21 ~]# vi mrtg.sh#!/bin/bashLOCK=/var/lock/mrtg/mrtg_lCONFCACHE=/var/lib/mrtg/mrtg.okexport LANG=ja_JP.eucJPmrtg /etc/mrtg/mrtg.cfg --lock-file$LOCK --confcache-file $CONFCACHE[root@falcon21 ~]# chmod 755 mrtg.shMRTGスクリプト起動[root@falcon21 ~]# ./mrtg.sh[root@falcon21 ~]# ./mrtg.sh[root@falcon21 ~]# ./mrtg.sh[root@falcon21 ~]# vi /etc/httpd/conf.d/mrtg.confAlias /mrtg /var/www/mrtg<Location /mrtg>Order deny,allowDeny from allAllow from 127.0.0.1Allow from 192.168Allow from ::1# Allow from .example.com </Location>----------------MRTG定期自動起動設定[root@falcon21 ~]# vi /etc/cron.d/mrtg# */5 * * * * root /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok*/5 * * * * root /root/mrtg.sh[root@falcon21 ~]# /etc/rc.d/init.d/crond restart---------------MRTGインデックスページ作成[root@falcon21 ~]# indexmaker --columns=1 \ > --addhead="<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=euc-jp\">" \ > /etc/mrtg/mrtg.cfg > /var/www/mrtg/index.htmlMRTGインデックスページ編集[root@falcon21 ~]# vi /var/www/mrtg/index.html<!-- <meta http-equiv="content-type" content="text/html; charset=iso-8859-15" > --> ← コメントアウト[root@falcon21 ~]# /etc/init.d/httpd restart*******************************************http://falcon21.space/mrtg/
投票数:2
平均点:10.00