Creating a custom service handler

From ISPWiki

Jump to: navigation, search

If you run DSmanager 4.4.16 and later, you may use external modules for your needs.

Contents

How it works

External modules are executable files. DSmanager exchanges data with a module through stdin and stdout.

DSmanager "polls" the modules in turn by calling executable files from the addon/equipment directory with the "-info" key.

Following is the list of keys the module must support and the information it must return:

  • -info - module information, such as its name, supported functions, author
  • -status - status of the device ports
  • -on enable - the device ports
  • -off disable - the device ports
  • -reset reset - the device ports (for resets)
  • -statistics - traffic (for switches) or power consumption information (for resets)
  • -mac - information about the port MAC-addresses (to search for servers)

To call a module by the key, a number of input and output parameters that are passed through stdin и stdout are used. Both input and output parameters should be space separated, each parameter beginning with the " Name Value\n" string. A string must be quoted.

Example:

   Input parameter:
   DEVICE_IP "82.146.37.12"
   Output parameter:
   PORT_1_ADMINSTATUS 0            this is a number
   PORT_1_INFO "Ethernet 1"        this is a string

Following is a detailed description of the keys and their parameters.

where: $PortId - ID of the device port.

-info

DSmanager uses this key to get information. The data returned defines the way DSmanager will use the module.

Input parameters

No input parameters are used.

Output parameters

ParameterPossible valuesDescription
Description [Mandatory]any string.Name of the module that will display in DSmanager when adding a device. String value.
Type [Obligatory]"Switch","Reset", "Ipmi". String value.Device type.
AuthorAny stringAuthor module.
FUNC_statusCan be "on" or "off".The module can get statuses of the device ports.
FUNC_on_offCan be "on" or "off".The module can enable/disable the device ports.
FUNC_resetCan be "on" or "off".The module can reset the device ports. Can be used by resets that support the "Reset" function. DSmanager will first disable and than enable the port while resetting.
FUNC_speedCan be "on" or "off".The module can change the device port speed.
FUNC_statisticsCan be "on" or "off".The module can get traffic information (from the switch ports) or power consumption (resets).
FUNC_mac_tableCan be "on" or "off".The module can return the table with MAC address of the device ports. Used to search for new servers.

-status

The key is used to get a device status.

Input parameters

ParameterPossible valuesDescription
DEVICE_IPString. Example "10.10.10.56"Device IP address
DEVICE_NAMEString. Device name.
DEVICE_USERString.Username that is used to access the device.
DEVICE_PASSString.Password that is used to access the device.
DEVICE_TELNET_USERString.Username that is also used to access the device (for example, through Telnet).
DEVICE_TELNET_PASSString.Password that is also used to access the device (for example, through Telnet).

Output parameters

ParameterPossible valuesDescription
PORT_$PortId_ADMINSTATUSNumber.
1 - On
2-Off
Port status set by administrator.
PORT_$PortId_OPERSTATUSNumber.
1-Used
2-Not used
Current port status. Used to search for a new server.
PORT_$PortId_ADMINSPEEDNumber.
1 - Auto
2 - Auto10Mb-100Mb
10000000 - 10Mb
100000000 - 100Mb
1000000000 - 1Gb
10 - 10Gb
Port speed.
PORT_$PortId_INFOStringPort description. this string will be added into the "Description" field on the list of device ports.

-on -off and -reset

This key is used to enable a device port.

Input parameters

ParameterPossible valuesDescription
DEVICE_IPString. Example "10.10.10.56"Device IP address
DEVICE_NAMEString. Device name.
DEVICE_USERString.Username to access the device.
DEVICE_PASSString.Password to access the device.
DEVICE_TELNET_USERString.Username that is also used to access the device(for example, through Telnet).
DEVICE_TELNET_PASSString.Password that is also used to access the device(for example, through Telnet).
DEVICE_PORT_IDString.Port's ID. Always use "power" for IPMI.

Output parameters

ParameterPossible valuesDescription
PORT_$PortId_ADMINSTATUSNumber.
1 - On
2 - Off
Port status set by administrator.
PORT_$PortId_OPERSTATUSNumber.
1 - Used
2 - Not used
Current port status.
PORT_$PortId_INFOString.Port description. It will be added into the "Description" filed on the list of device ports.

