NAME
Net::Intermapper::Map - Interface with the HelpSystems Intermapper HTTP API - Maps
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 map 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::Map on succes. Attributes are:
- MapId (read-only)
-
A unique, persistant identifier for this map instance.
- MapName (read-only). This value is used for lookups in the
users
method in Net::Intermapper. -
Name of the map.
- MapPath (read-only)
-
Full path of the map, including the name of the map.
- Status (read-only)
-
Status of the map (e.g. down, critical, alarm, warning, okay).
- DeviceCount (read-only)
-
Number of devices in the map.
- NetworkCount (read-only)
-
Number of networks in the map.
- InterfaceCount (read-only)
-
Number of interfaces in the map.
- DownCount (read-only)
-
Number of devices that are down.
- CriticalCount (read-only)
-
Number of devices in critical status.
- AlarmCount (read-only)
-
Number of devices in alarm status.
- WarningCount (read-only)
-
Number of devices in warning status.
- OkayCount (read-only)
-
Number of okay devices.
- DataRetentionPolicy (read-only)
-
Database retention policy.
- IMID (read-only)
-
Identifier of the map in the IMID format.
- Enabled (read-only)
-
True if the map is currently running.
- Layer2 (read-only)
-
True if the map is enabled for layer 2 polling.
- header
-
Returns the
directive
aka data header required by the Intermapper API to perform CRUD actions. This is handled through thecreate
,update
anddelete
method and should not really be used.
- toTAB
-
Returns the object data formatted in TAB delimited format. Used in combination with the
header
and theformat
method in Net::Intermapper to perform CRUD actions. This is handled through thecreate
,update
anddelete
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 theformat
method in Net::Intermapper to perform CRUD actions. This is handled through thecreate
,update
anddelete
method and should not really be used.
- toXML
-
Returns the object data formatted in XML format. Used in combination with the
header
and theformat
method in Net::Intermapper to perform CRUD actions. This is handled through thecreate
,update
anddelete
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.
BUGS
None yet
SUPPORT
None yet :)
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