02-10-2010 08:21 AM
Hi,
we are configuring HUM and we want to display the number of active calls in a gateway but we can't find any OID's that show exactly what we want. So we are going to use the EXPRESSION-MIB in order to calculate some values we need.
In MRTG we launch a snmpwalk query against the OID 1.3.6.1.4.1.9.9.63.1.3.1.1.9 (cvCallActiveInSignalLevel) and we count with a counter the number of rows obtained from that snmpwalk. The calculation is as follows:
@ret=snmpwalk(sigint03.'@'.'x.x.x.x'.'1.3.6.1.4.1.9.9.63.1.3.1.1.9');
foreach $campo (@ret) {
$cuenta=$cuenta+1;
}
print $cuenta."\n";
But we don't know how to implement the "foreach" loop with the EXPRESSION-MIB... and we don't know any other way for getting the number of active calls.
Can anybody please help me?
Regards.
Solved! Go to Solution.
03-04-2010 11:31 AM
Okay, let's try this:
snmpset -v 2c -c private router expNameStatus.110.110.110.110.110 i 6
snmpset -v 2c -c private router expNameStatus.110.110.110.110.110 i 5
snmpset -v 2c -c private router expExpressionIndex.110.110.110.110.110 gauge 1
snmpset -v 2c -c private router expExpressionComment.1 octetstring "numeroEntradas"
snmpset -v 2c -c private router expExpression.1 octetstring '$1 >= 1'
snmpset -v 2c -c private router expObjectID.1.1 o 1.3.6.1.4.1.9.9.63.1.3.1.1.5
snmpset -v 2c -c private router expExpressionValueType.1 i 4
snmpset -v 2c -c private router expObjectIDWildcard.1.1 i 1
snmpset -v 2c -c private router expObjectStatus.1.1 i 1
snmpset -v 2c -c private router expNameStatus.110.110.110.110.110 i 1
snmpset -v 2c -c private router expNameStatus.111.111.111.111.111 i 6
snmpset -v 2c -c private router expNameStatus.111.111.111.111.111 i 5
snmpset -v 2c -c private router expExpressionIndex.111.111.111.111.111 gauge 2
snmpset -v 2c -c private router expExpressionComment.2 octetstring "sumaEntradas"
snmpset -v 2c -c private router expExpression.2 octetstring 'sum($1)'
snmpset -v 2c -c private router expObjectID.2.1 o expValueInteger32Val.1.0.0
snmpset -v 2c -c private router expExpressionValueType.2 i 4
snmpset -v 2c -c private router expObjectIDWildcard.2.1 i 1
snmpset -v 2c -c private router expObjectStatus.2.1 i 1
snmpset -v 2c -c private router expNameStatus.111.111.111.111.111 i 1
02-10-2010 04:55 PM
What version of IOS as the EXPRESSION-MIB objects will be different depending on the version? Essentially, though, you will use a wildcard to sum up all of the instances. See the comments in the EXPRESSION-MIB for more details. Essentially, your object will be 1.3.6.1.4.1.9.9.63.1.3.1.1.9, and you will use a wildcard with the expression sum($1).
02-10-2010 05:03 PM
Whoops, I think I missed a step. You're just checking to see if this object is set, then adding to your count. In that case, you will need two expressions. The second will be sum($1) as I said (but using an EXPRESSION-MIB OID), but the first will exists($1) using the 1.3.6.1.4.1.9.9.63.1.3.1.1.9 OID.
02-11-2010 10:11 AM
Great!
Where can I find more information about these wildcards? I cannot find anything...
Regards.
02-11-2010 10:51 AM
It's all documented in the EXPRESSION-MIB. Look at the comments under "Wildcarding example" and the documentation of the expExpression object.
02-15-2010 01:58 PM
Sorry but it's my first time with the EXPRESSION-MIB and I'm very confused
So I don't know how to implement the counter I need: if I use the calculation counter32(
Thank you very much.
02-15-2010 09:14 PM
You shouldn't be using counter(32) as your expression. I'm fairly confident that using exists($1) for your first expression and sum($1) as your second expression should work.
02-22-2010 07:26 AM
I have to check of the object is set and then adding to the count, but these objects are part of 1.3.6.1.4.1.9.9.63.1.3.1.1.9 OID, and its type is integer32, do I have to check for all the possible objects??? Or can I do it with exists($1), and $1=1.3.6.1.4.1.9.9.63.1.3.1.1..* ?
I have written down the expressions as I think they are but I'm afraid of not being well and they can cause a crash in the device. File with the expressions is attached.
I will appreciate a lot if you could take a look at them.
02-22-2010 09:32 AM
You need to leave the ".*" off of the end of the OIDs. For wildcards, just put in the OID without any instances, then set the wildcard object to true. Your sum($2) expression should be sum($1). And your second OID needs to point to the entry in expValueTable:
expValueInteger32Val.1.0.0
I think everything else is right.
02-24-2010 10:01 AM
02-24-2010 10:02 PM
I still don't know the version of IOS you're using. Knowing that would allow me to properly test things locally.
02-25-2010 03:35 AM
Upps! Sorry.
I'm trying with a couple of routers which have following IOS:
- 12.4(3e)
- 12.4(11)T4
Many thanks!
02-25-2010 09:44 PM
Thanks, I'll play with this tomorrow, and send you an update.
02-26-2010 02:22 AM
Many thanks, I appreciate your help.
02-27-2010 11:44 AM
First, 12.4(11)T supports a new standards version of the EXPRESSION-MIB with an entire new object ID, and new configuration structure. But, as for 12.4 mainline, this should get you what you want:
snmpset -v 2c -c private router expNameStatus.110.110.110.110.110 i 6
snmpset -v 2c -c private router expNameStatus.110.110.110.110.110 i 5
snmpset -v 2c -c private router expExpressionIndex.110.110.110.110.110 gauge 1
snmpset -v 2c -c private router expExpressionComment.1 octetstring "numeroEntradas"
snmpset -v 2c -c private router expExpression.1 octetstring '$1 >= 0'
snmpset -v 2c -c private router expObjectID.1.1 o 1.3.6.1.4.1.9.9.63.1.3.1.1.1
snmpset -v 2c -c private router expExpressionValueType i 4
snmpset -v 2c -c private router expObjectIDWildcard.1.1 i 1
snmpset -v 2c -c private router expObjectStatus.1.1 i 1
snmpset -v 2c -c private router expNameStatus.110.110.110.110.110 i 1
snmpset -v 2c -c private router expNameStatus.111.111.111.111.111 i 6
snmpset -v 2c -c private router expNameStatus.111.111.111.111.111 i 5
snmpset -v 2c -c private router expExpressionIndex.101.50.101.120.112 gauge 2
snmpset -v 2c -c private router expExpressionComment.2 octetstring "sumaEntradas"
snmpset -v 2c -c private router expExpression.2 octetstring 'sum($1)'
snmpset -v 2c -c private router expObjectID.2.1 o expValueInteger32Val.1.0.0
snmpset -v 2c -c private router expExpressionValueType i 4
snmpset -v 2c -c private router expObjectIDWildcard.2.1 i 1
snmpset -v 2c -c private router expObjectStatus.2.1 i 1
snmpset -v 2c -c private router expNameStatus.111.111.111.111.111 i 1
Then, an snmpget on expValueInteger32.2.0.0.0 should give you the sum. Confirm this works before moving on to the new syntax.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: