Wednesday, April 17, 2013

Load Average is Difference Between Uptime and Snmpwalk

Following example shows the difference between uptime and snmpwalk commands.

# uptime
 12:13:48 up 580 days, 51 min,  8 users,  load average: 2.38, 1.70, 2.70
# snmpwalk -v2c -c public localhost .1.3.6.1.4.1.2021.10.1.5
UCD-SNMP-MIB::laLoadInt.1 = INTEGER: 243
UCD-SNMP-MIB::laLoadInt.2 = INTEGER: 172
UCD-SNMP-MIB::laLoadInt.3 = INTEGER: 270

# snmpwalk -v2c -c public localhost .1.3.6.1.4.1.2021.10.1.6
UCD-SNMP-MIB::laLoadFloat.1 = Opaque: Float: 2.240000
UCD-SNMP-MIB::laLoadFloat.2 = Opaque: Float: 1.690000
UCD-SNMP-MIB::laLoadFloat.3 = Opaque: Float: 2.680000

Snmp has 2 oids for load average, integer and floating point. The value of floating point is the same as uptime, To convert integer load average value from snmpwalk, simplely devide it by 100. 

Retrieve system information with facter

The facter is a Ruby tool that provides system information in "key=>value" pairs. Following are some examples:

# facter
architecture => x86_64
...
is_virtual => false
...
memoryfree => 20.15 GB
...
netmask => 255.255.255.0
...

# facter timezone
EDT

Thursday, April 11, 2013

Use Jenkiz to monitor Cron Job with hudson_wrapper

The easest way to use Jenkinz to monitor cron job is use hudson_wrapper as show below:

1. Put hudson_wrapper.sh, from https://github.com/joemiller/hudson_wrapper, on each server, and update the /etc/crontab as below:
     0 * * * * root /path/hudson_wrapper.sh Jenkinz_URL name command
2. The wrapper will create the job on the Jekniz server if it is not exist. So no Jenkiz configuration needed.

Top command issue on cron job

Use -b option to run top command through cron and extend script for snmp configuration, etc. Otherwise top will failed with "top: failed tty get" message.
      top -b -n 1

Trick for SVN Folder defination in authz file

Don't put a slash at the end of a folder defination such as  [/SYSTEMS/] instead of [/SYSTEMS]. The ending slash may cause access denied problem.