NAME

Net::Intermapper::Device - Interface with the HelpSystems Intermapper HTTP API - Devices

SYNOPSIS

  use Net::Intermapper;
  my $intermapper = Net::Intermapper->new(hostname=>"10.0.0.1", username=>"admin", password=>"nmsadmin");
  # Options:
  # hostname - IP or hostname of Intermapper 5.x and 6.x server
  # username - Username of Administrator user
  # password - Password of user
  # ssl - SSL enabled (1 - default) or disabled (0)
  # port - TCP port for querying information. Defaults to 8181
  # modifyport - TCP port for modifying information. Default to 443
  # cache - Boolean to enable smart caching or force network queries

  my %users = $intermapper->users;
  my $users_ref = $intermapper->users;
  # Retrieve all users from Intermapper, Net::Intermapper::User instances
  # Returns hash or hashref, depending on context
  
  my %devices = $intermapper->devices;
  my $devices_ref = $intermapper->devices;
  # Retrieve all devices from Intermapper, Net::Intermapper::Device instances
  # Returns hash or hashref, depending on context

  my %maps = $intermapper->maps;
  my $maps_ref = $intermapper->maps;
  # Retrieve all maps from Intermapper, Net::Intermapper::Map instances
  # Returns hash or hashref, depending on context

  my %interfaces = $intermapper->interfaces;
  my $interfaces_ref = $intermapper->interfaces;
  # Retrieve all interfaces from Intermapper, Net::Intermapper::Interface instances
  # Returns hash or hashref, depending on context

  my %vertices = $intermapper->vertices;
  my $vertices_ref = $intermapper->vertices;
  # Retrieve all vertices from Intermapper, Net::Intermapper::Vertice instances
  # Returns hash or hashref, depending on context

  my $user = $intermapper->users->{"admin"};
  
  # Each class will generate specific header. These are typically only for internal use but are compliant to the import format Intermapper uses.
  print $user->header; 
  print $device->header;
  print $map->header;
  print $interface->header;
  print $vertice->header;

  print $user->toTAB;
  print $device->toXML; # This one is broken still!
  print $map->toCSV;
  # Works on ALL subclasses
  # Produce human-readable output of each record in the formats Intermapper supports
  
  my $user = Net::Intermapper::User->new(Name=>"testuser", Password=>"Test12345");
  my $response = $intermapper->create($user);
  # Create new user
  # Return value is HTTP::Response object
  
  my $device = Net::Intermapper::Device->new(Name=>"testDevice", MapName=>"TestMap", MapPath=>"/TestMap", Address=>"10.0.0.1");
  my $response = $intermapper->create($device);
  # Create new device
  # Return value is HTTP::Response object

  $user->Password("Foobar123");
  my $response = $intermapper->update($user);
  # Update existing user
  # Return value is HTTP::Response object

  my $user = $intermapper->users->{"bob"};
  my $response = $intermapper->delete($user);
  # Delete existing user
  # Return value is HTTP::Response object

  my $device = $intermapper->devices->{"UniqueDeviceID"};
  my $response = $intermapper->delete($device);
  # Delete existing device
  # Return value is HTTP::Response object

  my $users = { "Tom" => $tom_user, "Bob" => $bob_user };
  $intermapper->users($users);
  # At this point, there is no real reason to do this as update, create and delete work with explicit arguments.
  # But it can be done with users, devices, interfaces, maps and vertices
  # Pass a hashref to each method. This will NOT affect the smart-caching (only explicit calls to create, update and delete do this - for now).
   

DESCRIPTION

Net::Intermapper::Device is a perl wrapper around the HelpSystems Intermapper API provided through HTTP/HTTPS for access to device information.

All calls are handled through an instance of the Net::Intermapper class.

  use Net::Intermapper;
  my $intermapper = Net::Intermapper->new(hostname => '10.0.0.1', username => 'admin', password => 'nmsadmin');

USAGE

new

Class constructor. Returns object of Net::Intermapper::Device on succes. Attributes are:

MapName (read-only)

Name of the map containing the device.

MapPath (read-only)

Full path of the map containing the device, including the name of the map.

Address (read-write)

