=================== Power-Switch (MTC+) =================== .. sidebar:: Contents .. contents:: :depth: 1 :local: This chapter covers some aspects related to the power-switch service, which allows you to configure and manage **power-switches (MTC+)** in OSDx. An **MTC+** device makes it possible to remotely control the power flow of any external device connected to the Controlled Power Supply (*'AC Out'* port). There are two possible scenarios: * **Allow power to flow:** In this scenario, the Controlled Power Supply Light (*'On'* LED) will be ON and the external device receives power (Note that this is the initial MTC+ status). * **Cut power flow:** In this scenario, the Controlled Power Supply Light will be OFF and the external device does not receive power. The change from one state to another is carried out by the management interface (*'Input'* port), which must be connected to a Teldat router. This interface serves as the primary control point for device operations. The Controlled Power Supply Light (*'On'* LED) provides a visual indicator of the device's current state. Pressing the :ref:`Reset button ` for approximately 5 seconds will cut the power supply of the controlled power supply interface. .. note:: OSDx only supports Teldat MTC+ power-switches: .. image:: mtcp.png Configuration ============= To connect and use an MTC+ power-switch, you must first set the OSDx device's console port to **power-switch** mode. You can do this with the :osdx:cfg:`service power-switch` command from a Telnet or SSH session: .. code-block:: none set service power-switch Once committed, this will allow the OSDx device to communicate with the MTC+ power-switch while the service is set. .. caution:: You will not be able to manage your OSDx device by connecting to the **console port** while this mode is enabled, Therefore, it is crucial to establish an **alternative method** to access the device's Command Line Interface (CLI), such as **SSH** or **Telnet**, and use :osdx:cfg:`service power-switch` on that session. See :doc:`SSH ` or :doc:`Telnet` documentation to learn more about these services. To restore the console port's normal operation and use it to regain access to the device's CLI, execute the `delete` operation on the same :osdx:cfg:`service power-switch` command. This will revert the settings and allow CLI access via the console port again: .. code-block:: none delete service power-switch Probe ----- This command activates a probe that verifies whether the chosen MTC+ is receiving power. .. tip:: We recommend **setting the probe for the ID of the MTC+ directly connected to the router**. This is important because, if this specific MTC+ loses power, the other MTC+ units connected to its *output* port will not be able to reach the router through it. Here are the optional probe parameters that can be configured: * :osdx:cfg:`service power-switch probe * period *`: This determines the **interval between probes**, in seconds. This value defaults to 60 seconds if not set. When this configuration is set, an **SNMP trap** will be sent when the selected **MTC+ loses power** and another when it **regains power**, depending on whether the MTC+ responds to the probe or not. An UP or DOWN trap will be sent if it's the first time the selected MTC+ ID is probed. * :osdx:cfg:`service power-switch probe * track *`: This is an **optional** configuration parameter to enable a **periodic SNMP trap** linked to the MTC+ power status. When this configuration is set, an SNMP trap will be sent periodically (according to the period set) with the **status** of the selected MTC+. Note that initiating the ``track`` setting without previously setting the ``period`` will also start the probe at the default interval of 60 seconds. .. important:: For the OSDx device to be able to send traps, you will need to set the ``notify-traps mtc-probe`` and ``notify-traps mtc-track`` on the desired SNMP *user* or *community*. See the :doc:`SNMP documentation ` for more information about the SNMP service. For example, this command would activate a probe every 30 seconds for the MTC+ whose ID is 0: .. code-block:: none set service power-switch probe 0 period 30 And this command will activate not only a probe but a periodic SNMP trap every 60 seconds (reporting on the status of the MTC+ whose ID is 0). .. code-block:: none set service power-switch probe 0 track 60 To stop the probe, simply use the *delete* operation: .. code-block:: none delete service power-switch probe .. _mtc_commands: MTC+ Commands ============= Except for `scan` and `list`, the operational commands in this service expect the last parameter to be an MTC+ ID. This ID is physically selected on the MTC+ ID **rotary switch**: .. _mtc_buttons: .. image:: mtcp_buttons.png These IDs range from '0' to 'F': +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ Here are some examples of power-switch commands with an MTC+ ID as last parameter: .. code-block:: none service power-switch status 0 service power-switch version 0e service power-switch on a service power-switch off 00 You can also use **'all'** as the ID, so that the command is sent to **all registered devices** (To register devices, see :ref:`scan command `): .. code-block:: none service power-switch version all service power-switch off all The **commands** allowed by MTC+ power-switches are: .. _scan-command: * :osdx:op:`service power-switch scan`, to manually detect and **register connected power-switches**. Please note that the process could take **up to 40 seconds** to complete, since it searches for power-switches with any of the admissable IDs. When the system displays the power-switch IDs you want to register, you can **press any key to stop the search** for more IDs. We recommend using the lowest IDs first, since the system checks them first and it makes the process more efficient. * :osdx:op:`service power-switch list`, to **show** all registered power-switches. * :osdx:op:`service power-switch delete *`, to **delete** a power-switch with the specified ID or *all* registered power-switches. Please note that, once the device is deleted, it will **not** register again automatically. If you want to re-register it, you will need to use :osdx:op:`service power-switch scan`, disconnect it from its power source and then reconnect it to **restart it**, or press the physical :ref:`Reset button ` on the device. * :osdx:op:`service power-switch on *`, to **allow power to flow** on the MTC+ with the specified ID or on *all* registered power-switches. * :osdx:op:`service power-switch off *`, , to **stop the power flow** on the MTC+ with the specified ID or on *all* registered power-switches. * :osdx:op:`service power-switch reset *`, it is the equivalent to an *OFF* command followed by an *ON* after 10 seconds. * :osdx:op:`service power-switch status *`, to show the **status** of an MTC+ with the specified ID or of *all* registered power-switches. * :osdx:op:`service power-switch temperature *`, to show the **temperature** of an MTC+ with the specified ID or of *all* registered power-switches. * :osdx:op:`service power-switch version *`, to show the **version** of an MTC+ with the specified ID or of *all* registered power-switches. * :osdx:op:`service power-switch voltage *`, to show the **voltage** of an MTC+ with the specified ID or of *all* registered power-switches. If an MTC+ with the specified ID isn't connected, you can either **wait for a few seconds**, or **press a key** to stop waiting for a response from that ID. .. note:: If you **change the ID of an MTC+ while it's connected**, it will warn the router to **change the ID that it was previously registered with**. To illustrate this, imagine that you connect an MTC+ with ID 00. It should automatically register and show up when you call the :osdx:op:`service power-switch list` command. If not, use :osdx:op:`service power-switch scan` to register it. Once it's registered, change the physical ID of the MTC+ from 00 to 01. This will unregister ID 00 and, after a few seconds, the new 01 ID will be registered and appear when the :osdx:op:`service power-switch list` command is called. Additionally, if you connect a new MTC+ or reset it with the physical :ref:`Reset button `, it will register automatically. Power-switches that are not detected within **2 minutes** will be automatically unregistered. SNMP management --------------- All :ref:`MTC+ commands ` (except ``delete all``) can be executed from an external device via **SNMP SET commands**, while **SNMP GET commands** are used to obtain information. The *status* values of these read-write OIDs are represented by integers. Each integer corresponds to a specific status, as explained below: +---------+------------+-----------------------------------------------------------+ | Integer | Status | Explanation | +=========+============+===========================================================+ | 1 | Send | This indicates that the command is going to be executed. | | | | This is the only value that can be set. | +---------+------------+-----------------------------------------------------------+ | 2 | OK | The command was successfully executed. | +---------+------------+-----------------------------------------------------------+ | 3 | Error | An error occurred during the execution of the command. | +---------+------------+-----------------------------------------------------------+ | 4 | Undefined | The command execution status is not defined. | +---------+------------+-----------------------------------------------------------+ | 5 | Running | The command is currently being executed. | +---------+------------+-----------------------------------------------------------+ The *responses* table holds entries, each associated with an index. This index, represented by the last digit of the OID, indicates the ID of the MTC+, which ranges from 1 to 16 (corresponding to IDs 0 to F). The response from the MTC+ for each command is kept at the index that matches it. - For the **Scan** command: * An ``undefined`` value at an index indicates that the MTC+ with the ID (index-1) was not found. * A value like ``00-`` shows that MTC+ 00 has been found. - For the **List** command: * An ``undefined`` value at an index means that the MTC+ with the ID (index-1) is not registered. * A value like ``MTC+ 00`` shows that MTC+ 00 is registered. - For the **rest of commands**: * An ``undefined`` value at an index means that the MTC+ with the ID (index-1) didn't respond to the command. * A textual response from the MTC+ (other than *undefined*) indicates that the MTC+ replied with that message. For examples regarding the SNMP management of power-switches, see :ref:`SNMP Management Examples `. Examples ======== Connecting up to **16 MTC+** power-switches to a single OSDx device is possible. This section describes the different use modes. .. important:: Before you read these examples, make sure you have activated the **power-switch** mode in your OSDx's console port via the :osdx:cfg:`service power-switch` command. Connecting one power-switch to an OSDx device --------------------------------------------- 1. Select the ID of the MTC+ you want to connect, using the :ref:`rotary switch `. 2. Use the cable supplied to connect the *console port* of the router (RJ45) to the *'Input'* port (RJ11) of the MTC+ power-switch. .. _mtc_single: .. image:: mtc_single.png .. Source: https://teldat-my.sharepoint.com/:p:/p/arodriguez/Eddjphs9dCVLhOg1oJc3Gf4B6PttpFIIUaHmwWUrUrKXEQ?e=Fw2UPE 3. Connect the MTC+ *'AC In'* port to an adequate power source. #. Once the MTC+ power-switch is plugged in to a power source, it will **automatically register** in the router. If running the :osdx:op:`service power-switch list` command doesn't show the ID of the connected MTC+ after 15 seconds, you can manually **register the device** using :osdx:op:`service power-switch scan`: .. code-block:: none user@osdx$ service power-switch scan Press any key if there is no answer from the power switch: Found: 00-ON #. You should now be able to execute any command indicating the **ID** you selected on the MTC+ or using the **'all'** keyword. For example: .. code-block:: none user@osdx$ service power-switch version 0 Press any key if there is no answer from the power switch: 00-v1.0-MTC+ user@osdx$ service power-switch off all Press any key if there is no answer from the power switch: 00-OK Connecting more than one power-switch to an OSDx device ------------------------------------------------------- 1. Select a different ID for each power-switch, using the :ref:`rotary switch `. .. attention:: Make sure each power-switch has its own, **unique ID**. If two or more power-switches have the same ID, it could lead to unpredictable behavior. 1. Use the cable supplied to connect the *console port* of the router (RJ45) to the *'Input'* port (RJ11) of one of the MTC+ power-switches. See :ref:`'Connecting one power-switch to an OSDx device' `. 2. For the rest of the MTC+, arrange a **daisy chain** connecting the *'Link (Out)'* port of the MTC+ nearest to the router to the *'Input'* port of the next MTC+. .. image:: mtc_daisychain.png .. Source: https://teldat-my.sharepoint.com/:p:/p/arodriguez/Eddjphs9dCVLhOg1oJc3Gf4B6PttpFIIUaHmwWUrUrKXEQ?e=Fw2UPE 4. Connect all the MTC+ *'AC In'* ports to an adequate power source. #. Once the MTC+ power-switches are plugged in to a power source, they will **automatically register** in the router. If running the :osdx:op:`service power-switch list` command doesn't show all the IDs of the connected MTC+ after 15 seconds, you can manually **register the devices** using :osdx:op:`service power-switch scan`: .. code-block:: none user@osdx$ service power-switch scan Press any key if there is no answer from the power switch: Found: 00-ON Found: 01-ON Found: 02-ON #. You should now be able to **execute any command** indicating the **ID** you selected on each of the MTC+ power-switches or using the **'all'** keyword. For example: .. code-block:: none user@osdx$ service power-switch version 0 Press any key if there is no answer from the power switch: 00-v1.0-MTC+ user@osdx$ service power-switch off all Press any key if there is no answer from the power switch: 00-OK 01-OK 02-OK Final steps ----------- After registering the connected devices, use :osdx:op:`service power-switch list` to check the IDs of the registered power-switches. .. code-block:: none user@osdx$ service power-switch list MTC+: 00 MTC+: 01 MTC+: 02 You can now execute ``service power-switch status all`` to check whether the registered power-switches are currently supplying power or not, and to confirm that the set-up is working correctly: .. code-block:: none user@osdx$ service power-switch status all Press any key if there is no answer from the power switch: 00-ON 01-ON 02-ON To make the MTC+ supply power or not, use :osdx:op:`service power-switch on *` or :osdx:op:`service power-switch off *` (respectively): .. code-block:: none user@osdx$ service power-switch on 1 Press any key if there is no answer from the power switch: 01-OK user@osdx$ service power-switch off 2 Press any key if there is no answer from the power switch: 02-OK user@osdx$ service power-switch on all Press any key if there is no answer from the power switch: 00-OK 01-OK 02-OK .. _snmp_examples: SNMP Management Examples ======================== To manage MTC+ power-switches using SNMP, you will first need to create an SNMP community or user (See :doc:`SNMP documentation `). After this, you will be able to use SNMP GET operations using the ``TELDAT-MON-MTCPLUS-MIB`` to obtain the status and responses of MTC+ commands executed by SNMP. .. note:: To enable the **execution of power-switch commands using an SNMP SET operation**, set the community or user to **read-write** (See :osdx:cfg:`service snmp community * read-write` or :osdx:cfg:`service snmp user * read-write`). Once this is done, you will be able to execute MTC+ commands by setting the value of the corresponding read-write OID to ``1`` (integer). Using the SNMP :osdx:op:`service snmp get *` and :osdx:op:`service snmp set *` operational commands (or other external SNMP GET and SET commands), you can fully manage the connected MTC+ power-switches as if you were using the OSDx CLI. The following section provides examples of get/set operations using the MTC+ MIB and SNMP v2c. Status of all registered power-switches --------------------------------------- Send the command **setting** a ``1`` (integer) to the corresponding OID, in this case ``.1.3.6.1.4.1.2007.4.218.2.1.6``: .. code-block:: none user@osdx$ service snmp set oid .1.3.6.1.4.1.2007.4.218.2.1.6 version v2c community value-type i value 1 TELDAT-MON-MTCPLUS-MIB::telProductsMTCPlusSendCmdStatusAll = INTEGER: send(1) Now we can **get** the status of the command sent: .. code-block:: none user@osdx$ service snmp get oid .1.3.6.1.4.1.2007.4.218.2.1.6 version v2c community TELDAT-MON-MTCPLUS-MIB::telProductsMTCPlusSendCmdStatusAll = INTEGER: ok(2) Once the command has finished executing, the status will be ``ok(2)``. This means we can now **get** the output of the command, which is stored in the *Res Table* of the MTC+ MIB. In this case, the result will be stored in the OID ``.1.3.6.1.4.1.2007.4.218.2.1.2.1.5.``, being ``MTC+_INDEX`` a number between 1 and 16 that represents the MTC+ hexadecimal IDs 0-f. .. code-block:: none user@osdx$ service snmp get oid .1.3.6.1.4.1.2007.4.218.2.1.2.1.5.1 version v2c community TELDAT-MON-MTCPLUS-MIB::telProductsMTCPlusSendCmdStatusRes.1 = STRING: "00-ON" If there was a response from the corresponding MTC+, it will appear. Otherwise, the response will be *undefined*. Turn off the power-switch with ID 0 ----------------------------------- Send the command **setting** a ``1`` (integer) to the corresponding OID, with index 1 (MTC+ ID 0), in this case ``.1.3.6.1.4.1.2007.4.218.2.1.1.1.3.1``: .. code-block:: none user@osdx$ service snmp set oid .1.3.6.1.4.1.2007.4.218.2.1.1.1.3.1 version v2c community value-type i value 1 TELDAT-MON-MTCPLUS-MIB::telProductsMTCPlusSendCmdOff.1 = INTEGER: send(1) Now we can **get** the status of the command sent: .. code-block:: none user@osdx$ service snmp get oid .1.3.6.1.4.1.2007.4.218.2.1.1.1.3.1 version v2c community TELDAT-MON-MTCPLUS-MIB::telProductsMTCPlusSendCmdOff.1 = INTEGER: ok(2) Once the command has finished executing, the status will be ``ok(2)``, so now we can **get** the output of the command, which is stored in the *Res Table* of the MTC+ MIB. In this case, the result will be stored in the OID ``.1.3.6.1.4.1.2007.4.218.2.1.2.1.3.1``. .. code-block:: none user@osdx$ service snmp get oid .1.3.6.1.4.1.2007.4.218.2.1.2.1.3.1 version v2c community TELDAT-MON-MTCPLUS-MIB::telProductsMTCPlusSendCmdOffRes.1 = STRING: "00-OK" If there was a response from the MTC+, it will appear. Otherwise, the response will be *undefined*. Scan for new power-switches --------------------------- Send the command **setting** a ``1`` (integer) to the corresponding OID, in this case ``.1.3.6.1.4.1.2007.4.218.2.1.11``: .. code-block:: none user@osdx$ service snmp set oid .1.3.6.1.4.1.2007.4.218.2.1.11 version v2c community value-type i value 1 TELDAT-MON-MTCPLUS-MIB::telProductsMTCPlusSendCmdScan = INTEGER: send(1) Now we can **get** the status of the command sent: .. code-block:: none user@osdx$ service snmp get oid .1.3.6.1.4.1.2007.4.218.2.1.11 version v2c community TELDAT-MON-MTCPLUS-MIB::telProductsMTCPlusSendCmdScan = INTEGER: ok(2) Once the command has finished executing, the status will be ``ok(2)``. This means we can now **get** the output of the command, which is stored in the *Res Table* of the MTC+ MIB. In this case, the results will be stored in the OIDs ``.1.3.6.1.4.1.2007.4.218.2.1.2.1.10.``, being ``MTC+_INDEX`` a number between 1 and 16 that represents the MTC+ hexadecimal IDs 0-f. .. code-block:: none user@osdx$ service snmp get oid .1.3.6.1.4.1.2007.4.218.2.1.2.1.10.1 version v2c community TELDAT-MON-MTCPLUS-MIB::telProductsMTCPlusSendCmdScanRes.1 = STRING: "00-OFF" If there was a response from the MTC+, the status of the registered MTC+ will appear. Otherwise, the response will be *undefined*. List registered power-switches ------------------------------ Send the command **setting** a ``1`` (integer) to the corresponding OID, in this case ``.1.3.6.1.4.1.2007.4.218.2.1.10``: .. code-block:: none user@osdx$ service snmp set oid .1.3.6.1.4.1.2007.4.218.2.1.10 version v2c community value-type i value 1 TELDAT-MON-MTCPLUS-MIB::telProductsMTCPlusSendCmdList.0 = INTEGER: send(1) Now we can **get** the status of the command sent: .. code-block:: none user@osdx$ service snmp get oid .1.3.6.1.4.1.2007.4.218.2.1.10 version v2c community TELDAT-MON-MTCPLUS-MIB::telProductsMTCPlusSendCmdList.0 = INTEGER: ok(2) Once the command has finished executing, the status will be ``ok(2)``. This means we can now **get** the output of the command, which is stored in the *Res Table* of the MTC+ MIB. In this case, the results will be stored in the OIDs ``.1.3.6.1.4.1.2007.4.218.2.1.2.1.9.``, being ``MTC+_INDEX`` a number between 1 and 16 that represents the MTC+ hexadecimal IDs 0-f. .. code-block:: none user@osdx$ service snmp get oid .1.3.6.1.4.1.2007.4.218.2.1.2.1.9.1 version v2c community TELDAT-MON-MTCPLUS-MIB::telProductsMTCPlusSendCmdListRes.1 = STRING: "MTC+ 00" If there was a response from the MTC+, ``MTC+ `` will appear. Otherwise, the response will be *undefined*. Command Summary =============== .. osdx:cmdtree:: op :maxdepth: 4 service power-switch .. osdx:cmdtree:: cfg :maxdepth: 4 service power-switch