setup Server Monitoring |
yum install net-snmp net-snmp-utils cd /etc/snmp cp snmpd.conf snmpd.conf.orig |
vi snmpd.conf # remove original configuration for public by commenting out the following line #com2sec notConfigUser default public # # then add your own definitions (replace the network "10.1.1.0/24" by yours) com2sec local 127.0.0.1 pubalr1 com2sec mynetwork 10.1.1.0/24 pubalr1 group MyROGroup v1 local view all included .1 80 access MyROGroup "" any noauth exact all none none # disk / # disk /datadisk |
vim /etc/rc.d/init.d/snmpd OPTIONS="-Lf /var/log/snmpd.log -p /var/run/snmpd.pid -a" |
vim /etc/rc.d/init.d/snmpd OPTIONS="-LS0-5d -Lf /dev/null -p /var/run/snmpd.pid" |
service snmpd restart chkconfig --levels 2345 snmpd on chkconfig --list snmpd |
snmpwalk -v 1 -c pubalr1 localhost interface |
yum install mrtg |
cfgmaker --global 'WorkDir: /var/www/mrtg' --global 'Options[_]: bits,growright' --output /etc/mrtg/mrtg.cfg -ifref=ip pubalr1@127.0.0.1 |
vim /etc/snmp/snmpd.conf disk / disk /boot |
service snmpd restart snmpwalk -v 1 localhost -c pubalr1 dskPercent.1 |
df -k |
cd /etc/mrtg cp /XXXXX/server-info-num.cfg . |
cd /etc/mrtg scp root@XXXXX.com:/etc/mrtg/server-info-num.cfg . |
yum install httpd chkconfig --levels 2345 httpd on chkconfig --list httpd |
system-config-securitylevel-tui |
vim /etc/httpd/conf.d/mrtg.conf # Deny from all # Allow from 127.0.0.1 # Allow from ::1 Allow from all |
service httpd restart |
yum install rrdtool perl-rrdtool perl-CGI |
cd /goinfre wget ftp://ftp.linux.cz/pub/linux/people/jan_kasprzak/mrtg-rrd/mrtg-rrd-0.7.tar.gz cd /usr/local/src cp /goinfre/mrtg-rrd-0.7.tar.gz . tar xvfz mrtg-rrd-0.7.tar.gz cd mrtg-rrd* mkdir -p /var/www/cgi-bin/mrtg cp mrtg-rrd.cgi /var/www/cgi-bin/mrtg |
cd /var/www/cgi-bin/mrtg vim mrtg-rrd.cgi # update following line to add all mrtg cfg files ## BEGIN { @config_files = qw(/etc/mrtg/mrtg.cfg); } BEGIN { @config_files = qw(/etc/mrtg/mrtg.cfg /etc/mrtg/server-info-num.cfg); } |
vim /etc/mrtg/mrtg.cfg LogFormat: rrdtool PathAdd: /usr/bin #### already defined lower WorkDir: /var/mrtg IconDir: /mrtg vim /etc/mrtg/server-info-num.cfg LogFormat: rrdtool PathAdd: /usr/bin #### already defined lower WorkDir: /var/mrtg IconDir: /mrtg |
chown apache /var/www/mrtg |
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 LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/server-info-num.cfg --lock-file /var/lock/mrtg/mrtg_2 --confcache-file /var/lib/mrtg/server-info-num.ok --logging /var/log/mrtg.log |
vim /etc/cron.d/mrtg */5 * * * * root LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/server-info-num.cfg --lock-file /var/lock/mrtg/mrtg_2 --confcache-file /var/lib/mrtg/server-info-num.ok --logging /var/log/mrtg.log |
service crond status service crond restart |
http://127.0.0.1/cgi-bin/mrtg/mrtg-rrd.cgi/ |