The IP or AppleTalk address of the device that is probed by InterMapper. The IP address is represented in dotted-decimal notation, e.g. 'a.b.c.d'. The AppleTalk address is represented in slash notation, e.g. 'a/b'.

Id (read-only)

A unique, persistent identifier for this device instance. The Id will be unique across all maps on a single InterMapper server. This value is used for lookups in the users method in Net::Intermapper.

Name (read-only)

The name of the device. The name is the first non-empty line in a device's label on a map.

Probe (read-write)

The human-readable name of the InterMapper probe.

Comment (read-write)

The comment associated with the device.

Community (read-write)

The SNMP community of the device.

DisplayIfUnNumbered (read-write)

True if the device's behaviour is set to display unnumbered interfaces.

DNSName (read-write)

The fully-qualified DNS name of the device.

IgnoreIfAppleTalk (read-write)

True if the device's behaviour is to ignore AppleTalk interface information.

IgnoreIfDiscards (read-write)

True if the device's behaviour is to ignore interface discards.

IgnoreIfErrors (read-write)

True if the device's behaviour is to ignore interface errors.

IgnoreOutages (read-write)

True if the device's behaviour is to ignore outages.

AllowPeriodicReprobe (read-write)

True if the device's behaviour is to allow periodic reprobe.

IMProbe (read-write)

A special URL representation describing the InterMapper probe and its parameters, e.g. improbe://address:port/...

Latitude (read-write)

The latitude of the device. The value will be a double within the range [-90..90] or empty string if the device does not have this attribute set.

Longitude (read-write)

The longitude of the device. The value will be a double within the range [-180..180] or empty string if the device does not have this attribute set.

LastTimeDown (read-only)

The time when the device last went down. Value is 0 if device has not gone down since we started monitoring it.

LastTimeSysUp (read-only)

The time when the device last came up (ie rebooted), based on the value of sysUpTime. The value is 0 if unknown.

LastTimeUp (read-only)

The time when the device status last transitioned from DOWN to UP. Value is 0 if this has not happened since we started monitoring.

MACAddress (read-only)

The device's MAC Address. If the device has multiple interfaces, this field will contain the MAC Address associated with the device's main IP Address (the same address in the address field).

MapAs (read-write)

Value is one of { ROUTER , SWITCH , HUB, END SYSTEM }

MapId (read-only)

The unique Id of the map file containing the device.

MaxTries (read-write)

The maximum number of attempts to reach the device, typically indicates the maximum number of packets to send during each poll, for packet-based probes.

NetBIOSName (read-write)

The NetBIOS/WINS name of the device.

PctLoss (read-only)

