2009年9月14日 星期一

Find out snmp OID for Nagios check_snmp plugins

Finally, I found a way to get snmp info from a host
  1. Run snmpwalk to view OID name
    Code:
    snmpwalk -v 1 -c public 192.168.56.1
    Note that public is the community string and 1 is the SNMP version
  2. Pick one, ie: SNMPv2-MIB::sysContact.0 (sysadmin mail address)
  3. Use snmptranslate to get OID number
    Code:
    snmptranslate -On SNMPv2-MIB::sysContact.0
  4. Check the OID number with check_snmp manually
    Code:
    ./check_snmp -H 192.168.56.1 -C public -o .1.3.6.1.2.1.1.4.0
  5. Take note of check_snmp options and arguments, then define/edit a command
    Code:
    define command{<br />        command_name    check_snmp<br />        command_line    $USER1$/check_snmp -H $HOSTADDRESS$ -C public -o $ARG1$<br />        }
    Note that $HOSTADDRESS$ is a macro so no need to fill that out since it will refer to current host config
  6. Define a service for that
    Code:
    define service{<br />        use                             other-service<br />        host_name                       laptop<br />        service_description             Admin email<br />        check_command                   check_snmp!.1.3.6.1.2.1.1.4.0<br />        }
    Since the first and second argument already filled out in command definition, we just need to add the last argument which is the OID number with exclamation mark (!) before it. Of course, other-service template is already defined.




reference: http://www.linuxquestions.org/questions/linux-networking-3/using-nagios-checksnmp-plugin-to-get-snmp-info-from-computer-751057/

2009年9月11日 星期五

摸魚也要認真

說要各地區自行評估不同時間段連線到A,B點的反應時間以作為balh的參考資料,
因為不是很想為這種事打斷正在努力培養的週末休假情緒工作, 所以...
---code-b.sh------
#!/bin/sh
echo `date +%Y-%m-%d_%H%M` >>ping_result.log
ping -q -c 10 hosta>>ping_result.log;ping -q -c 10 hostb>>ping_result.log

然後我們寫個cron讓他每小時code-b一次...
09 * * * * /somewhere/out/there/code-b.sh

哭一整天之後自己把結果寄出去
20 18 * * * mail -s "I did work hard today!" my.boss@nowhere.com</somewhere/out/there/ping_result.log

2009年9月10日 星期四

Allow vsftpd local account change passwd

1. set /usr/bin/passwd as shell of local ftp account.
2. user then ssh or telnet to vsftp server will get prompt to change passwd

#remember add /usr/bin/passwd into /etc/shells, or ftp account will get "530 login incorrect".
#"check_shell=No" in vsftpd.conf is useless since it only work whil vsftpd compiled in "non-pam" option, however mostly RHEL/CentOS versions pack vsftpd rpm with pam option? at least I verified my CentOS 5.3 setup and found check_shell is not work in my environment.

2009年9月2日 星期三

常見ADSL/FTTB 速率對照表

512Kbps 320Kbps~512Kbps 40KByte/秒~64KByte/秒
1Mbps 640Kbps~1000Kbps 80KByte/秒~125KByte/秒
2Mbps 1280Kbps~2000Kbps 160KByte/秒~250KByte/秒
8Mbps 1280Kbps~8000Kbps 160KByte/秒~1000KByte/秒
10Mbps 1280Kbps~10000Kbps 160KByte/秒~1250KByte/秒
12Mbps 1280Kbps~12000Kbps 160KByte/秒~1500KByte/秒