NAME
Net::SolarWinds::REST::Batch - SolarWinds Batch Process class
SYNOPSIS
use
strict;
use
warnings;
use
Data::Dumper;
my
$self
=new Net::SolarWinds::REST::Batch;
my
$result
=
$self
->get_node(
'kstlldrmap04'
);
die
$result
unless
$result
;
Dumper(
$result
->get_data);
DESCRIPTION
A wrapper class for Net::SolarWinds::REST, that provides high level batch like interfaces that tie a lot of the smaller functions togeather.
Extends Net::SolarWinds::REST
All of the base funtions provided by Net::SolarWinds::REST are included in this module, for better or worse!
OO Methods
This section covers the OO Methods of the class.
my $result=$self->manage_node($struct,$allow_failure);
$allow_failure is optional, if not defined it is set to true. The flag allows for the falure of anything other than the node itself not being created.
A fairly complex interface used to build out a node for management.
Example of the data of $struct:
{
# list of snmp pollers for the node
# see also: add_pollers
"node_pollers"
=> [
"N.AssetInventory.Snmp.Generic"
,
"N.Cpu.SNMP.HrProcessorLoad"
,
"N.Details.SNMP.Generic"
,
"N.Memory.SNMP.NetSnmpReal"
,
"N.ResponseTime.ICMP.Native"
,
"N.ResponseTime.SNMP.Native"
,
"N.Status.ICMP.Native"
,
"N.Status.SNMP.Native"
,
"N.Topology_Layer3.SNMP.ipNetToMedia"
,
"N.Uptime.SNMP.Generic"
],
# see also: add_volumes
"volumes"
=> [
"/home/apm"
,
"/tmp"
,
"/var"
],
# The Network Interfaces to monitor
# see also: manage_interfaces
"interfaces"
=>[
"eth0"
,
"eth1"
,
"eth2"
],
"custom_properties"
=>{
"dcinstance"
=>
"production"
,
"administrator"
=>
"EMS/NMS"
,
},
# denote if this node needs to be replaced as it is created
# see also, build_node
"replace"
=> false,
# The disk volumes to monitor
# Argumetns required to build a node
# see also, build_node
"node"
=> {
"EngineID"
=> 18,
"Status"
=> 1,
"IPAddress"
=>
"192.168.101.38"
,
"RediscoveryInterval"
=> 30,
"Community"
=>
"public"
,
"DisplayName"
=>
"kstlldrmap04"
,
"MachineType"
=>
"net-snmp - Linux"
,
"UnManaged"
=> false,
"PollInterval"
=> 46,
"StatCollection"
=> 10,
"SysObjectID"
=>
"1.3.6.1.4.1.8072.3.2.10"
,
"SNMPVersion"
=> 2,
"DynamicIP"
=> false,
"Caption"
=>
"kstlldrmap04"
,
"ObjectSubType"
=>
"SNMP"
,
"VendorIcon"
=>
"8072.gif "
,
"Allow64BitCounters"
=> true
},
# Note: This requires the APM module in Solarwinds
# denote objects used to create templates
# see also: add_templates
"templates"
=> [
"SDS - Application details-U/L - Warning"
,
"SDS - DMS Adaptor Daemon Monitor - Critical"
,
"SDS - Drum - Warning"
,
"AWS Mail Alert Daemon"
,
"CPM Ghosting"
]
}
my $result=$self->get_node($thing);
$thing can contain any one of the following: NodeID, IpAddress, Caption.
This method returns a Net::SolarWinds::Result object.
When true it contains the first node found that matched what was passed in as $thing.
When false it contains why it failed.
my $result=$self->set_managed($thing,0|1);
This is really just a wrapper for $self->get_node followed by $self->UpdateNodeProps($node_id,UnManaged=>0|1);
Returns a Net::SolarWinds::Result object
my $result=$self->get_management_config($thing);
Programatic way build a refrence template for: manage_node
Returns a Net::SolarWinds::Result object If true, it contains a data structure requried to build out the node refred to as $thing. If false, it contains why it failed.
my $result=$self->get_poller_map($id,$type);
Used to get a uniqe hash of all pollers assigned to this object.
$id can be: NodeID $type=N VolumeID $type=V InterfaceID $type=I
Returns a Net::SolarWinds::Result object.
my $result=$self->getPollerInterfaceMap($nodeid)
Returns a Net::SolarWinds::Result object, when true it contains a hash mapping ifType to PollerType
my $result=$self->GetNodeInterfacePollers($nodeid)
When true it returns a Net::SolarWinds::Result object that contains the interface poller and id info.
my $result=$self->add_pollers($id,$t,@pollers);
Adds a list of pollers of type to given id.
$id can be: NodeID $type=N VolumeID $type=V InterfaceID $type=I
@polers contains a list of snmp pollers.
Example:
"N.Details.SNMP.Generic"
,
"N.ResponseTime.ICMP.Native"
,
"N.ResponseTime.SNMP.Native"
,
"N.Status.ICMP.Native"
,
"N.Status.SNMP.Native"
,
"N.Uptime.SNMP.Generic"
Returns a Net::SolarWinds::Result Object.
my $result=$self->add_volumes($node_id,@vols);
$node_id is the NodeID of the device
@vols can contain a mix of [either list of objects or volume names.
Object Example:
{
"pollers"
=> [
"V.Details.SNMP.Generic"
,
"V.Statistics.SNMP.Generic"
,
"V.Status.SNMP.Generic"
],
"type"
=>
"Network Disk"
,
"path"
=>
"/home/apm"
},
String Example:
'/var'
When using the string example, the default pollers are added.
my $result=$self->add_templates($node_id,@templates);
Add a list of templates to the device for monitoring.
$$node_id is the NodeID of the node
@templates Example list:
"SDS - Application details-U/L - Warning"
,
"SDS - DMS Adaptor Daemon Monitor - Critical"
,
"SDS - Drum - Warning"
,
"AWS Mail Alert Daemon"
,
"CPM Ghosting"
my $result=$self->manage_interfaces($node_id,@interfaces);
$node_id is the "NodeID" of the machine to work with
@interfaces contains a list of Object hashes or interface names.
Object Example: In the object example all details, such as the pooler and custom properties are set manually.
{
"pollers"
: [
"I.Rediscovery.SNMP.IfTable"
,
"I.StatisticsErrors32.SNMP.IfTable"
,
"I.StatisticsTraffic.SNMP.Universal"
,
"I.Status.SNMP.IfTable"
],
"ifname"
:
"eth1"
,
"custom_props"
: {
"alert_rx_percent_utilization"
: 90,
"alarmerrorrate"
: 0,
"alert_tx_percent_utilization"
: 90
}
}
Interface name example: In the interface name example just the name of the interface is passed.
'eth0'
Odds are you will just want to use a list of human readable interface names:
"eth0"
,
"eth1"
,
"eth2"
Notes:
Gives up at the first error, and may not complete the process of adding things. Odds are this code will need to be made more forgiving.
my $result=$self->create_or_update_node($ip,%args);
Wrapper for $self->build_node with $DeleteIfExists set to false
my $result=$self->replace_node($ip,%args);
Wrapper for $self->build_node with $DeleteIfExists set to true
my $result=$self->build_node($ip,$DeleteIfExists,%args);
Used to create a node if it does not exist.
Variabels: $ip The ipv4 address of the box
$DeleteIfExists
if
this value is set to true and this node
exists
all ready
it will be deleted and re-created!
%args
The node properties
See also: Net::SolarWinds::REST::UpdateNodeProps
my $result=$self->build_unmanaged($ip,$DeleteIfExists,%args);
Wrapper for build_node, flips the node to UnManaged=>1 once it has been created or if it all ready exists.
my $result=$self->GetAlertSettingsMap($thing);
When true, returns a data structure that represents alerting thresholds and custom properties for the node, and its interfaces, templates, and volumes. when fals: returns why it failed
$thing can be a nodeid, hostname or ipaddress.
my $result=$self->bulk_ip_lookup(@ip_list)
Returns a SolarWinds::Result Object.
When true it contains the search results of all the ips that were looked up
AUTHOR
Michael Shipper