Module: check_mk
Branch: master
Commit: 78193679233eb44e98782f204961bd0c19fed26d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=78193679233eb4…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Fri Aug 2 14:36:19 2013 +0200
skeleton auf agent_emcvnx added
---
agents/special/agent_emcvnx | 127 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 127 insertions(+)
diff --git a/agents/special/agent_emcvnx b/agents/special/agent_emcvnx
new file mode 100755
index 0000000..d8ef9f5
--- /dev/null
+++ b/agents/special/agent_emcvnx
@@ -0,0 +1,127 @@
+#!/usr/bin/python
+# encoding: utf-8
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2010 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at
http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+# command reference for naviseccli
+#
http://corpusweb130.emc.com/upd_prod_VNX/UPDFinalPDF/jp/Command_Reference_f…
+
+# commands to be issued
+#naviseccli -h 10.1.36.13 -User XXXX -Password XXXX -Scope0 getall < -sp>
+#naviseccli -h 10.1.36.13 -User XXXX -Password XXXX -Scope0 getall < -disk>
+#naviseccli -h 10.1.36.13 -User XXXX -Password XXXX -Scope0 getall < -array>
+#naviseccli -h 10.1.36.13 -User XXXX -Password XXXX -Scope0 getall < -lun>
+
+# command generic (rest less important)
+# naviseccli -h 10.1.36.13 -User XXXX -Password XXXX -Scope0 getall <-host>
+# < -array><-hba
><-sp><-cache><-disk><-lun><-rg><-sg>
+# <-mirrorview><-snapviews><-sancopy><-reserved>
<-cloneview><-metalun>
+# <-migration><-ioportconfig> <-fastcache><-backendbus>
+
+import sys, os, getopt,socket
+
+import inspect, pprint # FOR DEBUGGING
+
+def usage():
+ sys.stderr.write("""Check_MK EMC VNX Agent
+
+USAGE: agent_emcvnx [OPTIONS] HOST
+ agent_emcvnx -h
+
+ARGUMENTS:
+ HOST Host name or IP address of EMC VNX
+
+OPTIONS:
+ -h, --help Show this help message and exit
+ -u USER, --user USER Username for EMC VNX login
+ -p PASSWORD, --password PASSWORD Password for EMC VNX login
+ -t, --timeout SECS Set the timeout for naviseccli command execution to SECS
+ seconds. The default is 60 sec.
+ --debug Debug mode: let Python exceptions come through
+
+ --profile Enable performance profiling in Python source code
+
+""")
+
+short_options = 'hu:p:t:'
+long_options = [ 'help', 'user=', 'password=', 'debug',
'timeout=', 'profile' ]
+
+try:
+ opts, args = getopt.getopt(sys.argv[1:], short_options, long_options)
+except getopt.GetoptError, err:
+ sys.stderr.write("%s\n" % err)
+ sys.exit(1)
+
+opt_debug = False
+opt_timeout = 60
+
+g_profile = None
+g_profile_path = "emcvnx_profile.out"
+
+host_address = None
+user = None
+password = None
+
+for o,a in opts:
+ if o in [ '--debug' ]:
+ opt_debug = True
+ elif o in [ '--profile' ]:
+ import cProfile
+ g_profile = cProfile.Profile()
+ g_profile.enable()
+ elif o in [ '-u', '--user' ]:
+ user = a
+ elif o in [ '-p', '--password' ]:
+ password = a
+ elif o in [ '-t', '--timeout' ]:
+ opt_timeout = int(a)
+ elif o in [ '-h', '--help' ]:
+ usage()
+ sys.exit(0)
+
+if len(args) == 1:
+ host_address = args[0]
+elif not args:
+ sys.stderr.write("ERROR: No host given.\n")
+ sys.exit(1)
+else:
+ sys.stderr.write("ERROR: Please specify exactly one host.\n")
+ sys.exit(1)
+
+def output_profile():
+ g_profile.dump_stats(g_profile_path)
+ show_profile = os.path.join(os.path.dirname(g_profile_path),
'show_profile.py')
+ file(show_profile, "w")\
+ .write("#!/usr/bin/python\n"
+ "import pstats\n"
+ "stats = pstats.Stats('%s')\n"
+ "stats.sort_stats('time').print_stats()\n" %
g_profile_path)
+ os.chmod(show_profile, 0755)
+
+ sys.stderr.write("Profile '%s' written. Please run %s.\n" %
(g_profile_path, show_profile))
+
+print "<<<emcvnx_hugo>>>"
+
+if g_profile:
+ output_profile()