On Thu, 2006-04-20 at 17:16 -0400, James Parsons wrote: > Hello all, > > This is an snmp based fence agent for APC power switches to be used > with RHEL4 Red Hat Cluster Suite. > <SNIP> > Please let me know how this agent works. > I finally got around to trying it out with my hardware, and wasn't able to get it working as a fence agent. I tracked it down to two problems in the script when reading the commands from stdin. 1. Never parses the port parameter 2. Needs to trim the newline from each parameter read from stdin for the snmpset command to work properly. The attached patch cleared it up for me (please excuse any coding or style mistakes, first time coding in Python) I've also included the relevant sections of my cluster.conf, just for completeness sake. Once I made these changes it worked quite well on my APC 7900's. And now I can rename the outlets to descriptive names instead of "outlet 1". Now on to comments: It would be nice to be able to set the community via the cluster.conf file, right now it's hard coded in the fence agent to private. Thanks, Eric Kerin eric@xxxxxxxxxxx
--- fence_apc_snmp 2006-04-20 16:28:18.000000000 -0400 +++ fence_apc_snmp.new 2006-05-16 14:07:37.000000000 -0400 @@ -117,7 +117,7 @@ #place params in dict for line in sys.stdin: val = line.split("=") - params[val[0]] = val[1] + params[val[0]] = val[1][:-1] try: address = params["ipaddr"] @@ -137,6 +137,12 @@ sys.exit(1) try: + port = params["port"] + except KeyError, e: + os.write(standard_err, "FENCE: Missing port param for fence_apc...exiting") + sys.exit(1) + + try: a = params["option"] if a == "Off" or a == "OFF" or a == "off": action = POWER_OFF
<clusternode name="auhjpsn01a" votes="1"> <fence> <method name="1"> <device name="AUHAPC01a" port="1" option="off"/> <device name="AUHAPC01b" port="1" option="off"/> <device name="AUHAPC01a" port="1" option="on"/> <device name="AUHAPC01b" port="1" option="on"/> </method> </fence> </clusternode> <clusternode name="auhjpsn01b" votes="1"> <fence> <method name="1"> <device name="AUHAPC01a" port="2" option="off"/> <device name="AUHAPC01b" port="2" option="off"/> <device name="AUHAPC01a" port="2" option="on"/> <device name="AUHAPC01b" port="2" option="on"/> </method> </fence> </clusternode> </clusternodes> <cman expected_votes="1" two_node="1"/> <fencedevices> <fencedevice agent="fence_apc_snmp" ipaddr="XXX.XXX.XXX.205" login="" name="AUHAPC01a" passwd=""/> <fencedevice agent="fence_apc_snmp" ipaddr="XXX.XXX.XXX.206" login="" name="AUHAPC01b" passwd=""/> </fencedevices>
-- Linux-cluster@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/linux-cluster