fence-agents: master - fence_apc_snmp: Rewrite of agent under Python unified library

Jan Friesse honzaf@fedoraproject.org
Wed Mar 11 15:28:00 GMT 2009


Gitweb:        http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=commitdiff;h=525aa2eca9455abcd9fe02323fc8f42243f26fbf
Commit:        525aa2eca9455abcd9fe02323fc8f42243f26fbf
Parent:        f9ced2a62b7d6006471438532be1237bd03cd3ef
Author:        Jan Friesse <jfriesse@redhat.com>
AuthorDate:    Wed Mar 11 16:26:29 2009 +0100
Committer:     Jan Friesse <jfriesse@redhat.com>
CommitterDate: Wed Mar 11 16:26:29 2009 +0100

fence_apc_snmp: Rewrite of agent under Python unified library

Main functionality should be kept and has some new
features, like list, metadata, and specially support
for SNMP v3 with all authentification/privacy methods.
---
 fence/agents/apc_snmp/Makefile          |    1 -
 fence/agents/apc_snmp/fence_apc_snmp.py |  624 +++++++++----------------------
 fence/man/Makefile                      |    1 +
 fence/man/fence_apc_snmp.8              |  139 +++++++
 4 files changed, 316 insertions(+), 449 deletions(-)

diff --git a/fence/agents/apc_snmp/Makefile b/fence/agents/apc_snmp/Makefile
index d5da610..9d2e498 100644
--- a/fence/agents/apc_snmp/Makefile
+++ b/fence/agents/apc_snmp/Makefile
@@ -1,5 +1,4 @@
 TARGET= fence_apc_snmp
-MIBRESOURCE= powernet369.mib
 
 include ../../../make/defines.mk
 include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/apc_snmp/fence_apc_snmp.py b/fence/agents/apc_snmp/fence_apc_snmp.py
index d2530da..8ffd7fc 100644
--- a/fence/agents/apc_snmp/fence_apc_snmp.py
+++ b/fence/agents/apc_snmp/fence_apc_snmp.py
@@ -1,465 +1,193 @@
 #!/usr/bin/python
 
-#############################################################################
-## This APC Fence script uses snmp to control the APC power
-## switch. This script requires that net-snmp-utils be installed
-## on all nodes in the cluster, and that the powernet369.mib file be
-## located in @MIBDIR@
-#############################################################################
-
-import getopt, sys
-import os
-import datetime
-import time
-import select
-import signal
-import atexit
-from glob import glob
+# The Following agent has been tested on:
+# - 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_aos_270.bin
+#    AF1:v2.7.3 AN1:apc_hw02_rpdu_273.bin MN:AP7930 HR:B2) - SNMP v1
+# - APC Web/SNMP Management Card (MB:v3.8.6 PF:v3.5.8 PN:apc_hw02_aos_358.bin AF1:v3.5.7 AN1:apc_hw02_aos_358.bin
+#    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
+
+import sys, re, pexpect
+from fencing import *
+from fencing_snmp import *
 
 #BEGIN_VERSION_GENERATION
-RELEASE_VERSION=""
+RELEASE_VERSION="APC SNMP fence agent"
 REDHAT_COPYRIGHT=""
 BUILD_DATE=""
 #END_VERSION_GENERATION
 
