NAME

SNMP::Info::Layer3::Mikrotik - SNMP Interface to Mikrotik devices

AUTHORS

Jeroen van Ingen initial version based on SNMP::Info::Layer3::NetSNMP by Bradley Baetz and Bill Fenner

SYNOPSIS

# Let SNMP::Info determine the correct subclass for you.
my $mikrotik = new SNMP::Info(
                         AutoSpecify => 1,
                         Debug       => 1,
                         DestHost    => 'myrouter',
                         Community   => 'public',
                         Version     => 2
                       )
   or die "Can't connect to DestHost.\n";

my $class      = $mikrotik->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";

DESCRIPTION

Subclass for Mikrotik devices

Inherited Classes

SNMP::Info::Layer3

Required MIBs

HOST-RESOURCES-MIB
MIKROTIK-MIB
Inherited Classes' MIBs

See SNMP::Info::Layer3 for its own MIB requirements.

GLOBALS

These are methods that return scalar value from SNMP

$mikrotik->vendor()

Returns 'mikrotik'.

$mikrotik->os()

Returns 'routeros'.

$mikrotik->model()

Returns mtxrBoardName, or else tries to extract the device model from sysDescr.

$mikrotik->os_ver()

Returns the value of mtxrLicVersion.

$mikrotik->os_level()

Returns the value of RouterOS level mtxrLicLevel

$mikrotik->board_temp()
$mikrotik->cpu_temp()

Returns the board or CPU temperature in degrees Celsius, from the mtxrHealth scalars or, on RouterOS 7, from mtxrGaugeTable.

$mikrotik->serial()

Returns the device serial.

$mikrotik->firmware()

Returns the firmware version of hardware.

$mikrotik->hasMNDP()

Returns 1 when mtxrNeighborTable has rows. has_topo() then adds mndp, so the c_* topology methods include those neighbors.

$mikrotik->mac()

Returns the LLDP chassis MAC (lldp_loc_id()). ifPhysAddress.1 is the loopback on RouterOS and reads as all zeros; it is used only when there is no LLDP chassis ID.

$mikrotik->mt_board_name()

(mtxrBoardName)

$mikrotik->ps1_status()
$mikrotik->ps2_status()

Returns ok or fail from mtxrHlPowerSupplyState or mtxrHlBackupPowerSupplyState. Without them, returns the psu1-state or psu2-state row of mtxrGaugeTable: ok, fail, not-present, idle or no-input.

$mikrotik->fan()

Returns the fan-state row of mtxrGaugeTable (ok or fail) and the fan speeds, for example ok, fan1 3825 rpm, fan2 3945 rpm. Speeds come from mtxrHlFanSpeed1 and mtxrHlFanSpeed2, or else the fanN-speed rows of mtxrGaugeTable.

$mikrotik->mt_psu_state()

(mtxrHlPowerSupplyState)

$mikrotik->mt_backup_psu_state()

(mtxrHlBackupPowerSupplyState)

$mikrotik->mt_fan1_speed()

(mtxrHlFanSpeed1)

$mikrotik->mt_fan2_speed()

(mtxrHlFanSpeed2)

Globals imported from SNMP::Info::Layer3

See documentation in SNMP::Info::Layer3 for details.

TABLE ENTRIES

These are methods that return tables of information in the form of a reference to a hash.

Overrides

$mikrotik->c_ip()

For an LLDP neighbor that advertises no IPv4 management address, returns the address mtxrNeighborTable has for the same neighbor (matched on local port and name), for example one learned by CDP. Failing that it returns 0.0.0.0, so Netdisco can resolve the neighbor by c_id(). RouterOS advertises only addresses on the sending port or its bridge, not on VLAN interfaces.

$mikrotik->i_vlan_membership()

Returns reference to hash of arrays: key = ifIndex, value = array of VLAN IDs. Uses Q-BRIDGE-MIB when the device exports VLAN tables. RouterOS exports only the port PVID, so each port's PVID is returned instead, except on ports that admit only tagged frames. Tagged VLANs are not available.

$mikrotik->i_vlan_membership_untagged()

Returns reference to hash of arrays: key = ifIndex, value = array of VLAN IDs. Same source and fallback as i_vlan_membership().

MikroTik neighbors (mndp)

mtxrNeighborTable lists neighbors heard by MNDP, CDP and LLDP. These methods return the ones LLDP-MIB does not already report on the same port, and only those with an IPv4 address. They are keyed by mtxrNeighborIndex.

$mikrotik->mndp_ip()

(mtxrNeighborIpAddress)

$mikrotik->mndp_if()

Local ifIndex (mtxrNeighborInterfaceID).

$mikrotik->mndp_id()

Neighbor MAC address (mtxrNeighborMacAddress).

$mikrotik->mndp_platform()

(mtxrNeighborPlatform)

$mikrotik->mndp_port()
$mikrotik->mndp_cap()

Return an empty hash: the table has no remote port or capabilities.

MikroTik neighbor table (MIKROTIK-MIB::mtxrNeighborTable)

$mikrotik->mt_nbr_ip()

(mtxrNeighborIpAddress)

$mikrotik->mt_nbr_mac()

(mtxrNeighborMacAddress)

$mikrotik->mt_nbr_identity()

(mtxrNeighborIdentity)

$mikrotik->mt_nbr_platform()

(mtxrNeighborPlatform)

$mikrotik->mt_nbr_if()

(mtxrNeighborInterfaceID)

Gauge Table (mtxrGaugeTable)

$mikrotik->mt_gauge_name()

(mtxrGaugeName)

$mikrotik->mt_gauge_value()

(mtxrGaugeValue)

Power over Ethernet

When the device has no POWER-ETHERNET-MIB port table, these methods emulate it from mtxrPOETable. Entries are keyed 1.ifIndex.

$mikrotik->peth_port_ifindex()

Maps 1.ifIndex to ifIndex, from the mtxrPOETable index.

$mikrotik->peth_port_admin()

false when mtxrPOEStatus is disabled, else true.

$mikrotik->peth_port_status()

From mtxrPOEStatus: poweredOn is deliveringPower, waitingForLoad is searching, disabled is disabled; overload, short circuit, voltage, current and controller errors are fault; anything else is otherFault.

$mikrotik->peth_port_power()

Power the port is delivering, in milliwatts (mtxrPOEPower).

$mikrotik->peth_power_watts()
$mikrotik->peth_power_status()

RouterOS exports no PoE budget, so these return an empty hash.

$mikrotik->mt_poe_status()

(mtxrPOEStatus)

$mikrotik->mt_poe_power()

(mtxrPOEPower)

Table Methods imported from SNMP::Info::Layer3

See documentation in SNMP::Info::Layer3 for details.