Commit 6022dca6 authored by Fulvio Galeazzi's avatar Fulvio Galeazzi
Browse files

2018-02-27: FG; Run SMcli under sudo.

parent 1c4139b2
......@@ -7,4 +7,6 @@ Cmnd_Alias ZBXHAPROXY = /usr/bin/socat /var/lib/haproxy/stats stdio
Cmnd_Alias ZBXIPSTATE = /usr/sbin/iptstate, /usr/sbin/ipstate
Cmnd_Alias ZBXPS = /bin/ps, /usr/bin/ps, /sbin/ps, /usr/sbin/ps
zabbix ALL = (root) NOPASSWD: ZBXCEPH, ZBXMULTIPATH, ZBXCRMCMD, ZBXHAPROXY, ZBXIPSTATE, ZBXPS
Cmd_Alias ZBXSMCLI = /bin/SMcli, /usr/bin/SMcli, /opt/dell/mdstoragemanager/client/SMcli
zabbix ALL = (root) NOPASSWD: ZBXCEPH, ZBXMULTIPATH, ZBXCRMCMD, ZBXHAPROXY, ZBXIPSTATE, ZBXPS, ZBXSMCLI
......@@ -2,7 +2,7 @@
#
# Name: zbxDellStorageStatusCheck
#
# Get Dell MD3X60 storage server metrics and send to Zabbix using zabbix_sender
# Get Dell MD38XX storage server metrics and send to Zabbix using zabbix_sender
#
# Author: Fulvio Galeazzi
#
......@@ -106,10 +106,11 @@ TEST=1
ZABBIXPORT=10051
ZABBIXSOURCE=localhost
MONINTERVAL=3
PATHBIN="`which SMcli > /dev/null`"
PATHBIN=""
SUDOCMD=`which sudo`
TIMEOUT=30
DEFAULTCONFIG="name,1
iotot,1
iotot,0
readfrac,1
ctrlcachehitr,1
ctrlcachehitw,1
......@@ -222,7 +223,10 @@ if [[ -z $CONFIGFILE ]]; then
fi
KNOWNARRAYS=`mktemp`
GET_CMD="$PATHBIN -d -i > $KNOWNARRAYS"
if [ -z "$PATHBIN" ]; then
PATHBIN="`which SMcli > /dev/null`"
fi
GET_CMD="$SUDOCMD $PATHBIN -d -i > $KNOWNARRAYS"
if [[ $DEBUG = 1 ]]; then
echo -n -e "\n########################################\n"
echo -n -e "Command line to collect data\n"
......@@ -261,7 +265,7 @@ raidList="$raidCtrlThis"
IFS=',' read -a wantObjArr <<< "$WANTOBJECTS"
GET_CMD="$PATHBIN $raidList $CHECKSYNTAX -c 'set session performanceMonitorInterval=$MONINTERVAL performanceMonitorIterations=1 ; save storageArray performanceStats file=\"$STATUSFILE\";' > /dev/null"
GET_CMD="$SUDOCMD $PATHBIN $raidList $CHECKSYNTAX -c 'set session performanceMonitorInterval=$MONINTERVAL performanceMonitorIterations=1 ; save storageArray performanceStats file=\"$STATUSFILE\";' > /dev/null"
# get data from server
eval $GET_CMD
......@@ -302,7 +306,7 @@ if [[ $RET_VAL = 0 ]]; then
deviceName=${firstField:${#tmpString}+1}
deviceName=${deviceName// /_}
for (( idx=1; idx<${#zbxKey[@]}; idx++)); do
if [ ! "$zbxWant[$idx]" ]; then
if [[ ${zbxWant[$idx]} = 0 ]]; then
continue
fi
echo -n "\"$ZABBIXSOURCE\" \"custom.dellmd38xx.device.${zbxKey[$idx]}[${raidNameThis},${deviceType},${deviceName}]\" " >> $SENDERFILE
......@@ -338,6 +342,7 @@ if [[ $DEBUG = 1 ]]; then
echo -e "Parameters\n"
echo "--check=$CHECKSYNTAX"
echo "--path=$PATHBIN"
echo " sudo: $SUDOCMD"
echo "--raid=$raidList"
echo "--interval=$MONINTERVAL"
echo "--zabbixserver=$ZABBIXSERVER"
......
......@@ -70,7 +70,8 @@ HOST=localhost
DEBUG=0
TEST=1
MONINTERVAL=1
PATHBIN="`which SMcli > /dev/null`"
PATHBIN=""
SUDOCMD=`which sudo`
SHOWDEV=0
TIMEOUT=30
WANTOBJECTS="Storage,RAID,Disk"
......@@ -138,7 +139,10 @@ done
# Temporary files
KNOWNARRAYS=`mktemp`
GET_CMD="$PATHBIN -d -i > $KNOWNARRAYS"
if [ -z "$PATHBIN" ]; then
PATHBIN="`which SMcli > /dev/null`"
fi
GET_CMD="$SUDOCMD $PATHBIN -d -i > $KNOWNARRAYS"
if [[ $DEBUG = 1 ]]; then
echo -n -e "\n########################################\n"
echo -n -e "Command line to collect data\n"
......@@ -185,7 +189,7 @@ if [[ $RET_VAL = 0 ]]; then
if [[ $SHOWDEV = 1 ]]; then
STATUSFILE=`mktemp`
GET_CMD="$PATHBIN $raidList $CHECKSYNTAX -c 'set session performanceMonitorInterval=3 performanceMonitorIterations=1 ; save storageArray performanceStats file=\"$STATUSFILE\";' > /dev/null"
GET_CMD="$SUDOCMD $PATHBIN $raidList $CHECKSYNTAX -c 'set session performanceMonitorInterval=3 performanceMonitorIterations=1 ; save storageArray performanceStats file=\"$STATUSFILE\";' > /dev/null"
if [[ $DEBUG = 1 ]]; then
echo -n -e "\n########################################\n"
echo -n -e "Command line to collect data\n"
......@@ -250,6 +254,7 @@ if [[ $DEBUG = 1 ]]; then
echo -e "Parameters\n"
echo "--check=$CHECKSYNTAX"
echo "--path=$PATHBIN"
echo " sudo: $SUDOCMD"
echo "--match=$MATCHSTR"
echo "--interval=$MONINTERVAL"
echo "--devices: $SHOWDEV"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment