On 12/19/2013 03:31 PM, Marek Grac wrote: > On 12/16/2013 05:10 PM, Bogdan Dobrelya wrote: >> >> As far as I was testing my Tripplite PDU device with standard fence >> agents, I've tried to find any suitable agent for it (fence_apc, >> fence_apc_snmp) but didn't succeed. That's why I've played with >> cmd-prompt and ssh-options of fence_apc agent mentioned above. >> >> But I've managed to succeed with customized fence_pdu_snmp (not with >> fence_pdu tho) agent I created from fence_apc_snmp with minimal >> changes (fixed OIDs and that is almost all). >> I'd like to propose this fence_pdu_snmp agent as well (tested with >> PDUMH20HVNET 12.04.0055 (snmp v1,v2c,v3) device). See a patch in >> attachement, targeted for RHEL6 branch. I believe, it might be >> compatible with any switched PDU devices, if slightly modified. >> > If the only modification was done in OIDs, I will prefer to include it > into fence_apc_snmp. We have already used a symlinks to run fence agents
Done. Here are 2 patches for master and RHEL6 branches for fence_apc_snmp agent, with added Tripplite PDU support. > with different default options and I believe we can use same approach > there as well (e.g. fence_ilo3 / fence_ipmilan). Can you take a look at > current upstream version and test it there? Ideally check if it will I've tested the patch for RHEL6 branch with my Tripplite PDU. And as you could have noticed, there is no difference between the patch for RHEL6 and one for master branch, thus, you can assume tests is OK for master as well... > work without additional switches or we should implement there a variable > which will be set only for tripplite and not for apc. > > m, As you can see from fence_apc_snmp's original README, it doesn't support ganged or 'daisy-chained' switches yet, thus nothing was changed here. -- Best regards, Bogdan Dobrelya, Researcher TechLead, Mirantis, Inc. +38 (066) 051 07 53 Skype bogdando_at_yahoo.com Irc #bogdando 38, Lenina ave. Kharkov, Ukraine www.mirantis.com www.mirantis.ru bdobre...@mirantis.com
>From d29d0e96ee9872e00aeaa5f98ac58fa4cd8aa8df Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya <bogda...@mail.ru> Date: Tue, 24 Dec 2013 13:13:53 +0200 Subject: [PATCH] Add Tripplite PDU support to fence_apc_snmp Signed-off-by: Bogdan Dobrelya <bogda...@mail.ru> Conflicts: fence/agents/apc_snmp/fence_apc_snmp.py Signed-off-by: Bogdan Dobrelya <bogda...@mail.ru> --- fence/agents/apc_snmp/fence_apc_snmp.py | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/fence/agents/apc_snmp/fence_apc_snmp.py b/fence/agents/apc_snmp/fence_apc_snmp.py index f312ebe..da02066 100644 --- a/fence/agents/apc_snmp/fence_apc_snmp.py +++ b/fence/agents/apc_snmp/fence_apc_snmp.py @@ -7,6 +7,7 @@ # AF1:v3.5.7 AN1:apc_hw02_rpdu_357.bin MN:AP7900 HR:B2) - SNMP v1 and v3 (noAuthNoPrivacy,authNoPrivacy, authPrivacy) # - APC Switched Rack PDU (MB:v3.7.0 PF:v2.7.0 PN:apc_hw02_aos_270.bin AF1:v2.7.3 AN1:apc_hw02_rpdu_273.bin # MN:AP7951 HR:B2) - SNMP v1 +# - Tripplite PDUMH20HVNET 12.04.0055 - SNMP v1, v2c, v3 import sys sys.path.append("@FENCEAGENTSLIBDIR@") @@ -24,7 +25,7 @@ BUILD_DATE="" OID_SYS_OBJECT_ID = '.1.3.6.1.2.1.1.2.0' ### GLOBAL VARIABLES ### -# Device - see ApcRPDU, ApcMSP, ApcMS +# Device - see ApcRPDU, ApcMSP, ApcMS, TripplitePDU device = None # Port ID @@ -33,6 +34,18 @@ port_id = None switch_id = None # Classes describing Device params +class TripplitePDU: + # Rack PDU + status_oid= '.1.3.6.1.4.1.850.10.2.3.5.1.2.1.%d' + control_oid= '.1.3.6.1.4.1.850.10.2.3.5.1.4.1.%d' + outlet_table_oid='.1.3.6.1.4.1.850.10.2.3.5.1.5' + ident_str="Tripplite" + state_on=2 + state_off=1 + turn_on=2 + turn_off=1 + has_switches=False + class ApcRPDU: # Rack PDU status_oid = '.1.3.6.1.4.1.318.1.1.12.3.5.1.1.4.%d' @@ -74,8 +87,9 @@ def apc_set_device(conn, options): global device agents_dir = {'.1.3.6.1.4.1.318.1.3.4.5':ApcRPDU, - '.1.3.6.1.4.1.318.1.3.4.4':ApcMSP, - None:ApcMS} + '.1.3.6.1.4.1.318.1.3.4.4':ApcMSP, + '.1.3.6.1.4.1.850.1':TripplitePDU, + None:ApcMS} # First resolve type of APC apc_type = conn.walk(OID_SYS_OBJECT_ID) @@ -179,11 +193,11 @@ def main(): options["--switch"] = "1" docs = { } - docs["shortdesc"] = "Fence agent for APC over SNMP" + docs["shortdesc"] = "Fence agent for APC, Tripplite PDU over SNMP" docs["longdesc"] = "fence_apc_snmp is an I/O Fencing agent \ -which can be used with the APC network power switch. It logs \ -into a device via SNMP and reboots a specified outlet. It supports \ -SNMP v1 and v3 with all combinations of authenticity/privacy settings." +which can be used with the APC network power switch or Tripplite PDU devices.\ +It logs into a device via SNMP and reboots a specified outlet. It supports \ +SNMP v1, v2c, v3 with all combinations of authenticity/privacy settings." docs["vendorurl"] = "http://www.apc.com" show_docs(options, docs) -- 1.7.10.4
>From 9f83ead7c5a037d78dd502571d36ba3297c1303b Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya <bogda...@mail.ru> Date: Tue, 24 Dec 2013 13:13:53 +0200 Subject: [PATCH] Add Tripplite PDU support to fence_apc_snmp Signed-off-by: Bogdan Dobrelya <bogda...@mail.ru> --- fence/agents/apc_snmp/fence_apc_snmp.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/fence/agents/apc_snmp/fence_apc_snmp.py b/fence/agents/apc_snmp/fence_apc_snmp.py index 71e978e..739abe6 100644 --- a/fence/agents/apc_snmp/fence_apc_snmp.py +++ b/fence/agents/apc_snmp/fence_apc_snmp.py @@ -7,6 +7,7 @@ # AF1:v3.5.7 AN1:apc_hw02_rpdu_357.bin MN:AP7900 HR:B2) - SNMP v1 and v3 (noAuthNoPrivacy,authNoPrivacy, authPrivacy) # - APC Switched Rack PDU (MB:v3.7.0 PF:v2.7.0 PN:apc_hw02_aos_270.bin AF1:v2.7.3 AN1:apc_hw02_rpdu_273.bin # MN:AP7951 HR:B2) - SNMP v1 +# - Tripplite PDUMH20HVNET 12.04.0055 - SNMP v1, v2c, v3 import sys, re, pexpect sys.path.append("@FENCEAGENTSLIBDIR@") @@ -24,7 +25,7 @@ BUILD_DATE="" OID_SYS_OBJECT_ID='.1.3.6.1.2.1.1.2.0' ### GLOBAL VARIABLES ### -# Device - see ApcRPDU, ApcMSP, ApcMS +# Device - see ApcRPDU, ApcMSP, ApcMS, TripplitePDU device=None # Port ID @@ -33,6 +34,18 @@ port_id=None switch_id=None # Classes describing Device params +class TripplitePDU: + # Rack PDU + status_oid= '.1.3.6.1.4.1.850.10.2.3.5.1.2.1.%d' + control_oid= '.1.3.6.1.4.1.850.10.2.3.5.1.4.1.%d' + outlet_table_oid='.1.3.6.1.4.1.850.10.2.3.5.1.5' + ident_str="Tripplite" + state_on=2 + state_off=1 + turn_on=2 + turn_off=1 + has_switches=False + class ApcRPDU: # Rack PDU status_oid= '.1.3.6.1.4.1.318.1.1.12.3.5.1.1.4.%d' @@ -75,6 +88,7 @@ def apc_set_device(conn,options): agents_dir={'.1.3.6.1.4.1.318.1.3.4.5':ApcRPDU, '.1.3.6.1.4.1.318.1.3.4.4':ApcMSP, + '.1.3.6.1.4.1.850.1':TripplitePDU, None:ApcMS} # First resolve type of APC @@ -190,11 +204,11 @@ def main(): options["-s"]="1" docs = { } - docs["shortdesc"] = "Fence agent for APC over SNMP" + docs["shortdesc"] = "Fence agent for APC, Tripplite PDU over SNMP" docs["longdesc"] = "fence_apc_snmp is an I/O Fencing agent \ -which can be used with the APC network power switch. It logs \ -into a device via SNMP and reboots a specified outlet. It supports \ -SNMP v1 and v3 with all combinations of authenticity/privacy settings." +which can be used with the APC network power switch or Tripplite PDU devices.\ +It logs into a device via SNMP and reboots a specified outlet. It supports \ +SNMP v1, v2c, v3 with all combinations of authenticity/privacy settings." docs["vendorurl"] = "http://www.apc.com" show_docs(options, docs) -- 1.7.10.4