Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

UPS simulator on snmpd

79 views
Skip to first unread message

voytech

unread,
Aug 4, 2005, 2:50:35 AM8/4/05
to
Greetings!

I am trying to build IMV Victron UPS simulator with Linux and net-snmpd.
When I use snmpget all things works perfectly. However, client software
(JUMPView 2.1.2) uses snmpgetnext too.

Results are as follows:

user@linux:~$ snmpget -v 1 -c public ups 1.3.6.1.2.1.33.1.6.1.0
SNMPv2-SMI::mib-2.33.1.6.1.0 = Gauge32: 1

user@linux:~$ snmpget -v 1 -c public localhost 1.3.6.1.2.1.33.1.6.1.0
SNMPv2-SMI::mib-2.33.1.6.1.0 = Gauge32: 1

The same, OK.


user@linux:~$ snmpget -v 1 -c public ups 1.3.6.1.2.1.33.1.6.2.1.1.1
SNMPv2-SMI::mib-2.33.1.6.2.1.1.1 = INTEGER: 13

user@linux:~$ snmpget -v 1 -c public localhost 1.3.6.1.2.1.33.1.6.2.1.1.1
SNMPv2-SMI::mib-2.33.1.6.2.1.1.1 = INTEGER: 13

The same, OK, but:


user@linux:~$ snmpgetnext -v 1 -c public ups 1.3.6.1.2.1.33.1.6.1.0
SNMPv2-SMI::mib-2.33.1.6.2.1.1.1 = INTEGER: 13

user@linux:~$ snmpgetnext -v 1 -c public localhost 1.3.6.1.2.1.33.1.6.1.0
IPV6-MIB::ipv6Forwarding.0 = INTEGER: notForwarding(2)

I don't know, why my snmpd returns different oid with different value
than UPS.

Can anyone help me, please?

Here is my configuration:

########################################
/etc/snmp/snmpd.conf
com2sec readonly default public

group MyROSystem v1 paranoid
group MyROSystem v2c paranoid
group MyROSystem usm paranoid
group MyROGroup v1 readonly
group MyROGroup v2c readonly
group MyROGroup usm readonly
group MyRWGroup v1 readwrite
group MyRWGroup v2c readwrite
group MyRWGroup usm readwrite

view all included .1 80
view system included .iso.org.dod.internet.mgmt.mib-2.system

access MyROSystem "" any noauth exact system none none
access MyROGroup "" any noauth exact all none none
access MyRWGroup "" any noauth exact all all none

syslocation Unknown (configure /etc/snmp/snmpd.local.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmpd.local.conf)

pass .1.3.6.1.2.1.33.1 /usr/local/snmp/bin/victron

########################################
/usr/local/snmp/bin/victron

#!/bin/sh -f

PATH=$path:/bin:/usr/bin:/usr/ucb

PLACE=".1.3.6.1.2.1.33.1"
REQ="$2"

if [ "$1" = "-s" ]; then
echo $* >> /tmp/passtest.log
exit 0
fi

if [ "$1" = "-n" ]; then
case "$REQ" in
$PLACE) RET=$PLACE.1 ;;
$PLACE.1) RET=$PLACE.2.1 ;;
$PLACE.2.1) RET=$PLACE.2.2 ;;
$PLACE.2.2) RET=$PLACE.3 ;;
$PLACE.3) RET=$PLACE.4 ;;
$PLACE.4) RET=$PLACE.5 ;;
$PLACE.5) RET=$PLACE.6 ;;
*) exit 0 ;;
esac
else
case "$REQ" in
$PLACE) exit 0 ;;
*) RET=$REQ ;;
esac
fi

echo "$RET"
case "$RET" in
# client asks for 6.1.0 1.1.0 4.1.0 2.1.0
# upsAlarm
# 3
# alarmsonbattery, alarminputbad alarmchargerfailed
$PLACE.6.1.0) echo "gauge"; echo "1"; exit 0 ;;

