pynoc package¶
Module contents¶
APC Power Distribution Unit control object.
-
class
apc.
APC
(hostname_or_ip_address, public_community, private_community)¶ Bases:
object
APC Power Distribution Unit.
-
COMM_STATUS_TYPES
= ['', 'notInstalled', 'commsOK', 'commsLost']¶
-
INTER_RETRY_WAIT
= 500¶
-
LOAD_STATES
= ['', 'lowLoad', 'normal', 'nearOverload', 'overload']¶
-
MAX_STOP_DELAY
= 15000¶
-
OUTLET_STATUS_TYPES
= ['', 'off', 'on']¶
-
PREFIX
= 'PowerNet-MIB'¶
-
Q_FIRMWARE_REV
= 'rPDU2IdentFirmwareRev.1'¶
-
Q_HARDWARE_REV
= 'rPDU2IdentHardwareRev.1'¶
-
Q_LOCATION
= 'rPDU2IdentLocation.1'¶
-
Q_MANUFACTURE_DATE
= 'rPDU2IdentDateOfManufacture.1'¶
-
Q_MAX_CURRENT_RATING
= 'rPDU2DevicePropertiesMaxCurrentRating.1'¶
-
Q_MODEL_NUMBER
= 'rPDU2IdentModelNumber.1'¶
-
Q_NAME
= 'rPDU2IdentName.1'¶
-
Q_NUM_METERED_OUTLETS
= 'rPDU2DevicePropertiesNumMeteredOutlets.1'¶
-
Q_NUM_OUTLETS
= 'rPDU2DevicePropertiesNumOutlets.1'¶
-
Q_NUM_SWITCHED_OUTLETS
= 'rPDU2DevicePropertiesNumSwitchedOutlets.1'¶
-
Q_OUTLET_COMMAND_RW
= 'rPDU2OutletSwitchedControlCommand.{0}'¶
-
Q_OUTLET_NAME
= 'rPDU2OutletSwitchedStatusName.{0}'¶
-
Q_OUTLET_NAME_RW
= 'rPDU2OutletSwitchedConfigName.{0}'¶
-
Q_OUTLET_STATUS
= 'rPDU2OutletSwitchedStatusState.{0}'¶
-
Q_PHASE_CURRENT
= 'rPDU2PhaseStatusCurrent.1'¶
-
Q_PHASE_LOAD_STATE
= 'rPDU2PhaseStatusLoadState.1'¶
-
Q_PHASE_VOLTAGE
= 'rPDU2PhaseStatusVoltage.1'¶
-
Q_POWER
= 'rPDU2DeviceStatusPower.1'¶
-
Q_SENSOR_COMM_STATUS
= 'rPDU2SensorTempHumidityStatusCommStatus.1'¶
-
Q_SENSOR_HUMIDITY
= 'rPDU2SensorTempHumidityStatusRelativeHumidity.1'¶
-
Q_SENSOR_HUMIDITY_STATUS
= 'rPDU2SensorTempHumidityStatusHumidityStatus.1'¶
-
Q_SENSOR_NAME
= 'rPDU2SensorTempHumidityStatusName.1'¶
-
Q_SENSOR_NAME_RW
= 'rPDU2SensorTempHumidityConfigName.1'¶
-
Q_SENSOR_TEMP_C
= 'rPDU2SensorTempHumidityStatusTempC.1'¶
-
Q_SENSOR_TEMP_F
= 'rPDU2SensorTempHumidityStatusTempF.1'¶
-
Q_SENSOR_TEMP_STATUS
= 'rPDU2SensorTempHumidityStatusTempStatus.1'¶
-
Q_SENSOR_TYPE
= 'rPDU2SensorTempHumidityStatusType.1'¶
-
Q_SERIAL_NUMBER
= 'rPDU2IdentSerialNumber.1'¶
-
SENSOR_STATUS_TYPES
= ['', 'notPresent', 'belowMin', 'belowLow', 'normal', 'aboveHigh', 'aboveMax']¶
-
SENSOR_TYPES
= ['', 'temperatureOnly', 'temperatureHumidity', 'commsLost', 'notInstalled']¶
-
SNMP_RETRIES
= 2¶
-
SNMP_TIMEOUT
= 1.5¶
-
current
¶ The current utilization of the PDU.
Returns: current, in amps
-
date_of_manufacture
¶ Date of manufacture.
Returns: PDU date of manufacture
-
firmware_revision
¶ Firmware revision.
Returns: PDU firmware revision
-
get_outlet_name
(outlet)¶ Name of an outlet in the PDU.
Parameters: outlet – outlet number Returns: name of the outlet
-
hardware_revision
¶ Hardware revision.
Returns: PDU hardware revision
-
host
¶ Hostname or IP Address of PDU.
Returns: PDU hostname or ip address
-
humidity
¶ Relative humidity.
Returns: relative humidity
-
humidity_status
¶ Determine the status of the humidity sensor.
Returns: status of the humidity sensor
-
identification
¶ Identification string.
Returns: PDU identification
-
is_sensor_present
¶ Determine if a sensor is present on the PDU.
Returns: Is the sensor present?
-
load_state
¶ Load state of the PDU.
Returns: one of [‘lowLoad’, ‘normal’, ‘nearOverload’, overload’]
-
location
¶ Location of the PDU.
Returns: PDU location
-
max_current
¶ Maximum current for the PDU.
Returns: maximum current for the PDU
-
model_number
¶ Model number.
Returns: PDU model number
-
num_metered_outlets
¶ Number of metered outlets in the PDU.
Returns: number of metered outlets in the PDU
-
num_outlets
¶ Number of outlets in the PDU.
Returns: total number of outlets in the PDU
-
num_switched_outlets
¶ Number of switched outlets in the PDU.
Returns: number of switched outlets in the PDU
-
outlet_command
(outlet, operation)¶ Send command to an outlet in the PDU.
Parameters: - outlet – outlet number
- operation – one of [‘on’, ‘off’, ‘reboot’]
Returns: did the operation complete successfully?
-
outlet_status
(outlet)¶ Determine the status of the outlet in the PDU.
Parameters: outlet – outlet number Returns: status of the outlet, one of [‘on’, ‘off’]
-
power
¶ The power utilization of the PDU.
Returns: power, in kW
-
sensor_comm_status
¶ Communication status of the sensor.
Returns: communication status of the sensor
-
sensor_name
¶ Name of the sensor.
Returns: name of the sensor
-
sensor_supports_humidity
¶ Determine if the sensor supports relative humidity measurements.
Returns: does the sensor support relative humidity measurements?
-
sensor_supports_temperature
¶ Determine if the sensor supports temperature measurements.
Returns: does the sensor support temperature measurements?
-
sensor_type
¶ Type of sensor.
Returns: type of sensor, one of [‘temperatureOnly’, ‘temperatureHumidity’, ‘commsLost’, ‘notInstalled’]
-
serial_number
¶ Serial number.
Returns: PDU serial number
-
set_outlet_name
(outlet, name)¶ Update the name of an outlet in the PDU.
Parameters: - outlet – outlet number
- name – outlet name
Returns:
-
temperature
¶ Temperature.
Returns: temperature
-
temperature_status
¶ Determine the status of the temperature sensor.
Returns: The status of the temperature sensor
-
use_centigrade
¶ Select between centigrade and fahrenheit.
Returns: using centigrade or not
-
vendor
¶ Vendor/Manufacturer of PDU.
Returns: PDU vendor/manufacturer
-
voltage
¶ Line voltage of the PDU.
Returns: PDU line voltage
-
Cisco Switch control object.
-
class
cisco.
CiscoSwitch
(hostname_or_ip_address, username, password)¶ Bases:
object
Cisco switch control.
-
CMD_CONFIGURE
= 'configure terminal'¶
-
CMD_CONFIGURE_INTERFACE
= 'int {0}'¶
-
CMD_CONFIGURE_SIGNALS
= ['(config)#', '(config-if)#']¶
-
CMD_ENABLE
= 'enable'¶
-
CMD_ENABLE_SIGNALS
= ['Password']¶
-
CMD_END
= 'end'¶
-
CMD_GENERIC_SIGNALS
= ['#']¶
-
CMD_IPDT
= 'sh ip device track all'¶
-
CMD_IPDT_SIGNALS
= ['Enabled interfaces']¶
-
CMD_LOGIN_SIGNALS
= ['>', '#']¶
-
CMD_MAC_ADDRESS_TABLE
= 'sh mac address-table'¶
-
CMD_MAC_ADDRESS_TABLE_SIGNALS
= ['Total Mac Addresses']¶
-
CMD_POWER_OFF
= 'power inline never'¶
-
CMD_POWER_ON
= 'power inline auto'¶
-
CMD_TERMINAL_LENGTH
= 'terminal length 0'¶
-
CMD_VERSION
= 'sh version'¶
-
CMD_VERSION_SIGNALS
= ['BOOTLDR']¶
-
CMD_VLAN_MODE_ACCESS
= 'switchport mode access'¶
-
CMD_VLAN_SET
= 'switchport access vlan {0}'¶
-
MAX_COMMAND_READ
= 16¶
-
PORT_NOTATION
= {'tengigabitethernet': 'Ten', 'fastethernet': 'Fa', 'gigabitethernet': 'Gi'}¶
-
change_vlan
(port, vlan)¶ Change the VLAN assignment on a port.
Parameters: - port – port to change VLAN assignment on, e.g. Gi1/0/1
- vlan – VLAN id
Returns:
-
connect
()¶ Connect to the switch.
Returns:
-
connected
¶ Switch connection status.
Returns: has a connection to the switch been made?
-
disconnect
()¶ Disconnect from the switch.
Returns:
-
enable
(password)¶ Put the switch in enable mode.
Parameters: password – password to use to enable Returns:
-
host
¶ The IP address or hostname of the switch.
Returns: IP address or hostname of the switch
-
ipdt
()¶ IP Device Tracking (IPDT) information.
Returns: IPDT information
-
mac_address_table
(ignore_port=None)¶ MAC Address Table Information.
Parameters: ignore_port – port to ignore, e.g. Gi1/0/48 Returns: ARP information
-
poe_off
(port)¶ Disable a port for POE.
Parameters: port – port to disable POE on, e.g. Gi1/0/1 Returns:
-
poe_on
(port)¶ Enable a port for POE.
Parameters: port – port to enable POE on, e.g. Gi1/0/1 Returns:
-
set_terminal_length
()¶ Set terminal length.
Returns:
-
version
¶ The Cisco IOS version.
Returns: The Cisco IOS version.
-