# su - # sensors-detect (いろいろ聞かれますが全てYesで答えて) To make the sensors modules behave correctly, add these lines to /etc/modprobe.conf: #----cut here---- # I2C module options alias char-major-89 i2c-dev #----cut here---- To load everything that is needed, add this to some /etc/rc* file: #----cut here---- # I2C adapter drivers modprobe i2c-isa # I2C chip drivers modprobe w83627hf # sleep 2 # optional /usr/bin/sensors -s # recommended #----cut here---- WARNING! If you have some things built into your kernel, the list above will contain too many modules. Skip the appropriate ones! You really should try these commands right now to make sure everything is working properly. Monitoring programs won't work until it's done. Do you want to generate /etc/sysconfig/lm_sensors? (YES/no): y最後に、/etc/modprove.conf と /etc/rc* を書き換えろと言われますが、特に必要はありません。Suseが自動的にやってくれています。
> sensors w83697hf-isa-0290 Adapter: ISA adapter VCore: +0.00 V (min = +1.71 V, max = +1.89 V) +3.3V: +0.38 V (min = +3.14 V, max = +3.47 V) +5V: +0.00 V (min = +4.76 V, max = +5.24 V) +12V: +3.28 V (min = +10.82 V, max = +13.19 V) -12V: -14.91 V (min = -13.18 V, max = -10.80 V) -5V: -7.71 V (min = -5.25 V, max = -4.75 V) V5SB: +0.00 V (min = +4.76 V, max = +5.24 V) VBat: +0.06 V (min = +2.40 V, max = +3.60 V) fan1: 0 RPM (min = -1 RPM, div = 2) fan2: 0 RPM (min = -1 RPM, div = 2) temp1: +56℃ (high = +0℃, hyst = +12℃) sensor = thermistor temp2: +52.0℃ (high = +80℃, hyst = +75℃) sensor = thermistor alarms: Chassis intrusion detection ALARM beep_enable: Sound alarm disabled eeprom-i2c-0-50 Adapter: SMBus Via Pro adapter at 5000 Memory type: DDR SDRAM DIMM Memory size (MB): 1024
# smartctl -s on /dev/hda smartctl version 5.33 [i686-pc-linux-gnu] Copyright (C) 2002-4 Bruce Allen Home page is http://smartmontools.sourceforge.net/ === START OF ENABLE/DISABLE COMMANDS SECTION === SMART Enabled.rebootしても有効のままです。
# smartctl -a /dev/hda | grep Temperature 194 Temperature_Celsius 0x0002 105 105 000 Old_age Always - 52 (Lifetime Min/Max 13/55)
# hdparm -S 12 /dev/hda /dev/hda: setting standby to 12 (1 minutes)
${指定した値}*5sec 間アクセスがない場合HDDを停止します。
HDDに負荷をかけるので 60(5min) ぐらいが適当かな
# cp /usr/share/doc/packages/net-snmp/EXAMPLE.conf /etc/snmpd.conf
# diff -u /usr/share/doc/packages/net-snmp/EXAMPLE.conf /etc/snmpd.conf --- /usr/share/doc/packages/net-snmp/EXAMPLE.conf 2005-09-10 02:13:12.000000000 +0900 +++ /etc/snmpd.conf 2007-05-13 01:09:15.000000000 +0900 @@ -57,20 +57,20 @@ # (local and mynetwork, depending on where the request is coming # from): -# sec.name source community -com2sec local localhost COMMUNITY -com2sec mynetwork NETWORK/24 COMMUNITY +# sec.name source community +com2sec local localhost private +#com2sec mynetwork 192.168.1.0/24 lan #### # Second, map the security names into group names: # sec.model sec.name -group MyRWGroup v1 local -group MyRWGroup v2c local -group MyRWGroup usm local -group MyROGroup v1 mynetwork -group MyROGroup v2c mynetwork -group MyROGroup usm mynetwork +group MyROGroup v1 local +group MyROGroup v2c local +group MyROGroup usm local +#group MyROGroup v1 mynetwork +#group MyROGroup v2c mynetwork +#group MyROGroup usm mynetwork #### # Third, create a view for us to let the groups have rights to: @@ -84,7 +84,7 @@ # context sec.model sec.level match read write notif access MyROGroup "" any noauth exact all none none -access MyRWGroup "" any noauth exact all all none +#access MyRWGroup "" any noauth exact all all none # ----------------------------------------------------------------------------- @@ -101,7 +101,7 @@ # status of notWritable. syslocation Right here, right now. -syscontact Me <me@somewhere.org> +syscontact Me <root@hondou.homedns.org> # Example output of snmpwalk: # % snmpwalk -v 1 -c public localhost system
# snmpwalk -v1 -c private localhost | more SNMPv2-MIB::sysDescr.0 = STRING: Linux grape 2.6.13-15.13-default #1 Tue Nov 28 13:43:50 UTC 2006 i686 SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (22418) 0:0 SNMPv2-MIB::sysContact.0 = STRING: Me <root@hondou.homedns.org> SNMPv2-MIB::sysName.0 = STRING: grape SNMPv2-MIB::sysLocation.0 = STRING: Right here, right now. SNMPv2-MIB::sysORLastChange.0 = Timeticks: (6) 0:0 SNMPv2-MIB::sysORID.1 = OID: IF-MIB::ifMIB SNMPv2-MIB::sysORID.2 = OID: SNMPv2-MIB::snmpMIB SNMPv2-MIB::sysORID.3 = OID: TCP-MIB::tcpMIB SNMPv2-MIB::sysORID.4 = OID: IP-MIB::ip SNMPv2-MIB::sysORID.5 = OID: UDP-MIB::udpMIB SNMPv2-MIB::sysORID.6 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup SNMPv2-MIB::sysORID.7 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance SNMPv2-MIB::sysORID.8 = OID: SNMP-MPD-MIB::snmpMPDCompliance SNMPv2-MIB::sysORID.9 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance SNMPv2-MIB::sysORID.10 = OID: TUNNEL-MIB::tunnelMIB SNMPv2-MIB::sysORDescr.1 = STRING: The MIB module to describe generic objects for network interface sub-layers SNMPv2-MIB::sysORDescr.2 = STRING: The MIB module for SNMPv2 entities SNMPv2-MIB::sysORDescr.3 = STRING: The MIB module for managing TCP implementations SNMPv2-MIB::sysORDescr.4 = STRING: The MIB module for managing IP and ICMP implementations SNMPv2-MIB::sysORDescr.5 = STRING: The MIB module for managing UDP implementations SNMPv2-MIB::sysORDescr.6 = STRING: View-based Access Control Model for SNMP. --More--
# cd /srv/www/htdocs/ # tar -xf /home/kagyuu/Documents/cacti-0.8.6h.tar.gz # chown -R root:root cacti-0.8.6h/ # ln -s cacti-0.8.6h/ cacti
# mysql -u root -p mysql> create database cacti; Query OK, 1 row affected (0.02 sec) mysql> GRANT ALL ON cacti.* TO cactiuser IDENTIFIED BY 'cactiuser'; Query OK, 0 rows affected (0.09 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) mysql> exit Bye
# mysql -u cactiuser -p cacti < /srv/www/htdocs/cacti/cacti.sql Enter password:
> sudo vi /usr/share/cacti/include/config.php 27 /* make sure these values refect your actual database/host/user/password */ 28 $database_type = "mysql"; 29 $database_default = "cacti"; 30 $database_hostname = "localhost"; 31 $database_username = "cactiuser"; 32 $database_password = "cactiuser"; :wq
# php /srv/www/htdocs/cacti/poller.php 03/19/2006 09:50:46 PM - SYSTEM STATS: Time:1.1668 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:2 DataSources:5 RRDsProcessed:5 OK u:0.01 s:0.00 r:0.07 OK u:0.01 s:0.00 r:0.08 OK u:0.01 s:0.00 r:0.08 OK u:0.01 s:0.00 r:0.08 OK u:0.01 s:0.00 r:0.08 OK u:0.01 s:0.00 r:0.08 OK u:0.01 s:0.00 r:0.08 OK u:0.02 s:0.00 r:0.08 OK u:0.02 s:0.00 r:0.08 OK u:0.02 s:0.00 r:0.09
# crontab -e @daily /etc/webmin/webalizer/webalizer.pl /var/log/apache2/access_log @daily /etc/webmin/webalizer/webalizer.pl /var/log/squid/access.log */5 * * * * php /srv/www/htdocs/cacti/poller.php 1>> /var/log/cacti/stdout.log 2>> /var/log/cacti/stderr.log :wq
# crontab -e @daily /etc/webmin/webalizer/webalizer.pl /var/log/apache2/access_log @daily /etc/webmin/webalizer/webalizer.pl /var/log/squid/access.log */5 * * * * php /srv/www/htdocs/cacti/poller.php 1> /dev/null 2>&1 :wq
/proc/meminfo から kb単位 でデータをとっているので、グラフに表示される値が 1024分の1になっている様な気がします・・・
たとえば、空きメモリが 200kb と記録されています。多分 200kb kb = 200MB が正しい値だと思うのですが・・・
とりあえず本家の Forum に以下のような投稿しておきました。
http://forums.cacti.net/viewtopic.php?t=12601
Hello. I'm using cacti 0.8.6h on Suse Linux 10. Now I think Memory Usage Graph is wrong. It shows 1/1000 of true values, may be. So, I propose to fix linux_memory.pl as following: ----------------------------------------------------------------------------- #!/usr/bin/perl open(PROCESS, "cat /proc/meminfo | grep -w $ARGV[0] |"); foreach (<PROCESS>) { if ($_ =~ /($ARGV[0].*\s)(.*[0-9])( kB)/) { print $2 * 1024; } } close(PROCESS); ----------------------------------------------------------------------------- Please correct it by the upcoming version if this is correct.
> cat /srv/www/htdocs/cacti-0.8.6h/scripts/freq.sh #!/bin/sh cpufreq=`cat /proc/cpuinfo | grep 'cpu MHz' | awk '{print $4}'` echo -n ${cpufreq}
> cat /srv/www/htdocs/cacti-0.8.6h/scripts/temp.sh #!/bin/sh hddtemp=`/usr/sbin/smartctl -a /dev/hda | grep Temperature_Celsius | awk '{print $10}'` cputemp=`/usr/bin/sensors | grep temp1 | awk '{$temp=$2;sub(/[^+\-0-9\.]/,"",$temp);sub(/[°]/,"",$temp);print $temp;}'` mbtemp=`/usr/bin/sensors | grep temp2 | awk '{$temp=$2;sub(/[^+\-0-9\.]/,"",$temp);sub(/[°]/,"",$temp);print $temp;}'` echo -n HDD:${hddtemp} CPU:${cputemp} MB:${mbtemp}