# upsIdentManufacturer
$PLACE.1.1.0) echo "string"; echo "IMV Victron"; exit 0 ;;
# upsOutputSource
# other(1), none(2), normal(3), bypass(4), battery(5), booster(6), r
educer(7)
$PLACE.4.1.0) echo "integer"; echo "2"; exit 0 ;;

# upsBatteryStatus
# unknown(1), batteryNormal(2), batteryLow(3), batteryDepleted(4)
$PLACE.2.1.0) echo "integer"; echo "2"; exit 0 ;;

# upsIdent
# upsIdentModel
$PLACE.1.2.0) echo "string"; echo "Match 3000"; exit 0 ;;
# upsIdentSoftwareVersion
$PLACE.1.3.0) echo "string"; echo "1.53"; exit 0 ;;
# upsIdentAgentSoftwareVersion
$PLACE.1.4.0) echo "string"; echo "4.15"; exit 0 ;;
# upsIdentName
$PLACE.1.5.0) echo "string"; echo "Fake UPS on Linux"; exit 0 ;;
# upsIdentAttachedDevices
$PLACE.1.6.0) echo "string"; echo "serwery w PKE"; exit 0 ;;

# upsBattery
# upsSecondsOnBattery
$PLACE.2.2.0) echo "integer"; echo "0"; exit 0 ;;
# upsEstimatedMinutesRemaining
$PLACE.2.3.0) echo "integer"; echo "43"; exit 0 ;;
# upsEstimatedChargeRemaining
$PLACE.2.4.0) echo "integer"; echo "100"; exit 0 ;;
# upsBatteryVoltage
$PLACE.2.5.0) echo "integer"; echo "544"; exit 0 ;;
# upsBatteryCurrent
$PLACE.2.6.0) echo "integer"; echo "0"; exit 0 ;;
# upsBatteryTemperature
$PLACE.2.7.0) echo "integer"; echo "23"; exit 0 ;;

# upsInput
# upsInputLineBads
$PLACE.3.1.0) echo "counter"; echo "5"; exit 0 ;;
# upsInputNumLines
$PLACE.3.2.0) echo "integer"; echo "1"; exit 0 ;;
# upsInput Line 1
$PLACE.3.3.1.1.1) echo "integer"; echo "1"; exit 0 ;;
# upsInputFrequency
$PLACE.3.3.1.2.1) echo "integer"; echo "500"; exit 0 ;;
# upsInputVoltage
$PLACE.3.3.1.3.1) echo "integer"; echo "221"; exit 0 ;;
# upsInputCurrent
$PLACE.3.3.1.4.1) echo "integer"; echo "0"; exit 0 ;;
# upsInputPower
$PLACE.3.3.1.5.1) echo "integer"; echo "0"; exit 0 ;;

# upsOutput
# upsOutputFrequency
$PLACE.4.2.0) echo "integer"; echo "500"; exit 0 ;;
# upsOutputNumLines
$PLACE.4.3.0) echo "integer"; echo "1"; exit 0 ;;
# upsOutputLine 1
$PLACE.4.4.1.1.1) echo "integer"; echo "1"; exit 0 ;;
# upsOutputVoltage
$PLACE.4.4.1.2.1) echo "integer"; echo "214"; exit 0 ;;
# upsOutputCurrent
$PLACE.4.4.1.3.1) echo "integer"; echo "214"; exit 0 ;;
# upsOutputPower
$PLACE.4.4.1.4.1) echo "integer"; echo "382"; exit 0 ;;
# upsOutputPercentLoad
$PLACE.4.4.1.5.1) echo "integer"; echo "18"; exit 0 ;;

# upsBypass
# upsBypassFrequency
$PLACE.5.1.0) echo "integer"; echo "0"; exit 0 ;;
# upsBypassNumLines
$PLACE.5.2.0) echo "integer"; echo "0"; exit 0 ;;