-POWER_ON="outletOn"
-POWER_OFF="outletOff"
-POWER_REBOOT="outletReboot"
-
-
-# oid defining fence device 
-oid_sysObjectID = '.1.3.6.1.2.1.1.2.0'
-
-
-
-class SNMP:
-	def __init__(self, params):
-		self.hostname  = params['ipaddr']
-		self.udpport   = params['udpport']
-		self.community = params['community']
-	
-	def get(self, oid):
-		args = ['@SNMPBIN@/snmpget']
-		args.append('-Oqn')
-		args.append('-v')
-		args.append('1')
-		args.append('-c')
-		args.append(self.community)
-		args.append('-m')
-		args.append('ALL')
-		args.append(self.hostname + ':' + self.udpport)
-		args.append(oid)
-		strr, code = execWithCaptureStatus("@SNMPBIN@/snmpget", args)
-		if code:
-			raise Exception, 'snmpget failed'
-		l = strr.strip().split()
-		return l[0], ' '.join(l[1:])
-	
-	def set_int(self, oid, value):
-		args = ['@SNMPBIN@/snmpset']
-		args.append('-Oqn')
-		args.append('-v')
-		args.append('1')
-		args.append('-c')
-		args.append(self.community)
-		args.append('-m')
-		args.append('ALL')
-		args.append(self.hostname + ':' + self.udpport)
-		args.append(oid)
-		args.append('i')
-		args.append(str(value))
-		strr,code = execWithCaptureStatus("@SNMPBIN@/snmpset", args)
-		if code:
-			raise Exception, 'snmpset failed'
-		
-	def walk(self, oid):
-		args = ['@SNMPBIN@/snmpwalk']
-		args.append('-Oqn')
-		args.append('-v')
-		args.append('1')
-		args.append('-c')
-		args.append(self.community)
-		args.append('-m')
-		args.append('ALL')
-		args.append(self.hostname + ':' + self.udpport)
-		args.append(oid)
-		strr,code = execWithCaptureStatus("@SNMPBIN@/snmpwalk", args)
-		if code:
-			raise Exception, 'snmpwalk failed'
-		lines = strr.strip().splitlines()
-		ret = []
-		for line in lines:
-			l = line.strip().split()
-			ret.append((l[0], ' '.join(l[1:]).strip('"')))
-		return ret
-	
-
-
-class FenceAgent:
-	
-	def __init__(self, params):
-	   self.snmp = SNMP(params)
-	
-	def resolve_outlet(self):
-		raise Exception, 'resolve_outlet() not implemented'
-	
-	def status(self):
-		oid = self.status_oid % self.resolve_outlet()
-		dummy, stat = self.snmp.get(oid)
-		if stat == self.state_on or stat == "outletStatusOn":
-			return 'on'
-		elif stat == self.state_off or stat == "outletStatusOff":
-			return 'off'
-		else:
-			raise Exception, 'invalid status ' + stat
-	
-	def power_off(self):
-		oid = self.control_oid % self.resolve_outlet()
-		self.snmp.set_int(oid, self.turn_off)
-	
-	def power_on(self):
-		oid = self.control_oid % self.resolve_outlet()
-		self.snmp.set_int(oid, self.turn_on)
-	
-
-
-
-		
-
-		
-
-class MasterSwitch(FenceAgent):
-	
-	def __init__(self, params):
-	   FenceAgent.__init__(self, params)
-	   
-	   self.status_oid       = '.1.3.6.1.4.1.318.1.1.12.3.5.1.1.4.%s'
-	   self.control_oid      = '.1.3.6.1.4.1.318.1.1.12.3.3.1.1.4.%s'
-	   self.outlet_table_oid = '.1.3.6.1.4.1.318.1.1.12.3.5.1.1.2'
-	   
-	   self.state_on  = '1'
-	   self.state_off = '2'
-	   
-	   self.turn_on   = '1'
-	   self.turn_off  = '2'
-	   
-	   self.port = params['port']
-	
-	def resolve_outlet(self):
-		outlet = None
-		try:
-			outlet = str(int(self.port))
-		except:
-			table = self.snmp.walk(self.outlet_table_oid)
-			for row in table:
-				if row[1] == self.port:
-					t = row[0].strip().split('.')
-					outlet = t[len(t)-1]
-		if outlet == None:
-			raise Exception, 'unable to resolve ' + self.port
-		else:
-			self.port = outlet
-		return outlet
-	
-	
-class MasterSwitchPlus(FenceAgent):
-	def __init__(self, params):
-	   FenceAgent.__init__(self, params)
-	   
-	   self.status_oid       = '.1.3.6.1.4.1.318.1.1.6.7.1.1.5.%s.1.%s'
-	   self.control_oid      = '.1.3.6.1.4.1.318.1.1.6.5.1.1.5.%s.1.%s'
-	   self.outlet_table_oid = '.1.3.6.1.4.1.318.1.1.6.7.1.1.4'
-	   
-	   self.state_on  = '1'
-	   self.state_off = '2'
-	   
-	   self.turn_on   = '1'
-	   self.turn_off  = '3'
-	   
-	   try:
-		   self.switch = params['switch']
-	   except:
-		   self.switch = ''
-	   self.port   = params['port']
-   
-	def resolve_outlet(self):
-		switch = None
-		outlet = None
-		try:
-			switch = str(int(self.switch))
-			outlet = str(int(self.port))
-		except:
-			table = self.snmp.walk(self.outlet_table_oid)
-			for row in table:
-				if row[1] == self.port:
-					t = row[0].strip().split('.')
-					outlet = t[len(t)-1]
-					switch = t[len(t)-3]
-		if outlet == None:
-			raise Exception, 'unable to resolve ' + self.port
-		else:
-			self.switch = switch
-			self.port   = outlet
-		return (switch, outlet)
-	
-
-
-
-	
-
-def usage():
-        print "Usage:"
-        print ""
-        print "Options:"
-        print "  -h               Usage"
-        print "  -a <ip>          IP address or hostname of fence device"
-        print "  -u <udpport>     UDP port to use (default 161)"
-        print "  -c <community>   SNMP community (default 'private')"
-        print "  -n <num>         Outlet name/number to act on"
-        print "  -o <string>      Action: reboot (default), on, off or status"
-        print "  -v               Verbose mode - write to @LOGDIR@/fence_apc_snmp.log"
-        print "  -V               Version"
-	
-        sys.exit(0)
-
-
-
-file_log = None
-def set_logging(verbose):
-	global file_log
-	if verbose:
-		file_log = open('@LOGDIR@/fence_apc_snmp.log', 'a')
-		file_log.write('\n-----------  ')
-		file_log.write(datetime.datetime.today().ctime())
-		file_log.write('  -----------\n')
-def log(msg, error=False):
-	global file_log
-	if msg.rfind('\n') != len(msg)-1:
-		msg += '\n'
-	if file_log != None:
-		file_log.write(msg)
-	if error:
-		o = sys.stderr
+### CONSTANTS ###
+# oid defining fence device
+OID_SYS_OBJECT_ID='.1.3.6.1.2.1.1.2.0'
+
+### GLOBAL VARIABLES ###
+# Device - see ApcRPDU, ApcMSP, ApcMS
+device=None
+
+# Port ID
+port_id=None
+# Switch ID
+switch_id=None
+
+# Classes describing Device params
+class ApcRPDU:
+	# Rack PDU
+	status_oid=      '.1.3.6.1.4.1.318.1.1.12.3.5.1.1.4.%d'
+	control_oid=     '.1.3.6.1.4.1.318.1.1.12.3.3.1.1.4.%d'
+	outlet_table_oid='.1.3.6.1.4.1.318.1.1.12.3.5.1.1.2'
+	ident_str="APC rPDU"
+	state_on=1
+	state_off=2
+	turn_on=1
+	turn_off=2
+	has_switches=False
+
+class ApcMSP:
+	# Master Switch+
+	status_oid=      '.1.3.6.1.4.1.318.1.1.6.7.1.1.5.%d.1.%d'
+	control_oid=     '.1.3.6.1.4.1.318.1.1.6.5.1.1.5.%d.1.%d'
+	outlet_table_oid='.1.3.6.1.4.1.318.1.1.6.7.1.1.4'
+	ident_str="APC Master Switch+"
+	state_on=1
+	state_off=2
+	turn_on=1
+	turn_off=3
+	has_switches=True
+
+class ApcMS:
+	# Master Switch - seems oldest, but supported on every APC PDU
+	status_oid=      '.1.3.6.1.4.1.318.1.1.4.4.2.1.3.%d'
+	control_oid=     '.1.3.6.1.4.1.318.1.1.4.4.2.1.3.%d'
+	outlet_table_oid='.1.3.6.1.4.1.318.1.1.4.4.2.1.4'
+	ident_str="APC Master Switch (fallback)"
+	state_on=1
+	state_off=2
+	turn_on=1
+	turn_off=2
+	has_switches=False
+
+### FUNCTIONS ###
+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}
+
+	# First resolve type of APC
+	apc_type=conn.walk(OID_SYS_OBJECT_ID)
+
+	if (not ((len(apc_type)==1) and (agents_dir.has_key(apc_type[0][1])))):
+		apc_type=[[None,None]]
+
+	device=agents_dir[apc_type[0][1]]
+
+	conn.log_command("Trying %s"%(device.ident_str))
+
+def apc_resolv_port_id(conn,options):
+	global port_id,switch_id,device
+
+	if (device==None):
+		apc_set_device(conn,options)
+
+	# Now we resolv port_id/switch_id
+	if ((options["-n"].isdigit()) and ((not device.has_switches) or (options["-s"].isdigit()))):
+		port_id=int(options["-n"])
+
+		if (device.has_switches):
+			switch_id=int(options["-s"])
 	else:
