SNMP Access Using Scripts

From Observer GigaFlow Support | VIAVI Solutions Inc.
Revision as of 09:39, 23 January 2017 by Kevin Wilkie (Talk | contribs)

Jump to: navigation, search

Querying a number (uptime in this case) from an infrastructure device

var ip="83.70.199.182"
var thisDevice = actions.getDevice(ip);
if (thisDevice != null) {
 var uptime = actions.querySNMPNumber(thisDevice, '.1.3.6.1.2.1.1.3.0', -1);
 log.warn('Uptime for device ' + ip+" "+thisDevice.getName()+" "+uptime);
}else{
 log.warn("No such managed device "+ip);
}