Difference between revisions of "SNMP Access Using Scripts"

From Observer GigaFlow Support | VIAVI Solutions Inc.
Jump to: navigation, search
(Created page with "Querying a number from an infrastructure device var ip="83.70.199.182" var thisDevice = actions.getDevice(ip); if (thisDevice != null) { var uptime = actions.querySNMPNum...")
 
Line 1: Line 1:
Querying a number from an infrastructure device
+
Querying a number (uptime in this case) from an infrastructure device
 
  var ip="83.70.199.182"
 
  var ip="83.70.199.182"
 
  var thisDevice = actions.getDevice(ip);
 
  var thisDevice = actions.getDevice(ip);

Revision as of 09:39, 23 January 2017

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);
}