-		o = sys.stdout
-	o.write(msg)
+		table=conn.walk(device.outlet_table_oid,30)
 
-def atexit_handler():
-	try:
-		sys.stdout.close()
-		os.close(1)
-	except IOError:
-		sys.stderr.write("%s failed to close standard output\n"%(sys.argv[0]))
-		sys.exit(1)
+		for x in table:
+			if (x[1].strip('"')==options["-n"]):
+				t=x[0].split('.')
+				if (device.has_switches):
+					port_id=int(t[len(t)-1])
+					switch_id=int(t[len(t)-3])
+				else:
+					port_id=int(t[len(t)-1])
 
+	if (port_id==None):
+		fail_usage("Can't find port with name %s!"%(options["-n"]))
 
+def get_power_status(conn,options):
+	global port_id,switch_id,device
+
+	if (port_id==None):
+		apc_resolv_port_id(conn,options)
+
+	oid=((device.has_switches) and device.status_oid%(switch_id,port_id) or device.status_oid%(port_id))
+
+	(oid,status)=conn.get(oid)
+	return (status==str(device.state_on) and "on" or "off")
+
+def set_power_status(conn, options):
+	global port_id,switch_id,device
+
+	if (port_id==None):
+		apc_resolv_port_id(conn,options)
+
+	oid=((device.has_switches) and device.control_oid%(switch_id,port_id) or device.control_oid%(port_id))
+
+	conn.set(oid,(options["-o"]=="on" and device.turn_on or device.turn_off))
+
+
+def get_outlets_status(conn, options):
+	global device
+
+	result={}
+
+	if (device==None):
+		apc_set_device(conn,options)
+
+	res_ports=conn.walk(device.outlet_table_oid,30)
+
+	for x in res_ports:
+		t=x[0].split('.')
+
+		port_num=((device.has_switches) and "%s:%s"%(t[len(t)-3],t[len(t)-1]) or "%s"%(t[len(t)-1]))
+
+                port_name=x[1].strip('"')
+                port_status=""
+                result[port_num]=(port_name,port_status)
+
+        return result
+
+# Define new options
+def apc_snmp_define_defaults():
+	all_opt["snmp_version"]["default"]="1"
+	all_opt["community"]["default"]="private"
+
+# Main agent method
 def main():