The percent loss (# packets lost/total # packets sent).

ShortTermPctLoss (read-only)

The short-term percent loss (# packets lost/# packets sent).

Availability (read-only)

The percent availability (time up/time monitored).

PollInterval (read-write)

The poll interval of the device, in seconds. Value is 0 if non-polling.

Port (read-write)

The UDP or TCP port number. If the port number is not applicable, this value is always 0. (e.g. for ICMP)

Resolve (read-write)

Value is one of { name , addr , none }.

RoundTripTime (read-only)

The last round-trip time in milliseconds, if known.

SNMPv3AuthPassword (read-write)

The device's SNMPv3 authentication password.

SNMPv3AuthProtocol (read-write)

The device's SNMPv3 authentication protocol (MD5, SHA, None).

SNMPv3PrivPassword (read-write)

The device's SNMPv3 privacy password.

SNMPv3PrivProtocol (read-write)

The device's SNMPv3 privacy protocol (DES, None).

SNMPv3UserName (read-write)

The device's SNMPv3 user name.

SNMPVersion (read-write)

The device's SNMP version (SNMPv1, SNMPv2c, or SNMPv3).

Status (read-only)

The status of the device. The value is one of { 'UP', 'DOWN', 'UNKNOWN' }.

StatusLevel (read-only)

The status level of the device. The value is one of { 'Unknown', 'OK', 'Warning, Acked', 'Warning', 'Alarm, Acked', 'Alarm', 'Critical', 'Critical, Acked', 'Down', 'Down, Acked'}.

StatusLevelReason (read-only)

The reason the device has its status level.

SysDescr (read-only)

The value of sysDescr.

SysName (read-only)

The value of sysName.

SysContact (read-only)

The value of sysContact.

SysLocation (read-only)

The value of sysLocation.

SysObjectID (read-only)

The value of sysObjectID.

TimeOut (read-write)

The timeout of the device, in seconds. Value is 0 if not-applicable to the probe.

IMID (read-only)

Identifier of the device in the IMID format.

Type (read-only)

One of { none, other, snmp, tcp, udp, icmp, cmd, bigbro, ntsvcs }. These values have been updated in 5.0 to match the values used by the database in the probekind field of the devices table.

ProbeXML (read-only)

XML dataset DTD, type='probe'.

SNMPVersionInt (read-only)

1, 2, 3 - SNMP versions. 0 for non-SNMP.

SysServices (read-only)

16-bits integer.

EntSerialNum (read-only)

SnmpAdminString (entPhysicalSerialNum of chassis).

EntMfgName (read-only)

SnmpAdminString (entPhysicalMfgName of chassis).

EntModelName (read-only)

SnmpAdminString (entPhysicalModelName of chassis).

DataRetentionPolicy (read-only)

Data retention policy for IM Database

CustomerNameReference (read-only)

Customer-supplied device name reference, for linking to an external database.

EnterpriseID (read-only)

The value of sysEnterpriseID.

DeviceKind (read-only)

User-specified device type.

SysUpTime (read-only)

System uptime.

LastModified (read-only)

Timestamp of last modification to this device.

Parent (read-only)

Device ID of the parent probe group; this device's id if this device is a probe group; 0 if the device is not part of a probe group.

Acknowledge (read-write)

The acknowledgement state of the device; one of { 'None', 'Basic', 'Maintenance' }. The AckMessage field must also be set to import this field. Indefinite maintenance will be set if AckExpiration is missing and state is set to 'Maintenance'.

AckMessage (read-write)

The message associated with the acknowledge state. If Acknowledge is not set and an AckMessage is supplied, Acknowledge will be set to 'Basic'.

AckExpiration (read-write)

The absolute time when the timed acknowledgement expires, if any. The AckMessage field must also be set to import this field. Acknowledge will be set to 'Maintenance' if not supplied.

AckTimer (read-only)

The time in seconds remaining until the timed acknowledgement expires, if any.

VertexId (read-only)

The Vertex Id of the vertex associated with the device. Matches the VertexId of the corresponding vertex in the vertices table.

Layer2 (read-only)

True if layer2 mapping is enabled for this device.

Returns the directive aka data header required by the Intermapper API to perform CRUD actions. This is handled through the create, update and delete method and should not really be used.

toTAB

Returns the object data formatted in TAB delimited format. Used in combination with the header and the format method in Net::Intermapper to perform CRUD actions. This is handled through the create, update and delete method and should not really be used.

toCSV

Returns the object data formatted in Comma Separated delimited format. Used in combination with the header and the format method in Net::Intermapper to perform CRUD actions. This is handled through the create, update and delete method and should not really be used.

toXML

Returns the object data formatted in XML format. Used in combination with the header and the format method in Net::Intermapper to perform CRUD actions. This is handled through the create, update and delete method and should not really be used.

mode

Internal method to properly format the data and header for CRUD actions. Typically not used.

$ERROR

NEEDS TO BE ADDED

This variable will contain detailed error information.

REQUIREMENTS

For this library to work, you need an instance with Intermapper (obviously) or a simulator like Net::Intermapper::Mock.

Moose
IO::Socket::SSL
LWP::UserAgent
XML::Simple
MIME::Base64
URI::Escape
Text::CSV_XS

BUGS

None so far

SUPPORT

None so far :)

AUTHOR

    Hendrik Van Belleghem
    CPAN ID: BEATNIK
    hendrik.vanbelleghem@gmail.com

COPYRIGHT

This program is free software licensed under the...

        The General Public License (GPL)
        Version 2, June 1991

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO

http://download.intermapper.com/docs/UserGuide/Content/09-Reference/09-05-Advanced_Importing/the_directive_line.htm http://download.intermapper.com/schema/imserverschema.html