Install MRTG on Fedora
2007-08-28 09:45
423 查看
1. yum install net-snmp
2. vi /etc/snmp/snmpd.conf
view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.25.1.1
Change to
view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.2
view systemview included .1.3.6.1.2.1.25.1.1
Note: .1.3.6.1.2.1.1 = SNMPv2-MIB::system
.1.3.6.1.2.1.2 = IF-MIB::interfaces
Uncomment view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc //89th line
access notConfigGroup "" any noauth exact systemview none none //62th line
Change to
access notConfigGroup "" any noauth exact mib2 none none
3. chkconfig snmpd on
4. service snmpd start
5. yum install mrtg
6. Generate cfg file for mrtg
cfgmaker --global "WorkDir:/var/www/mrtg" --output /etc/mrtg/mrtg.cfg public@localhost
Notice: if just monitor a ip address, use public@192.168.0.1 replace public@localhost
7. Run mrtg /etc/mrtg/mrtg.cfg three times
8. vi /etc/cron.d/mrtg to run mrtg every 5 minutes
0-59/5 * * * * root /usr/bin/mrtg /etc/mrtg/mrtg.cfg --logging /var/log/mrtg.log
9. run following command to generate index file
#indexmaker /etc/mrtg/mrtg.cfg --output /var/www/mrtg/index.html
10. vi /etc/httpd/conf.d/mrtg.conf
Alias /mrtg /var/www/mrtg
<Location /mrtg>
Order deny,allow
# Deny from all
Allow from all
Allow from localhost
# Allow from .example.com
</Location>
11. restart httpd service
service httpd restart
12. Monitor network from browser. http://ec2-72-44-49-114.z-1.compute-1.amazonaws.com/mrtg/
―――――――――――――――――――――――――――――
Monitor CPU
To monitor CPU, we need install sysstat suite first.
yum –y install sysstat
1. Switch to super user
sudo -sH
2. Make a CPU script as bellows.
#!/bin/bash
cpuusr=`/usr/bin/sar -u 1 3 | grep Average | awk '{print $3}'`
cpusys=`/usr/bin/sar -u 1 3 | grep Average | awk '{print $5}'`
UPtime=`/usr/bin/uptime | awk '{print $3""$4""$5}'`
echo $cpuusr
echo $cpusys
echo $UPtime
hostname
3. Change the right to able to run it
chmod +755 /opt/mrtg/mrtg.cpu
4. Modify /etc/mrtg.cfg and add the following lines at the end of file
Target[cpu]: `/opt/mrtg/mrtg.cpu`
MaxBytes[cpu]: 100
Options[cpu]: gauge, nopercent, growright
YLegend[cpu]: CPU loading (%)
ShortLegend[cpu]: %
LegendO[cpu]: CPU us;
LegendI[cpu]: CPU sy;
Title[cpu]: CPU Loading
PageTop[cpu]: <H1>CPU Loading</H1>
5. Regenerate index page
indexmaker /etc/mrtg.cfg > /var/www/mrtg/index.html
Monitor Memory
1. Switch to super user
sudo -sH
2. Make a memory script as bellows.
#!/bin/bash
# run this script to check the mem usage.
totalmem=`/usr/bin/free |grep Mem |awk '{print $2}'`
usedmem=`/usr/bin/free |grep Mem |awk '{print $3}'`
UPtime=`/usr/bin/uptime | awk '{print $3""$4""$5}'`
echo $totalmem
echo $usedmem
echo $UPtime
hostname
3. Change the right to able to run it
chmod +755 /opt/mrtg/mrtg.ram
4. Modify /etc/mrtg.cfg and add the following lines at the end of file
Target[ram]: `/opt/mrtg/mrtg.ram`
#Unscaled[ram]: dwym
MaxBytes[ram]: 2048000
Title[ram]:Memory
ShortLegend[ram]: &
kmg[ram]:kB,MB
kilo[ram]:1024
YLegend[ram]: Memory Usage :
Legend1[ram]: Total Memory :
Legend2[ram]: Used Memory :
LegendI[ram]: Total Memory :
LegendO[ram]: Used Memory :
Options[ram]: growright,gauge,nopercent
PageTop[ram]:<H1>Memory</H1>
5. Regenerate index page
indexmaker /etc/mrtg.cfg > /var/www/mrtg/index.html
2. vi /etc/snmp/snmpd.conf
view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.25.1.1
Change to
view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.2
view systemview included .1.3.6.1.2.1.25.1.1
Note: .1.3.6.1.2.1.1 = SNMPv2-MIB::system
.1.3.6.1.2.1.2 = IF-MIB::interfaces
Uncomment view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc //89th line
access notConfigGroup "" any noauth exact systemview none none //62th line
Change to
access notConfigGroup "" any noauth exact mib2 none none
3. chkconfig snmpd on
4. service snmpd start
5. yum install mrtg
6. Generate cfg file for mrtg
cfgmaker --global "WorkDir:/var/www/mrtg" --output /etc/mrtg/mrtg.cfg public@localhost
Notice: if just monitor a ip address, use public@192.168.0.1 replace public@localhost
7. Run mrtg /etc/mrtg/mrtg.cfg three times
8. vi /etc/cron.d/mrtg to run mrtg every 5 minutes
0-59/5 * * * * root /usr/bin/mrtg /etc/mrtg/mrtg.cfg --logging /var/log/mrtg.log
9. run following command to generate index file
#indexmaker /etc/mrtg/mrtg.cfg --output /var/www/mrtg/index.html
10. vi /etc/httpd/conf.d/mrtg.conf
Alias /mrtg /var/www/mrtg
<Location /mrtg>
Order deny,allow
# Deny from all
Allow from all
Allow from localhost
# Allow from .example.com
</Location>
11. restart httpd service
service httpd restart
12. Monitor network from browser. http://ec2-72-44-49-114.z-1.compute-1.amazonaws.com/mrtg/
―――――――――――――――――――――――――――――
Monitor CPU
To monitor CPU, we need install sysstat suite first.
yum –y install sysstat
1. Switch to super user
sudo -sH
2. Make a CPU script as bellows.
#!/bin/bash
cpuusr=`/usr/bin/sar -u 1 3 | grep Average | awk '{print $3}'`
cpusys=`/usr/bin/sar -u 1 3 | grep Average | awk '{print $5}'`
UPtime=`/usr/bin/uptime | awk '{print $3""$4""$5}'`
echo $cpuusr
echo $cpusys
echo $UPtime
hostname
3. Change the right to able to run it
chmod +755 /opt/mrtg/mrtg.cpu
4. Modify /etc/mrtg.cfg and add the following lines at the end of file
Target[cpu]: `/opt/mrtg/mrtg.cpu`
MaxBytes[cpu]: 100
Options[cpu]: gauge, nopercent, growright
YLegend[cpu]: CPU loading (%)
ShortLegend[cpu]: %
LegendO[cpu]: CPU us;
LegendI[cpu]: CPU sy;
Title[cpu]: CPU Loading
PageTop[cpu]: <H1>CPU Loading</H1>
5. Regenerate index page
indexmaker /etc/mrtg.cfg > /var/www/mrtg/index.html
Monitor Memory
1. Switch to super user
sudo -sH
2. Make a memory script as bellows.
#!/bin/bash
# run this script to check the mem usage.
totalmem=`/usr/bin/free |grep Mem |awk '{print $2}'`
usedmem=`/usr/bin/free |grep Mem |awk '{print $3}'`
UPtime=`/usr/bin/uptime | awk '{print $3""$4""$5}'`
echo $totalmem
echo $usedmem
echo $UPtime
hostname
3. Change the right to able to run it
chmod +755 /opt/mrtg/mrtg.ram
4. Modify /etc/mrtg.cfg and add the following lines at the end of file
Target[ram]: `/opt/mrtg/mrtg.ram`
#Unscaled[ram]: dwym
MaxBytes[ram]: 2048000
Title[ram]:Memory
ShortLegend[ram]: &
kmg[ram]:kB,MB
kilo[ram]:1024
YLegend[ram]: Memory Usage :
Legend1[ram]: Total Memory :
Legend2[ram]: Used Memory :
LegendI[ram]: Total Memory :
LegendO[ram]: Used Memory :
Options[ram]: growright,gauge,nopercent
PageTop[ram]:<H1>Memory</H1>
5. Regenerate index page
indexmaker /etc/mrtg.cfg > /var/www/mrtg/index.html
相关文章推荐
- install xdebug on fedora
- (OK) Install Docker on Fedora 23
- How To Install Docker on Fedora 23
- How To Install Speedtest-cli On a CentOS / RHEL / Scientific / Fedora Linux To Check Internet Speed
- Install Eclipse SDK 4.2 (Juno) on Fedora
- Build and install gcc on FEDORA 14 X84_64
- install xdebug on fedora
- (OK) How To Install Wine 1.9.9 (Development Release) on CentOS, RHEL & Fedora
- 11GR2 Install Fails on Fedora 13
- Install And Configure Open VSwitch On CentOS RHEL Fedora
- Install Robot Framework on Linux Fedora20 or ubuntu /on Mac /on windows
- How to Install PostgreSQL 10 on CentOS/RHEL 7/6 and Fedora 26/25
- How to install tftp-server on Fedora 25 workstation
- How to Install WineHQ 1.5.27 on Fedora, CentOS and RHEL Linux Distributions
- howto install Oracle VirtualBox Guest Additions on Fedora, CentOS and Red Hat (RHEL).
- Install Google Chrome on Fedora 20/19/18/17
- Install Nginx/PHP-FPM on Fedora 20/19, CentOS/RHEL 6.5/5.10
- Google Chrome 35 Released – Install on RHEL/CentOS 6 and Fedora 20-15
- (OK)(OK) Install Docker on Fedora 23
- 转: How to Install MongoDB 3.2 on CentOS/RHEL & Fedora (简单易懂)