+	device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug",
+		       "action", "ipaddr", "login", "passwd", "passwd_script",
+		       "test", "port", "separator", "no_login", "no_password",
+		       "snmp_version", "community", "snmp_auth_prot", "snmp_sec_level",
+		       "snmp_priv_prot", "snmp_priv_passwd", "snmp_priv_passwd_script",
+		       "udpport"]
+
 	atexit.register(atexit_handler)
 
-	try:
-		main2()
-		return 0
-	except Exception, e:
-		log(str(e), True)
-		sys.exit(1)
-def main2():
-  
-  agents_dir = {'.1.3.6.1.4.1.318.1.3.4.5' : MasterSwitch,
-		'.1.3.6.1.4.1.318.1.3.4.4' : MasterSwitchPlus}
-  
-  verbose = False
-  params = {}
-  
-  if len(sys.argv) > 1:
-    try:
-      opts, args = getopt.getopt(sys.argv[1:], "ha:u:c:n:o:vV", ["help", "output="])
-    except getopt.GetoptError:
-      usage()
-      sys.exit(2)
-
-    for o, a in opts:
-      o = o.strip()
-      a = a.strip()
-      if o == "-v":
-        verbose = True
-      if o == "-V":
-        print "%s\n" % RELEASE_VERSION
-        print "%s\n" % REDHAT_COPYRIGHT
-        print "%s\n" % BUILD_DATE
-        sys.exit(0)
-      if o in ("-h", "--help"):
-        usage()
-	sys.exit(0)
-      if o == "-a":
-        params['ipaddr'] = a
-      if o == "-u":
-        params['udpport'] = a
-      if o == "-c":
-        params['community'] = a
-      if o == "-n":
-        switch = ''
-	port   = a
-	if ':' in port:
-	   idx = port.find(':')
-	   switch = port[:idx]
-	   port = port[idx+1:]
-	params['switch'] = switch
-	params['port']   = port
-      if o == "-o":
-        params['option'] = a.lower()
-
-  else: #Get opts from stdin 
-    for line in sys.stdin:
-      val = line.strip().split("=")
-      if len(val) == 2:
-         o = val[0].strip().lower()
-	 a = val[1].strip()
-	 if o == 'verbose':
-	    if a.lower() == 'on' or a.lower() == 'true' or a == '1':
-	       verbose = True
-	 else:
-	    params[o] = a 
-	
-    
-  set_logging(verbose)
-  
-  
-  ### validation ###
-  
-  try:
-	  if params['ipaddr'] == '':
-		  raise Exception, 'missing ipadddr'
-  except:
-	  log("FENCE: Missing ipaddr param for fence_apc_snmp...exiting", True)
-	  sys.exit(1)
-  if 'udpport' not in params:
-	  params['udpport'] = '161'
-  try:
-	  t = int(params['udpport'])
-	  if t >= 65536 or t < 0:
-		  raise Exception, 'invalid udpport'
-  except:
-	  log("FENCE: Invalid udpport for fence_apc_snmp...exiting", True)
-	  sys.exit(1)
-  if 'community' not in params:
-	  params['community'] = 'private'
-  try:
-	  port = params['port']
-	  if len(port) == 0:
-		  raise Exception, 'missing port'
-  except:
-	  log("FENCE: Missing port param for fence_apc_snmp...exiting", True)
-	  sys.exit(1)
-  if 'switch' not in params:
-	  params['switch'] = ''
-
-  if 'option' not in params:
-          params['option'] = 'reboot'
-  try:
-	  act = params['option'].lower()
-	  if act in ['on', 'off', 'reboot', 'status']:
-		  params['option'] = act
-	  else:
-		  raise Exception
-  except:
-          usage()
-          sys.exit(3)
-	  
-  ### End of validation ###
-
-  if verbose:
-     log('called with ' + str(params))
-  
-  agent = None
-  dummy, sys_id = SNMP(params).get(oid_sysObjectID)
-  if sys_id not in agents_dir:
-     log('Fence device with \'oid_sysObjectID=' + sys_id + '\' is not supported', True)
-     sys.exit(1)
-  agent = agents_dir[sys_id](params)
-  
-  if params['option'] == 'status':
-	  log('Outlet "%s" - %s is %s' % (params['port'], 
-					  str(agent.resolve_outlet()),
-					  agent.status()))
-  elif params['option'] == 'on':
-	  agent.power_on()
-	  if agent.status() != 'on':
-		  raise Exception, 'Error turning outlet on'
-  elif params['option'] == 'off':
-	  agent.power_off()
-	  if agent.status() != 'off':
-		  raise Exception, 'Error turning outlet off'
-  elif params['option'] == 'reboot':
-	  agent.power_off()
-          time.sleep(3)
-	  if agent.status() != 'off':
-		  raise Exception, 'Error turning outlet off'
-	  agent.power_on()
-	  if agent.status() != 'on':
-		  raise Exception, 'Error turning outlet on'
-  else:
-	  print 'nothing to do'
-	  sys.exit(1)
-	  pass
-  
-
-  
-def execWithCaptureStatus(command, argv, searchPath = 0, root = '/', stdin = 0,
-			  catchfd = 1, closefd = -1):
-	
-    if not os.access (root + command, os.X_OK):
-        raise Exception, command + " cannot be run"
-    
-    (read, write) = os.pipe()
-    
-    childpid = os.fork()
-    if (not childpid):
-        if (root and root != '/'): os.chroot (root)
-        if isinstance(catchfd, tuple):
-            for fd in catchfd:
-                os.dup2(write, fd)
-        else:
-            os.dup2(write, catchfd)
-        os.close(write)
-        os.close(read)
-	
-        if closefd != -1:
-            os.close(closefd)
-	
-        if stdin:
-            os.dup2(stdin, 0)
-            os.close(stdin)
-	
-        if (searchPath):
-            os.execvp(command, argv)
-        else:
-            os.execv(command, argv)
-	
-        sys.exit(1)
-    
-    os.close(write)
-    
-    rc = ""
-    s = "1"
-    while (s):
-        select.select([read], [], [])
-        s = os.read(read, 1000)
-        rc = rc + s
-    
-    os.close(read)
-    
-    try:
-        (pid, status) = os.waitpid(childpid, 0)
-    except OSError, (errno, msg):
-        print __name__, "waitpid:", msg
-    
-    if os.WIFEXITED(status) and (os.WEXITSTATUS(status) == 0):
-        status = os.WEXITSTATUS(status)
-    else:
-        status = -1
-    
-    return (rc, status)
+	apc_snmp_define_defaults()
+
+	options=check_input(device_opt,process_input(device_opt))
+
+        ## Support for -n [switch]:[plug] notation that was used before
+	if ((options.has_key("-n")) and (-1 != options["-n"].find(":"))):
+		(switch, plug) = options["-n"].split(":", 1)
+		if ((switch.isdigit()) and (plug.isdigit())):
+		        options["-s"] = switch
+			options["-n"] = plug
+
+	if (not (options.has_key("-s"))):
+		options["-s"]="1"
+
+	# Operate the fencing device
+	fence_action(FencingSnmp(options), options, set_power_status, get_power_status, get_outlets_status)
 
 if __name__ == "__main__":
