STONITH plugin that uses SNMPv1 to control APC PDUs. Currently suports both the new (AP79xx) and old (AP96xx) PDUs. STONITH assumes that the outlet names configured to the name of the node that is plugged into it. That is, if node "ha01" is plugged into outlet 7, that outlet should be configured as "ha01". Case isn't important for this plugin. Fastest way to see if your PDU is supported: stonith -t apcsnmp community=apcread ipaddr=$IP -l # This assumes you have snmp activated and you have permissions to # the 'apcread' community. Further testes: # NOTE! THIS WILL TURN OFF A PORT! I hope nothing is plugged in. stonith -t apcsnmp community=private ipaddr=$IP -T off "Outlet 7" # Now go see if the light turned off stonith -t apcsnmp community=private ipaddr=$IP -T on "Outlet 7" # Now go see if the light turned back on stonith -t apcsnmp community=private ipaddr=$IP -T reset "Outlet 7" # Light should turn off, wait a bit, turn on More fun: stonith -t apcsnmp community=private ipaddr=$IP -T on "Outlet *" # Will turn all the ports off, unless you renamed them. New MIBs require 8 values: In MIB_t : - outletPorts Used to discover the number of outlets on the PDU AP7900: PowerNet-MIB::rPDUoutletDevNumCntrloutlets.0 AP9606: PowerNet-MIB::sPDUoutletControlTableSize.0 - outletState OID to use to discover the name of an outlet. This is then matched with the hostname STONITH wants to turn off. AP7900: PowerNet-MIB::rPDUoutletControloutletName.%i AP9606: PowerNet-MIB::sPDUoutletCtlName - outletState OID to use to discover the state of an outlet AP7900: PowerNet-MIB::rPDUoutletStatusoutletState.%i AP9606: PowerNet-MIB::sPDUoutletCtl - outletCtl OID to use to control an outlet. AP7900: PowerNet-MIB::rPDUoutletControloutletCommand.%i AP9606: PowerNet-MIB::sPDUoutletCtl - ctlOn Value to set outletCtl and the outlet is turned on. - ctlOff Value to set outletCtl and the outlet is turned off. - ctlRest Value to set outletCtl and the outlet is rebooted. In PDU_t : - name A name that describes the MIB being used - sysObjectID The OID returned by SNMPv2-MIB::sysObjectID.0 AP(.1.3.6.1.2.1.1.2.0) AP7900: PowerNet-MIB::masterSwitchrPDU (.1.3.6.1.4.1.318.1.3.4.5) AP9606: PowerNet-MIB::masterSwitchV2 (.1.3.6.1.4.1.318.1.3.4.2) %i is replaced by 1 to the value returned by outletPorts. So if outletPorts return 8, [ 1, 2, 3, 4, 5, 6, 7, 8 ] is used. AP7900 also has a master outlet at .0. OIDs are stored in numeric form, so the users don't have to mess around installing updated MIBs. To find new values for the OID_t, use: snmpwalk -c $YourCommunity -v 1 $IPofPDU enterprises >PDU.walk Then search around in PDU.walk for interesting OIDs. You may convert them to numeric form with: snmptranslate -On $OID_text Installing the APC MIB: cd /usr/share/snmp/mibs # Or get the MIB from http://nam-en.apc.com/cgi-bin/nam_en.cfg/php/enduser/std_adp.php?p_faqid=782&p_created=1010390400&p_sid=9En-VELi&p_accessibility=0&p_lva=&p_sp=cF9zcmNoPTEmcF9zb3J0X2J5PSZwX2dyaWRzb3J0PSZwX3Jvd19jbnQ9MzAmcF9wcm9kcz0wJnBfY2F0cz0mcF9wdj0mcF9jdj0mcF9zZWFyY2hfdHlwZT1hbnN3ZXJzLnNlYXJjaF9ubCZwX3BhZ2U9MSZwX3NlYXJjaF90ZXh0PWFwNzkwMCBtaWI*&p_li=&p_topview=1 wget http://www.assure24.com/download/mibs/privatemibs/318/powernet3.4.3.mib # This will kill anything you already have defined echo "mibs +PowerNet-MIB:SNMPv2-MIB" > /etc/snmp/snmp.local.conf