# upsAlarm
# upsAlarmsPresent
$PLACE.6.2.1.1.1) echo "integer"; echo "13"; exit 0 ;;
$PLACE.6.2.1.1.2) echo "integer"; echo "6"; exit 0 ;;
$PLACE.6.2.1.1.3) echo "integer"; echo "13"; exit 0 ;;
$PLACE.6.2.1.2.1) echo "objectid"; echo "SNMPv2-SMI::mib-2.33.1.6.
3.2"; exit 0 ;;
$PLACE.6.2.1.2.2) echo "objectid"; echo "SNMPv2-SMI::mib-2.33.1.6.
3.6"; exit 0 ;;
$PLACE.6.2.1.2.3) echo "objectid"; echo "SNMPv2-SMI::mib-2.33.1.6.
3.13"; exit 0 ;;
$PLACE.6.2.1.3.1) echo "timeticks"; echo "150111220"; exit 0 ;;
$PLACE.6.2.1.3.2) echo "timeticks"; echo "150111220"; exit 0 ;;
$PLACE.6.2.1.3.3) echo "timeticks"; echo "148035520"; exit 0 ;;

# upsTests
# upsTestId
$PLACE.7.1.0) echo "objectid"; echo "SNMPv2-SMI::mib-2.33.1.7.7.4"
; exit 0 ;;
# upsTestSpinlock
$PLACE.7.2.0) echo "integer"; echo "1"; exit 0 ;;
# upsTestResultSummary
$PLACE.7.3.0) echo "integer"; echo "1"; exit 0 ;;
# upsTestResultDetail
$PLACE.7.4.0) echo "integer"; echo ""; exit 0 ;;
# upsTestStartTime
$PLACE.7.5.0) echo "timeticks"; echo "0"; exit 0 ;;
# upsTestElapsedTime
$PLACE.7.6.0) echo "integer"; echo "0"; exit 0 ;;

# upsControl
# upsShutdownType
$PLACE.8.1.0) echo "integer"; echo "1"; exit 0 ;;
# upsShutdownAfterDelay
$PLACE.8.2.0) echo "integer"; echo "-1"; exit 0 ;;
# upsStartupAfterDelay
$PLACE.8.3.0) echo "integer"; echo "-1"; exit 0 ;;
# upsRebootWithDuration
$PLACE.8.4.0) echo "integer"; echo "-1"; exit 0 ;;
# upsAutoRestart
$PLACE.8.5.0) echo "integer"; echo "1"; exit 0 ;;

# upsConfig
# upsConfigInputVoltage
$PLACE.9.1.0) echo "integer"; echo "230"; exit 0 ;;
# upsConfigInputFrequency
$PLACE.9.2.0) echo "integer"; echo "500"; exit 0 ;;
# upsConfigOutputVoltage
$PLACE.9.3.0) echo "integer"; echo "230"; exit 0 ;;
# upsConfigOutputFrequency
$PLACE.9.4.0) echo "integer"; echo "500"; exit 0 ;;
# upsConfigOutputVA
$PLACE.9.5.0) echo "integer"; echo "3000"; exit 0 ;;
# upsConfigOutputPower
$PLACE.9.6.0) echo "integer"; echo "2100"; exit 0 ;;
# upsConfigLowBatteryTime
$PLACE.9.7.0) echo "integer"; echo "2"; exit 0 ;;
# upsConfigAudibleStatus
$PLACE.9.8.0) echo "integer"; echo "2"; exit 0 ;;
# upsConfigLowVoltageTransferPoint
$PLACE.9.9.0) echo "integer"; echo "140"; exit 0 ;;
# upsConfigHighVoltageTransferPoint
$PLACE.9.10.0) echo "integer"; echo "305"; exit 0 ;;


*) echo "string"; echo "ack... $RET $REQ"; exit 0 ;;
esac


--
voytech

voytech

unread,
Aug 4, 2005, 12:36:36 PM8/4/05
to
> I am trying to build IMV Victron UPS simulator with Linux and net-snmpd.
> When I use snmpget all things works perfectly. However, client software
> (JUMPView 2.1.2) uses snmpgetnext too.
[..]

> I don't know, why my snmpd returns different oid with different value
> than UPS.
Problem solved.

Hint:

0 new messages