Hi coders,

we are using net-snmp for some years now to control power supplies 
-really a great project!
Some customers use OPAQUE double/float OIDs, and complain about the 
"wrong" resolution of snmpget (too many digits, to less resolution, 
...). The typical way up till now is to modify the correct printf() 
somewhere in the code and build a special version.
Now my idea is to add a new output option to your project, e.g.
-Op PRECISION_STRING
which allows to change the default behavior and inserts this precision 
string into the sprintfs used for output.
Looking at the float variables, this could work as follows:
Default:
$ snmpget somehost outputVoltage.1
WIENER-CRATE-MIB::outputVoltage.u0 = Opaque: Float: 0.000000 V
Now used the precision string "+020.12", which changes the sprintf 
format string from "%f" to "%+020.12f":
$ snmpget -Op +020.12 somehost outputVoltage.1
WIENER-CRATE-MIB::outputVoltage.u0 = Opaque: Float: +000000.000000000000 V

Another idea is to define a corresponding snmp.conf item.

What do you think about this approach? I implemented this in the 5.6.11 
sources, and would be happy to supply a patch. (I don't know whats the 
best practice to do: use 5.6.11 or stable sources or recent git, submit 
a patch in svn or diff format, ... may be you have some recommendations)

Thank you,

Andreas




------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to