Tuesday, December 9, 2008

How to detect Net-SNMP host on OpenNMS

How can install net-snmp in Ubuntu and detected from OpenNMS (Network Management Software)?
very easy, since net-snmp.deb are available, it is very simple.
apt-get install ...bla..bla..bla

Here is the ways:
apt-get install snmp
apt-get install snmpd

And it finish,
But, just doing that way, it can't detected by OpenNMS that the client offer Net-SNMP. So, we have to configure again.

Open this file:
/etc/snmp/snmpd.conf :


# com2sec
com2sec local localhost public
com2sec opennms 192.168.100.6 public # change with OpenNMS host IP Adress
# group
group local v1 local
group local v2c local
group local usm local
group opennms v1 opennms
group opennms v2c opennms
group opennms usm opennms
# view [MASK]
view all included .1 80
view system included system fe
view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
# access
access local "" any noauth exact all none none
access opennms "" any noauth exact all none none


and then activate monitoring feature in /etc/snmp/snmpd.conf.

and then in /etc/default/snmpd :
change 127.0.0.1 pada SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1' with 0.0.0.0, that means allowed listen address to access the host.
and then restart net-snmp.

Check on OpenNMS browser.
Good Luck.

Labels: ,

Sunday, December 7, 2008

apt.conf configuration on Ubuntu

This is sound very simple, but sometimes we forget the configuration. I just documented this, so if I forget, I can easily find how to configure apt.conf on Ubuntu. Here is the configuration:

Acquire::http::Proxy "http://(username):(password)@(name_of_the_proxy):8080";

Here is the example:
If we use proxy:cache1.itb.ac.id.
username:komang,
password:aswantara,
and then the configuration will be:

Acquire::http::Proxy "http://komang:adiaswantara@cache1.itb.ac.id:8080";

After we change, and then save the configuration. Now, you can use apt command to make update of your Ubuntu.

Labels: ,

wget configuration on Ubuntu

Wget is one of the command in Ubuntu to download such file from http or ftp. By default, wget not configured yet to download such file. Configuration of wget almost the same with configuring apt.conf. Here is the step:


1. Open file /etc/wgetrc
2. Find this line :
# You can set the default proxies for Wget to use for http and ftp.
# They will override the value in the environment.
http_proxy = http://proxy.yoyodyne.com:18023/
ftp_proxy = http://proxy.yoyodyne.com:18023/
# If you do not want to use proxy at all, set this to off.
#use_proxy = on


3. Change the line with:
http_proxy = http://(username_proxy_anda):(password)@(nama_proxy_anda):8080/
ftp_proxy = http://(username_proxy_anda):(password)@(nama_proxy_anda):8080/

Uncomment this line (status use_proxy must on) :
# If you do not want to use proxy at all, set this to off.
use_proxy = on


4. Now, you can try wget command, for example: wget ftp://...................

Labels: ,

Monday, December 1, 2008

How to collect and preview the data from LM-SENSOR using OpenNMS

OpenNMS in standard can't collect the data from LM-SENSORS, even the lmsensors can collect the data from the node that installed. So, to collect the data from lmsensors using opennms, we must add some definition in datacollection.xml in opennms folder. Here, I'm using OpenNMS 1.5.91 based on Ubuntu 7.10 Gutsy Gibbon, and I also have tried this using Ubuntu 8.04 Hardy Heron.
In this project I want to collect the data using lmsensors (temperature and voltage) of VIA EPIA Mini ITX ML6000EA and Soekris Net 4801.
For the first time, we must installed SNMP agent in each node, and make sure that the SNMP agent run finely in each node.
And then, we installed lm-sensors in each node. After installing lm-sensors, check whether lm-sensors can get data from that node using command #sensors -s && sensors. The output is like this:
root@ubuntuvia:/home/labngn# sensors
vt1211-isa-6000
Adapter: ISA adapter
+3.3V: +3.39 V (min = +0.00 V, max = +4.42 V)
+2.5V: +2.49 V (min = +0.00 V, max = +3.16 V)
VCore: +1.03 V (min = +0.00 V, max = +2.63 V)
+5V: +4.71 V (min = +0.00 V, max = +6.31 V)
+12V: +11.90 V (min = +0.00 V, max = +14.99 V)
+3.3V: +3.30 V (min = +3.13 V, max = +3.46 V)
Case Fan: 0 RPM (min = 0 RPM, div = 2)
CPU Fan: 0 RPM (min = 0 RPM, div = 2)
CPU Temp: +26.4°C (high = +190°C, hyst = -78°C)
Int Temp: +40.0°C (high = +204°C, hyst = +0°C)
vid: +1.750 V (VRM Version 1.7)

