rpm -q mrtg
[docsrv@ed ~]$ rpm -q mrtg
mrtg-2.10.15-1
rpm -q net-snmp
[root@pd920 ~]# rpm -q net-snmp
net-snmp-5.1.2-11.EL4.7
vi /etc/snmp/snmpd.conf
com2sec notConfigUser default public
group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser
view systemview included .1.3.6.1.2.1.2
view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.25.1.1
view systemview included .1.3.6.1.2.1.2.2.1
access notConfigGroup "" any noauth exact systemview none none
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
pass .1.3.6.1.4.1.4413.4.1 /usr/bin/ucd5820stat
service snmpd restart
chkconfig snmpd on
chkconfig --list | grep snmpd
假設已經安裝
trysrvtool 在 /opt/trysrvtool/, 就可以在 /opt/trysrvtool/mrtg/ 底下看到相關的 scripts
cd /etc/mrtg
/opt/trysrvtool/mrtg/runcfgmaker.sh
cat localhost.cfg >> mrtg.cfg
vi /etc/mrtg/mrtg.cfg
:
### Global Defaults
# to get bits instead of bytes and graphs growing to the right
Options[_]: growright, bits
:
:
Target[eth1]: 3:public@192.168.11.250
SetEnv[eth1]: MRTG_INT_IP="192.168.11.250" MRTG_INT_DESCR="eth1"
MaxBytes[eth1]: 1250000000
Options[eth1]: growright
Title[eth1]: Traffic Analysis
PageTop[eth1]: <H1>Stats for our eth0:192.168.11.250 Ethernet</H1>
#
#
Target[disk_root]: `/opt/trysrvtool/mrtg/disk.pl`
MaxBytes[disk_root]: 50000000000
Options[disk_root]: gauge, nopercent, growright
YLegend[disk_root]: disk_root
ShortLegend[disk_root]: Bytes
LegendO[disk_root]: disk_root Available;
LegendI[disk_root]: disk_root Used;
Title[disk_root]: disk_root Usage
PageTop[disk_root]: <H1>pdc-e2160 disk_root usage</H1>
Target[disk_data]: `/opt/trysrvtool/mrtg/disk.pl /data`
MaxBytes[disk_data]: 200000000000
Options[disk_data]: gauge, nopercent, growright
YLegend[disk_data]: disk_data
ShortLegend[disk_data]: Bytes
LegendO[disk_data]: disk_data Available;
LegendI[disk_data]: disk_data Used;
Title[disk_data]: disk_data Usage
PageTop[disk_data]: <H1>pdc-e2160 disk_data usage</H1>
Target[disk_backup]: `/opt/trysrvtool/mrtg/disk.pl /backup`
MaxBytes[disk_backup]: 200000000000
Options[disk_backup]: gauge, nopercent, growright
YLegend[disk_backup]: disk_backup
ShortLegend[disk_backup]: Bytes
LegendO[disk_backup]: disk_backup Available;
LegendI[disk_backup]: disk_backup Used;
Title[disk_backup]: disk_backup Usage
PageTop[disk_backup]: <H1>pdc-e2160 disk_backup usage</H1>
Target[cpuload]: `/opt/trysrvtool/mrtg/cpuload.pl`
MaxBytes[cpuload]: 100
Options[cpuload]: gauge, nopercent, growright
YLegend[cpuload]: CPU loading (%)
ShortLegend[cpuload]: %
LegendO[cpuload]: CPU User Loading;
LegendI[cpuload]: CPU System Loading;
Title[cpuload]: CPU Loading
PageTop[cpuload]: <H1>pdc-e2160 CPU loading</H1>
Target[cpuio]: `/opt/trysrvtool/mrtg/cpuio.pl`
MaxBytes[cpuio]: 100
Options[cpuio]: gauge, nopercent, growright
YLegend[cpuio]: cpuio (%)
ShortLegend[cpuio]: %
LegendO[cpuio]: cpu Idel;
LegendI[cpuio]: cpu IOWait;
Title[cpuio]: cpuio Loading
PageTop[cpuio]: <H1>pdc-e2160 cpuio loading</H1>
Target[sensors]: `/opt/trysrvtool/mrtg/temper.pl sensors`
MaxBytes[sensors]: 100
Options[sensors]: gauge, nopercent, growright
YLegend[sensors]: M/B (C)
ShortLegend[sensors]: C
LegendO[sensors]: M/B Temp ;
LegendI[sensors]: M/B Temp;
Title[sensors]: M/B Temperature
PageTop[sensors]: <H1>pdc-e2160 M/B temperature</H1>
Target[ups]: `/opt/trysrvtool/mrtg/temper.pl ups`
MaxBytes[ups]: 100
Options[ups]: gauge, nopercent, growright
YLegend[ups]: UPS (C)
ShortLegend[ups]: C
LegendO[ups]: UPS Temp ;
LegendI[ups]: UPS Temp;
Title[ups]: UPS Temperature
PageTop[ups]: <H1>APC UPS temperature</H1>
Target[sata_dev_sda]: `/opt/trysrvtool/mrtg/temper.pl sata /dev/sda`
MaxBytes[sata_dev_sda]: 100
Options[sata_dev_sda]: gauge, nopercent, growright
YLegend[sata_dev_sda]: HD (C)
ShortLegend[sata_dev_sda]: C
LegendO[sata_dev_sda]: data HD Temp ;
LegendI[sata_dev_sda]: data HD Temp;
Title[sata_dev_sda]: Hard Disk Temperature
PageTop[sata_dev_sda]: <H1>pdc-e2160 Hard Disk temperature</H1>
Target[sata_dev_sdb]: `/opt/trysrvtool/mrtg/temper.pl sata /dev/sdb`
MaxBytes[sata_dev_sdb]: 100
Options[sata_dev_sdb]: gauge, nopercent, growright
YLegend[sata_dev_sdb]: HD (C)
ShortLegend[sata_dev_sdb]: C
LegendO[sata_dev_sdb]: main HD Temp ;
LegendI[sata_dev_sdb]: main HD Temp;
Title[sata_dev_sdb]: Hard Disk Temperature
PageTop[sata_dev_sdb]: <H1>pdc-e2160 Hard Disk temperature</H1>
Target[smtp]: `/opt/trysrvtool/mrtg/connection.pl 25`
MaxBytes[smtp]: 500
Options[smtp]: gauge, nopercent, growright
YLegend[smtp]: smtp connect (#)
ShortLegend[smtp]: #
LegendO[smtp]: SMTP User Connecting;
LegendI[smtp]: SMTP User Connected;
Title[smtp]: SMTP Connections
PageTop[smtp]: <H1>pdc-e2160 SMTP connections</H1>
Target[pop3]: `/opt/trysrvtool/mrtg/connection.pl 110`
MaxBytes[pop3]: 500
Options[pop3]: gauge, nopercent, growright
YLegend[pop3]: pop3 connect (#)
ShortLegend[pop3]: #
LegendO[pop3]: POP3 User Connecting;
LegendI[pop3]: POP3 User Connected;
Title[pop3]: POP3 Connections
PageTop[pop3]: <H1>pdc-e2160 POP3 connections</H1>
Target[imap]: `/opt/trysrvtool/mrtg/connection.pl 143`
MaxBytes[imap]: 500
Options[imap]: gauge, nopercent, growright
YLegend[imap]: imap connect (#)
ShortLegend[imap]: #
LegendO[imap]: IMAP User Connecting;
LegendI[imap]: IMAP User Connected;
Title[imap]: IMAP Connections
PageTop[imap]: <H1>pdc-e2160 IMAP connections</H1>
Target[http]: `/opt/trysrvtool/mrtg/connection.pl 80`
MaxBytes[http]: 500
Options[http]: gauge, nopercent, growright
YLegend[http]: http connect (#)
ShortLegend[http]: #
LegendO[http]: HTTP User Connecting;
LegendI[http]: HTTP User Connected;
Title[http]: HTTP Connections
PageTop[http]: <H1>pdc-e2160 HTTP connections</H1>
Target[ssh]: `/opt/trysrvtool/mrtg/connection.pl 22`
MaxBytes[ssh]: 500
Options[ssh]: gauge, nopercent, growright
YLegend[ssh]: ssh connect (#)
ShortLegend[ssh]: #
LegendO[ssh]: SSH User Connecting;
LegendI[ssh]: SSH User Connected;
Title[ssh]: SSH Connections
PageTop[ssh]: <H1>pdc-e2160 SSH connections</H1>
Target[postgres]: `/opt/trysrvtool/mrtg/connection.pl 5432`
MaxBytes[postgres]: 500
Options[postgres]: gauge, nopercent, growright
YLegend[postgres]: psql connect (#)
ShortLegend[postgres]: #
LegendO[postgres]: PostgreSQL User Connecting;
LegendI[postgres]: PostgreSQL User Connected;
Title[postgres]: PostgreSQL Connections
PageTop[postgres]: <H1>pdc-e2160 PostgreSQL connections</H1>
Target[mysql]: `/opt/trysrvtool/mrtg/connection.pl 3306`
MaxBytes[mysql]: 500
Options[mysql]: gauge, nopercent, growright
YLegend[mysql]: msql connect (#)
ShortLegend[mysql]: #
LegendO[mysql]: MYSQL User Connecting;
LegendI[mysql]: MYSQL User Connected;
Title[mysql]: MYSQL Connections
PageTop[mysql]: <H1>pdc-e2160 MYSQL connections</H1>
Target[domain]: `/opt/trysrvtool/mrtg/connection.pl 53`
MaxBytes[domain]: 500
Options[domain]: gauge, nopercent, growright
YLegend[domain]: dns connect (#)
ShortLegend[domain]: #
LegendO[domain]: domain User Connecting;
LegendI[domain]: domain User Connected;
Title[domain]: domain Connections
PageTop[domain]: <H1>pdc-e2160 domain connections</H1>
Target[ntp]: `/opt/trysrvtool/mrtg/connection.pl 123`
MaxBytes[ntp]: 500
Options[ntp]: gauge, nopercent, growright
YLegend[ntp]: ntp connect (#)
ShortLegend[ntp]: #
LegendO[ntp]: NTP User Connecting;
LegendI[ntp]: NTP User Connected;
Title[ntp]: NTP Connections
PageTop[ntp]: <H1>pdc-e2160 NTP connections</H1>
Target[upsload]: `/opt/trysrvtool/mrtg/apcups.pl`
MaxBytes[upsload]: 100
Options[upsload]: gauge, nopercent, growright
YLegend[upsload]: upsload (%)
ShortLegend[upsload]: %
LegendI[upsload]: ups load;
LegendO[upsload]: bat capacity;
Title[upsload]: UPS Loading
PageTop[upsload]: <H1>APC UPS Loading</H1>
Target[upsvolts]: `/opt/trysrvtool/mrtg/apcups.pl "LINEV :,OUTPUTV"`
MaxBytes[upsvolts]: 200
Options[upsvolts]: gauge, nopercent, growright
YLegend[upsvolts]: ups volts
ShortLegend[upsvolts]: VAC
LegendI[upsvolts]: Utility Voltage;
LegendO[upsvolts]: Output Voltage;
Title[upsvolts]: UPS Voltage
PageTop[upsvolts]: <H1>APC UPS Voltage</H1>
Target[upsother]: `/opt/trysrvtool/mrtg/apcups.pl "TIMELEFT,BATTV :"`
MaxBytes[upsother]: 100
Options[upsother]: gauge, nopercent, growright
YLegend[upsother]: ups others
ShortLegend[upsother]: min/vdc
LegendI[upsother]: Time Left;
LegendO[upsother]: Bat Voltage;
Title[upsother]: UPS Others
PageTop[upsother]: <H1>APC UPS Others</H1>
cd /opt/trysrvtool/mrtg
chmod a+x *
/opt/trysrvtool/mrtg/runmrtg.sh
/opt/trysrvtool/mrtg/runmrtg.sh
vi /etc/cron.d/mrtg
*/5 * * * * root LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok
service crond restart
vi /etc/httpd/conf.d/mrtg.conf
Alias /mrtg /var/www/mrtg
<Location /mrtg>
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
# Allow from ::1
# Allow from .example.com
</Location>
service httpd restart
/opt/trysrvtool/mrtg/runindex.sh