Always use "power" for IPMI.

"PORT_$PortId_ADMINSTATUS" is the only obligatory parameter

-speed

This key is used to set the switch speed.

Input parameters

ParameterPossible valuesDescription
DEVICE_IPString. Example"10.10.10.56"Device IP address
DEVICE_NAMEString.Device name.
DEVICE_USERString.Username to access the device.
DEVICE_PASSString.Password to access the device.
DEVICE_TELNET_USERString.Username that is also used to access the device.(for example, through через Telnet).
DEVICE_TELNET_PASSString.Password that is also used to access the device.(for example, through через Telnet).
DEVICE_PORT_IDString.Port ID.
DEVICE_PORT_SPEEDString.
"ADMINSPEED_AUTO" - Auto
"ADMINSPEED_AUTO_10_100M" - Auto10Mb/100Mb
"ADMINSPEED_10M" - 10Mb
"ADMINSPEED_100M" - 100Mb
"ADMINSPEED_1G" - 1Gb
"ADMINSPEED_10G" - 10Gb
Required port speed.

Output parameters

ParameterPossible valuesDescription
PORT_$PortId_ADMINSPEEDNumber.
1 - Auto
2 - Auto10Mb-100Mb
10000000 - 10Mb
100000000 - 100Mb
1000000000 - 1Gb
10 - 10Gb
Port speed.

"PORT_$PortId_ADMINSPEED" is the only obligatory output parameter.

-statistics

This key is used to collect information on traffic or power consumption. The module will return the counter statuses and DSmanager will calculate the result.

Input parameters

ParameterPossible valuesDescription
DEVICE_IPString. Example "10.10.10.56"Device IP address
DEVICE_NAMEString.Device name.
DEVICE_USERString.Username to access the device.
DEVICE_PASSString.Password to access the device.
DEVICE_TELNET_USERString.Username that is also used to access the device.(for example, through через Telnet).
DEVICE_TELNET_PASSString.Password that is also used to access the device.(for example, through через Telnet).

Output parameters

ParameterPossible valuesDescription
PORT_$PortId_INCOUNTERNumber.Status of the "incoming " counter in bytes (for switches).
PORT_$PortId_OUTCOUNTERNumber.Status of the "outgoing" counter in bytes (for switches).
PORT_$PortId_POWERNumber.Status of the power consumption counter in watt-hours (for resets).

-mac

This key is used to get information about MAC addresses assigned to switch ports. Used to search for new servers.

Input parameters

ParameterPossible valuesDescription
DEVICE_IPString. Example "10.10.10.56"Device IP address
DEVICE_NAMEString.Device name.
DEVICE_USERСтрока.Username to access the device.
DEVICE_PASSString.Password to access the device.
DEVICE_TELNET_USERString.Username that is also used to access the device.(for example, through через Telnet).
DEVICE_TELNET_PASSString.Password that is also used to access the device.(for example, through через Telnet).

Output parameters

Output parameters are a set of records, each record consisting of two parameters.

ParameterPossible valueDescription
MAC_REC_$PortId_PORTString.Port ID.
MAC_REC_$PortId_MACString.Possible format:
00:00:00:00:00:00
00-00-00-00-00-00
MAC-address.

$RecId - record identifier. MAC_REC_$PortId_PORT snd MAC_REC_$PortId_MAC must have the same id. Example:

   MAC_REC_1_PORT "12"
   MAC_REC_1_MAC "02:A3:D1:12:43:AF"
   MAC_REC_2_PORT "12"
   MAC_REC_2_MAC "05:B3:D7:33:49:0F"
   MAC_REC_3_PORT "13"
   MAC_REC_3_MAC "FF:02:12:AA:B3:0E"

The above example means that the ID "12" port has "02:A3:D1:12:43:AF" and "05:B3:D7:33:49:0F" MAC-addresses. The ID "13" port has the "FF:02:12:AA:B3:0E" MAC address.

Was this helpful? Yes | No
Views
Personal tools