To check the SNMP and lm-sensors run correctly, just using command #snmpwalk -v1 -c public (your node's IP) .1.3.6.1.4.1.2021.13.16. Here is the example of the output:
LM-SENSORS-MIB::lmTempSensorsIndex.1 = INTEGER: 0
LM-SENSORS-MIB::lmTempSensorsIndex.2 = INTEGER: 1
LM-SENSORS-MIB::lmTempSensorsDevice.1 = STRING: CPU Temp
LM-SENSORS-MIB::lmTempSensorsDevice.2 = STRING: Int Temp
LM-SENSORS-MIB::lmTempSensorsValue.1 = Gauge32: 32673
LM-SENSORS-MIB::lmTempSensorsValue.2 = Gauge32: 41000
LM-SENSORS-MIB::lmFanSensorsIndex.1 = INTEGER: 0
LM-SENSORS-MIB::lmFanSensorsIndex.2 = INTEGER: 1
LM-SENSORS-MIB::lmFanSensorsDevice.1 = STRING: Case Fan
LM-SENSORS-MIB::lmFanSensorsDevice.2 = STRING: CPU Fan
LM-SENSORS-MIB::lmFanSensorsValue.1 = Gauge32: 0
LM-SENSORS-MIB::lmFanSensorsValue.2 = Gauge32: 0
LM-SENSORS-MIB::lmVoltSensorsIndex.1 = INTEGER: 0
LM-SENSORS-MIB::lmVoltSensorsIndex.2 = INTEGER: 1
LM-SENSORS-MIB::lmVoltSensorsIndex.3 = INTEGER: 2
LM-SENSORS-MIB::lmVoltSensorsIndex.4 = INTEGER: 3
LM-SENSORS-MIB::lmVoltSensorsIndex.5 = INTEGER: 4
LM-SENSORS-MIB::lmVoltSensorsIndex.6 = INTEGER: 5
LM-SENSORS-MIB::lmVoltSensorsDevice.1 = STRING: +3.3V
LM-SENSORS-MIB::lmVoltSensorsDevice.2 = STRING: +2.5V
LM-SENSORS-MIB::lmVoltSensorsDevice.3 = STRING: VCore
LM-SENSORS-MIB::lmVoltSensorsDevice.4 = STRING: +5V
LM-SENSORS-MIB::lmVoltSensorsDevice.5 = STRING: +12V
LM-SENSORS-MIB::lmVoltSensorsDevice.6 = STRING: +3.3V
LM-SENSORS-MIB::lmVoltSensorsValue.1 = Gauge32: 3385
LM-SENSORS-MIB::lmVoltSensorsValue.2 = Gauge32: 2480
LM-SENSORS-MIB::lmVoltSensorsValue.3 = Gauge32: 1032
LM-SENSORS-MIB::lmVoltSensorsValue.4 = Gauge32: 4708
LM-SENSORS-MIB::lmVoltSensorsValue.5 = Gauge32: 11901
LM-SENSORS-MIB::lmVoltSensorsValue.6 = Gauge32: 3298
LM-SENSORS-MIB::lmMiscSensorsIndex.1 = INTEGER: 0
LM-SENSORS-MIB::lmMiscSensorsIndex.2 = INTEGER: 1
LM-SENSORS-MIB::lmMiscSensorsIndex.3 = INTEGER: 2
LM-SENSORS-MIB::lmMiscSensorsDevice.1 = STRING: alarms
LM-SENSORS-MIB::lmMiscSensorsDevice.2 = STRING: vid
LM-SENSORS-MIB::lmMiscSensorsDevice.3 = STRING: vrm
LM-SENSORS-MIB::lmMiscSensorsValue.1 = Gauge32: 4608000
LM-SENSORS-MIB::lmMiscSensorsValue.2 = Gauge32: 1750
LM-SENSORS-MIB::lmMiscSensorsValue.3 = Gauge32: 1699

After that, we must add resource type in datacollection.xml in opennms directory (/etc/opennms).

Ans then, add group name for this resource type:

After that, we must define the resource type and group name in the Sysdef of the OpenNMS, like this:

.1.3.6.1.4.1.8072.3.2.10

lmSensors-temperature
lmSensors-fan
lmSensors-volt
lmSensors-misc

Basically, OpenNMS can't define the SNMP graph for lm-sensors, so we must define the graph manually in the snmp-graph.properties directory, here is the example of the definition for temperature:
report.lmsensors.temperature.name=Temperature
report.lmsensors.temperature.columns=temp1
report.lmsensors.temperature.propertiesValues=temp
report.lmsensors.temperature.type=lmTempSensorsTable
report.lmsensors.temperature.command=--title="Temperature on {temp}" \
--vertical-label="Celcius" \
DEF:dCore={rrd1}:temp1:AVERAGE \
CDEF:bCore=dCore,1000,* \
LINE2:bCore#0000ff:"Temperature Core:" \
GPRINT:bCore:AVERAGE:" Avg \\: %10.2lf %s" \
GPRINT:bCore:MIN:"Min \\: %10.2lf %s" \
GPRINT:bCore:MAX:"Max \\: %10.2lf %s\\n" \

And then, if we check in the OpenNMS web, here is the display:

And here is the display of the graph:

That's all. Simple. Good Luck.