-	ret = main()
-	sys.exit(ret)
+	main()
diff --git a/fence/man/Makefile b/fence/man/Makefile
index 69cbe7c..a2f1dec 100644
--- a/fence/man/Makefile
+++ b/fence/man/Makefile
@@ -1,6 +1,7 @@
 TARGET=	fence_ack_manual.8 \
 	fence_alom.8 \
 	fence_apc.8 \
+	fence_apc_snmp.8 \
 	fence_baytech.8 \
 	fence_bladecenter.8 \
 	fence_brocade.8 \
diff --git a/fence/man/fence_apc_snmp.8 b/fence/man/fence_apc_snmp.8
new file mode 100644
index 0000000..0e4805e
--- /dev/null
+++ b/fence/man/fence_apc_snmp.8
@@ -0,0 +1,139 @@
+.TH fence_apc_snmp 8
+
+.SH NAME
+fence_apc_snmp - I/O Fencing agent for APC PDU SNMP devices
+
+.SH SYNOPSIS
+.B
+fence_apc_snmp
+[\fIOPTION\fR]...
+
+.SH DESCRIPTION
+fence_apc is an I/O Fencing agent which can be used with the APC rPDU,
+MasterSwitch and MasterSwitch+ 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.
+
+fence_apc_snmp accepts options on the command line as well as from stdin.
+Fenced sends parameters through stdin when it execs the agent.  fence_apc_snmp
+can be run by itself with command line options.  This is useful for testing.
+
+.SH OPTIONS
+.TP
+\fB-a\fP \fIIPaddress\fR
+IP address or hostname of the SNMP device. Can be used any syntax supported by snmpget.
+.TP
+\fB-h\fP
+Print out a help message describing available options, then exit.
+.TP
+\fB-c\fP \fIcommunity\fR
+The read/write community string to be used in the request. Default private.
+.TP
+\fB-n\fP \fIname\fR
+Name of port to fence or port index. Port can use syntax switch:port.
+.TP
+\fB-s\fP \fInumber\fR
+The switch to operate on.  Defaults to "1" if not specified.
+.TP
+\fB-p\fP \fIpassword\fR
+Password for login for SNMP v3 (authentication protocol pass phrase).
+.TP
+\fB-P\fP \fIpassword\fR
+Password for privacy for SNMP v3 (privacy protocol password).
+.TP
+\fB-S\fP \fIscript\fR
+Script to run to retrieve password for login for SNMP v3 (authentication protocol pass phrase).
+.TP
+\fB-R\fP \fIscript\fR
+Script to run to retrieve privacy for SNMP v3 (privacy protocol password).
+.TP
+\fB-l\fP \fIlogin\fR
+Login name for SNMP v3 (security name).
+.TP
+\fB-d\fP \fIversion\fR
+SNMP version (1,2c,3). Default 1.
+.TP
+\fB-b\fP \fIauth_protocol\fR
+SNMP authentication protocol (MD5|SHA).
+.TP
+\fB-E\fP \fIsec_level\fR
+SNMP security level (noAuthNoPriv|authNoPriv|authPriv).
+.TP
+\fB-B\fP \fIpriv_protocol\fR
+SNMP privacy protocol (DES|AES).
+.TP
+\fB-u\fP \fIudp_port\fR
+UDP/TCP port to use.
+.TP
+\fB-o\fP \fIaction\fR
+The action required.  off (default), on, status, list or monitor. Deprecated
+options (enable -> on and disable -> off) can be used too.
+.TP
+\fB-v\fP
+Verbose. Record session to stdout, or debug file if specified (see -D).
+.TP
+\fB-D\fP
+Specifies file, where will be written debug messages from session.
+.TP
+\fB-V\fP
+Print out a version message, then exit.
+
+.SH STDIN PARAMETERS
+.TP
+\fIagent = < param >\fR
+This option is used by fence_node(8) and is ignored by fence_apc_snmp.
+.TP
+\fIipaddr = < param >\fR
+IP address or hostname of the SNMP device. Can be used any syntax supported by snmpget.
+.TP
+\fIcommunity = < param >\fR
+The read/write community string to be used in the request. Default private.
+.TP
+\fIport = < param >\fR
+Name of port to fence or port index. Port can use syntax switch:port.
+.TP
+\fIswitch = < param >\fR
+The switch to operate on.  Defaults to "1" if not specified.
+.TP
+\fIpasswd = < param >\fR
+Password for login for SNMP v3 (authentication protocol pass phrase).
+.TP
+\fIsnmp_priv_passwd\fR
+Password for privacy for SNMP v3 (privacy protocol password).
+.TP
+\fIpasswd_script = < param >\fR
+Script to run to retrieve password for login for SNMP v3 (authentication protocol pass phrase).
+.TP
+\fIsnmp_priv_passwd_script = < param>\fR
+Password for privacy for SNMP v3 (privacy protocol password).
+.TP
+\fIlogin = < param >\fR
+Login name for SNMP v3 (security name).
+.TP
+\fIsnmp_version = < param >\fR
+SNMP version (1,2c,3). Default 1.
+.TP
+\fIsnmp_auth_prot = < param >\fR
+SNMP authentication protocol (MD5|SHA).
+.TP
+\fIsnmp_sec_level = < param >\fR
+SNMP security level (noAuthNoPriv|authNoPriv|authPriv).
+.TP
+\fIsnmp_priv_prot = < param >\fR
+SNMP privacy protocol (DES|AES).
+.TP
+\fIudpport = < param >\fR
+UDP/TCP port to use.
+.TP
+\fIaction = < param >\fR
+The action required.  off (default), on, status, list or monitor. Deprecated
+options (enable -> on and disable -> off) can be used too.
+.TP
+\fIverbose = < param >\fR
+Verbose.  Record session to stdout, or debug file if specified (see debug).
+.TP
+\fIdebug = < param >\fR
+Specifies file, where will be written debug messages from session.
+
+.SH SEE ALSO
+fence(8), fence_node(8)



More information about the Cluster-cvs mailing list