Dell OpenManage Plugin with Nagios core 4.0.7 with CCM 1.03

This forum is to be used by people who have downloaded the Student or Pro VM

Dell OpenManage Plugin with Nagios core 4.0.7 with CCM 1.03

Postby SPAGHETTI » Tue Mar 19, 2019 3:03 am

Hello,



I've installed Dell OpenSense PlugIn 3.0 successfull on a nagios core 4 with Nagios CCM (Core Configuration Manager, Student Version)

After running python dellemc_nagios_discovery_service_utility.py --host=192.168.50.244 --prefProtocol=2 --http.user=root --http.password=xxx --output.file=/usr/local/nagios/dell/config/objects --all

and restarting nagios, this new Server shows up in nagios, but it has this error on line 148..
Image

When running this command from console, I'll get some good results.

python2.7 /usr/local/nagios/dell/scripts/dellemc_device_check.py --host=192.168.50.244 --componentname=Subsystem --devicetype=iDRAC --logPath=/usr/local/nagios/var/dell --protocol=2 --http.user=root --http.password=pw --http.port=443 --http.timeout=30 --http.retries=1
Voltage = OK<br>Storage = OK<br>Overall System = OK<br>Power Supply = OK<br>Amperage = OK<br>Fan = OK<br>Intrusion = OK<br>Memory = OK<br>Battery = OK<br>CPU = OK<br>Temperature = OK



Anyone any idea? I have already asked in the Dell Forum but not getting any help at all!

Best Regards



****dellemc_device_check.py****

#############################################################################################
#Title:dellemc_device_check.py
#Version:3.0
#Creation Date: 01-Apr-2018
#Description: dellemc_device_check.py, to excute the service definition command.
#Copyright (c) 2018 Dell Inc. or its subsidiaries. All rights reserved. Dell, EMC,
# and other trademarks are trademarks of Dell Inc. or its subsidiaries.
# Other trademarks may be trademarks of their respective owners.
############################################################################################
import sys
import json
import os
import subprocess
import time
import datetime
import argparse
from fileTemplate import *
import nagios_properties
from log import NagiosLogger

sys.path.append(os.getcwd())
from omsdk.sdkproto import SNMPOptions
from omsdk.http.sdkwsmanbase import WsManOptions
from omsdk.http.sdkhttpep import AuthenticationType
from sys import stdout, path
from omsdk.sdkenum import ComponentScope,CreateMonitorScopeFilter
from omsdk.sdkcreds import UserCredentials,ProtocolCredentialsFactory,Snmpv2Credentials
from omsdk.sdkinfra import sdkinfra
from nagiossdkvisitor import EntitySerializer,SDKHealthVisitor,StringFormatter
from dellemc_check_warranty import *
from omsdk.sdkprotopref import ProtoPreference, ProtocolEnum
from omsdk.http.sdkredfishbase import RedfishOptions

parser = argparse.ArgumentParser()
parser.add_argument('--host', dest='host' )
parser.add_argument('--devicetype', dest='devicetype')
parser.add_argument('--protocol', dest="protocol", type=str)
parser.add_argument('--componentname', dest='componentname')
parser.add_argument('--monitorfilter', dest='monitorfilter')
parser.add_argument('--primaryStatusOnly', dest='primaryStatusOnly', type=str,choices=('0','1'))
parser.add_argument('--setservicestatus', dest='setservicestatus', type=str,choices=('0','1','2','3'))
parser.add_argument('--logPath',dest='logPath',type=str)
parser.add_argument('--warranty.criticalDays', dest="usercriticalDays")
parser.add_argument('--warranty.warningDays', dest="userwarningDays")
parser.add_argument('--excludeinstance',dest='excludeinstance',type=str)
parser.add_argument('--readFile',dest='protoInfo',type=bool, default=False)
parser.add_argument('--s',dest='servicename',type=str)
parser.add_argument('--snmp.version', dest="snVersion", type=str,
help="version of SNMP protocol")
parser.add_argument('--snmp.community', dest="comString", type=str,
help="Community string for SNMP",default='public')
parser.add_argument('--snmp.port', dest="snmpPort", type=int,
help="Provides SNMP port information",default=161)
parser.add_argument('--snmp.retries', dest="snmpRet", type=int,
help="SNMP retries count",default=2)
parser.add_argument('--snmp.timeout', dest="snmpTout", type=int,
help="SNMP timeout value in seconds",default=3)
parser.add_argument('--http.user', dest="httpUser", type=str,
help="WSMan / REST authentication username")
parser.add_argument('--http.password', dest="httpPassword", type=str,
help="WSMan / REST authentication Password")
parser.add_argument('--http.timeout', dest="httpTimeout", type=int,
help="WSMan / REST timeout in seconds",default=30)
parser.add_argument('--http.retries', dest="httpRet", type=int,
help="WSMan / REST timeout",default=1)
parser.add_argument('--http.port', dest="httpPort", type=int,
help="WSMan / REST port",default=443)
parser.add_argument('--nagios.type', dest="nagiostype", type=int,
help="0 - Nagios Core, 1 - Nagios XI", default=0)
args = parser.parse_args()

host = args.host
deviceType = args.devicetype
componentname = args.componentname
excludeinstance = args.excludeinstance
logger=None
setTrap=args.protoInfo
service=args.servicename
inputPort = None
protopref = None

MF = "Key+MainHealth+BasicInventory+Inventory+ConfigState+Metrics+OtherHealth+Health"
if componentname in ["Subsystem"]:
MF = "Key+MainHealth"

def initialize_logger1(logPath):
st = datetime.datetime.fromtimestamp(time.time()).strftime('%Y%m')
logfile = logFileFormat.format("device_monitor_"+host, st);
if setTrap == True:
logfile = logFileFormat.format("device_monitor_TBH_"+host, st);
logPath = os.path.join(logPath, logfile);
global logger
logger = NagiosLogger(__name__,logPath)

if(args.logPath != 'None'):
initialize_logger1(args.logPath)

def write_log(string,level):
if logger:
logger.setLevel(level)
logger.writeLog(string)
protocol = None
loc_submitcheck = None

def set_submitcheckLoc():
global loc_submitcheck
if args.nagiostype == 1:
loc_submitcheck = nagios_properties.nagiosxi_location+"/submit_check_result.sh"
else:
loc_submitcheck = sys.argv[0].replace("/dell/scripts/dellemc_device_check.py","")+"/libexec/eventhandlers/submit_check_result"


pdict ={}
def readfile(host):
global pdict
global protocol
objectFile_loc = None
tempfilename = None
curloc = None
if "dellemc_device_check.py" in sys.argv[0]:
curloc=sys.argv[0].replace("dellemc_device_check.py","")
if args.nagiostype == 1:
curloc = nagios_properties.nagiosxi_location
config_file_path = curloc+ "/dellconfigLoc.cfg"
with open (config_file_path, "r") as loc:
for line in loc:
if "NagiosCLoc=" in line:
objectFile_loc =line.split("=")
break
if args.nagiostype == 1:
tempfilename = os.path.join(objectFile_loc[1], host + ".cfg")
else:
tempfilename = objectFile_loc[1]+ host + ".cfg"
if not os.path.isfile(tempfilename):
hostname = gethostname(host)
tempfilename = objectFile_loc[1] + hostname + ".cfg"

with open (tempfilename, "r") as myfile:
for line in myfile:
if "--protocol" in line:
string1=line.split("! ")
for string in string1:
if 'check_command' in string:
string1.remove(string)
break

LINE148 pdict = {y[0]:y[1] for y in (x.split('=') for x in string1)}
break
protocol = nagios_properties.protocol_map.get(pdict.get('--protocol').strip())
myfile.close()

def gethostname(host):
try:
data = socket.gethostbyaddr(host)
hostname = data[0]
return hostname
except Exception:
return host

if setTrap == True:
readfile(host)
set_submitcheckLoc()
else:
protocol = nagios_properties.protocol_map.get(args.protocol)
primaryStatusOnly = args.primaryStatusOnly
setservicestatus = args.setservicestatus

sd = sdkinfra()
sd.importPath()

def process_WSMAN_param():
if setTrap==True:
(user, password, port, conTimeout, retries) = (pdict.get('--http.user'), pdict.get('--http.password'), pdict.get('--http.port'), pdict.get('--http.timeout'), pdict.get('--http.retries'))
else:
(user, password, port, conTimeout, retries) = (args.httpUser, args.httpPassword, args.httpPort, args.httpTimeout, args.httpRet)
creds = ProtocolCredentialsFactory()
creds.add(UserCredentials(user, password))
pOpUser = WsManOptions(authentication=AuthenticationType.Basic, port=int(port), connection_timeout=int(conTimeout),read_timeout = 50,\
max_retries=int(retries), verify_ssl=False)
return (creds, pOpUser)

def process_SNMP_param():
if setTrap==True:
(commString, port, conTimeout, retries) = (
pdict.get('--snmp.community'), pdict.get('--snmp.port'), pdict.get('--snmp.timeout'), pdict.get('--snmp.retries'))
else:
(commString, port, conTimeout, retries) = (
args.comString, args.snmpPort, args.snmpTout, args.snmpRet)
creds = ProtocolCredentialsFactory()
creds.add(Snmpv2Credentials(commString))
pOpUser = SNMPOptions(port=int(port), timeout=int(conTimeout), nretries=int(retries))
return (creds, pOpUser)

def process_Redfish_param():
if setTrap == True:
(user, password, port, conTimeout, retries) = (
pdict.get('--http.user'), pdict.get('--http.password'), pdict.get('--http.port'), pdict.get('--http.timeout'),
pdict.get('--http.retries'))
else:
(user, password, port, conTimeout, retries) = (
args.httpUser, args.httpPassword, args.httpPort, args.httpTimeout, args.httpRet)
creds = ProtocolCredentialsFactory()
creds.add(UserCredentials(user, password))
pOpUser = RedfishOptions(authentication=AuthenticationType.Basic, port=int(port), connection_timeout=int(conTimeout),read_timeout = 50,\
max_retries=int(retries), verify_ssl=False)
return (creds, pOpUser)
if ('WSMAN' in protocol):
(creds, pOption) = process_WSMAN_param()
if ('SNMP' in protocol):
(creds, pOption) = process_SNMP_param()
if ('REDFISH' in protocol):
(creds, pOption) = process_Redfish_param()
protopref = ProtoPreference(ProtocolEnum.REDFISH)



deviceObj = sd.get_driver(deviceType, host, creds,protopref, pOptions=pOption)

if deviceObj is None:
print("Error:"+status_message_format.format(protocol, host))
write_log(status_message_format.format(protocol, host),"error")
exit(3)

temp = componentname.split(',')
MC = temp
tempDict = {}
write_log("Monitoring "+deviceType+ " ip "+host+" using protocol "+protocol +" for componentname "+componentname,"info")
deviceObj.get_partial_entityjson_str(*MC)
if(len(MC) >1):
tempDict,componentname = get_extraAttribute_dict(deviceType,MC,deviceObj)

monitorfilter = CreateMonitorScopeFilter(MF)
templist = MF.split('+')

def call():
if (componentname == "warranty"):
ip = validate_ip(host,inputPort)
check_warranty(re_usr_ipCrit=args.usercriticalDays, re_usr_ipWarn=args.userwarningDays,device_obj=deviceObj, address=ip)
else:
mystring = EntitySerializer(deviceObj, StringFormatter('<br>'), templist, excludeinstance, deviceType,
primaryStatusOnly,tempDict).visit(componentname).formatter.mystring
exit_code = SDKHealthVisitor(deviceObj, excludeinstance, deviceType,setservicestatus).visit(
componentname)._exit_code()
write_log(" Component " + componentname + " is " + nagios_properties.nagios_health.get(exit_code), "info")
deviceObj.reset()
mystring = mystring[:-4]
if setTrap == True :
trapbasedcmd = loc_submitcheck
subprocess.Popen([trapbasedcmd, str(host), str(service), str(exit_code), str(mystring)], stdout=subprocess.PIPE)
write_log("collecting Trap based health information for host "+host+" service:"+str(service)+" :"+str(mystring),"info")
else:
print(mystring)
#print(int(exit_code))
exit(int(exit_code))

call()
Attachments
core.png
SPAGHETTI
 
Posts: 5
Joined: Tue Mar 19, 2019 2:50 am

Re: Dell OpenManage Plugin with Nagios core 4.0.7 with CCM 1

Postby npolovenko » Tue Mar 19, 2019 2:55 pm

Hello, @SPAGHETTI. So it seems like its running from the command line just not from the GUI, right?
/usr/local/nagios/dell/scripts/dellemc_device_check.py --host=192.168.50.244 --componentname=Subsystem --devicetype=iDRAC --logPath=/usr/local/nagios/var/dell --protocol=2 --http.user=root --http.password=pw --http.port=443 --http.timeout=30 --http.retries=1
Voltage = OK<br>Storage = OK<br>Overall System = OK<br>Power Supply = OK<br>Amperage = OK<br>Fan = OK<br>Intrusion = OK<br>Memory = OK<br>Battery = OK<br>CPU = OK<br>Temperature = OK


Can you show me service checks definitions from the Core?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
npolovenko
Support Tech
 
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Dell OpenManage Plugin with Nagios core 4.0.7 with CCM 1

Postby SPAGHETTI » Tue Mar 19, 2019 4:07 pm

Dear @npolovenko,

I'm so glad someone replied :)

Please find attachment movie to get more informations about my system.

https://youtu.be/SeYJYB6oKts

You're right. It's running just fine from the command line. I'm not sure if nagios has a problem with the python execution...
SPAGHETTI
 
Posts: 5
Joined: Tue Mar 19, 2019 2:50 am

Re: Dell OpenManage Plugin with Nagios core 4.0.7 with CCM 1

Postby npolovenko » Wed Mar 20, 2019 3:15 pm

@SPAGHETTI, We typically respond within 24 hours Monday through Friday so no worries there :)
Thanks for the video. Can you sign in to the console as the nagios user and try to execute the command one more time?
su - nagios
/usr/local/nagios/dell/scripts/dellemc_device_check.py --host=192.168.50.244 --componentname=Subsystem --devicetype=iDRAC --logPath=/usr/local/nagios/var/dell --protocol=2 --http.user=root --http.password=pw --http.port=443 --http.timeout=30 --http.retries=1

Let me know if this works.

Also, all the following python modules are used by this plugin:
import sys
import json
import os
import subprocess
import time
import datetime
import argparse

You may try to run the following commands from the console to test whether all the above python modules work under nagios user.
su nagios -c 'python -c "import sys"'
su nagios -c 'python -c "import json"'
su nagios -c 'python -c "import os"'
su nagios -c 'python -c "import subprocess"'
su nagios -c 'python -c "import time"'
su nagios -c 'python -c "import datetime"'
su nagios -c 'python -c "import argparse"'


I've seen systems where users had multiple python enviroments/versions and nagios user in shell was pointing to the wrong path.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
npolovenko
Support Tech
 
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Dell OpenManage Plugin with Nagios core 4.0.7 with CCM 1

Postby SPAGHETTI » Wed Mar 20, 2019 4:32 pm

Dear npolovenko,

it seems to work from the command line via su - nagios:

[root@BUMON01 nagios]# su - nagios
[nagios@BUMON01 ~]$ python /usr/local/nagios/libexec/dellemc_device_check.py --host=192.168.50.244 --componentname=Subsystem --devicetype=iDRAC --logPath=/usr/local/nagios/var/dell --protocol=2 --http.user=root --http.password=pw --http.port=443 --http.timeout=30 --http.retries=1 --nagios.type=0
Voltage = OK<br>Storage = OK<br>Overall System = OK<br>Amperage = OK<br>Intrusion = OK<br>Memory = OK<br>Battery = OK<br>Temperature = OK<br>Power Supply = Unknown<br>Fan = Unknown<br>CPU = Unknown


Also I don't get any error when running the import command as you showed:

[root@BUMON01 nagios]# su nagios -c 'python -c "import json"'
[root@BUMON01 nagios]# su nagios -c 'python -c "import os"'
[root@BUMON01 nagios]# su nagios -c 'python -c "import subprocess"'
[root@BUMON01 nagios]# su nagios -c 'python -c "import time"'
[root@BUMON01 nagios]#
[root@BUMON01 nagios]# su nagios -c 'python -c "import datetime"'
You have new mail in /var/spool/mail/nagios
[root@BUMON01 nagios]# su nagios -c 'python -c "import datetime"'
[root@BUMON01 nagios]# su nagios -c 'python -c "import argparse"'


the next thing I'll try, is to rerun the installation of this dell plugin as the nagios user

Best Wishes,
SPAGHETTI
 
Posts: 5
Joined: Tue Mar 19, 2019 2:50 am

Re: Dell OpenManage Plugin with Nagios core 4.0.7 with CCM 1

Postby SPAGHETTI » Wed Mar 20, 2019 5:05 pm

well... that didn't change anything

running the installation of dell openmanage plugin as nagios user, seems to work fine

[i][nagios@BUMON01 Install]$ ./install.sh

Dell EMC OpenManage Plug-in v3.0 for Nagios Core requires Nagios Core v3.5.0 or later.
Press 'Y' to continue if Nagios Core version is 3.5.0 or later.
Press any other key to exit installation (default: 'Y'): y

Provide the installed location of Nagios Core (Press ENTER to continue with the default location: '/usr/loca l/nagios'):

Using the default Nagios Core installed location: /usr/local/nagios
Nagios Core installed location verified: /usr/local/nagios

Checking prerequisites...
SNMPTT is installed.
JAVA is installed.
PYTHON 2.7.5 is installed.
PYTHON argparse module is installed.
PYTHON netaddr module is installed.
OpenManage Python Software Development Kit (OMSDK) module is installed.

Read the Dell EMC End User License Agreement (EULA) license file (license_en.txt) packaged with this product before proceeding with the installation.
Press 'Y' to accept the license.
Press any other key to exit installation (default: 'Y'): y

Enabling HTML tags...

The attribute "escape_html_tags" in file "cgi.cfg" is set to 1. Set it to 0 for better readability in Nagios Core console (recommended).
Press 'Y' if you would like to set it to '0' (default: 'N'):

Updating nagios.cfg...

Provide the file path where snmptt.ini is installed (Press ENTER to continue with the default file path: '/e tc/snmp/snmptt.ini'):

Provided file path /etc/snmp/snmptt.ini is valid.

Updating snmptt.ini...


Unable to update SNMPTT.ini file.
For Trap integration insert the following line in section [TrapFiles] before END, to file snmptt.ini .
---------------------------------------------------------------------
/usr/local/nagios/dell/config/templates/Dell_Agent_free_Server_Traps.conf
/usr/local/nagios/dell/config/templates/Dell_Chassis_Traps.conf
/usr/local/nagios/dell/config/templates/Dell_Compellent_Traps.conf
/usr/local/nagios/dell/config/templates/Dell_EqualLogic_Traps.conf
/usr/local/nagios/dell/config/templates/Dell_F10_Switch_Traps.conf
/usr/local/nagios/dell/config/templates/Dell_N_Series_Traps.conf
/usr/local/nagios/dell/config/templates/Dell_PowerVaultMD_Traps.conf
---------------------------------------------------------------------

Provide the file path where JAVA is installed (Press ENTER to continue with the default file path: '/usr/bin /java'):

Provided file path /usr/bin/java is valid.

Updating dellconfig.cfg...

SUCCESS: Dell EMC OpenManage Plug-in version v3.0 is installed successfully.

For the Dell EMC OpenManage Plug-in changes to take effect, verify the Nagios and SNMPTT configuration entri es as per product guidelines and then restart the Nagios and SNMPTT services.[/i]


hmm... could there be a slight chance that Nagios CCM 1.03 overwrites some config files changes, which were done from the dell openmanage plugin installation?

I really don't get it why it works just fine from the shell with the root and nagios user while nagios gui doesn't give me any output at all

Some more files bellow:

Host config file, which was generated by running
python dellemc_nagios_discovery_service_utility.py --host=192.168.50.244 --prefProtocol=2 --http.user=root --http.password=admin --output.file=/usr/local/nagios/dell/config/objects --all

192.168.50.244.cfg

#======================================================================================
# Dell EMC Agent-free Server host definition
#======================================================================================
define host{
use Dell EMC Agent-free Server
host_name 192.168.50.244
alias 192.168.50.244
address 192.168.50.244
display_name 192.168.50.244
icon_image idrac.png
hostgroups Dell EMC Agent-free Servers
statusmap_image idrac.png
action_url https://192.168.50.244:443
_serviceTag 8RWM2T2
notes Protocol selected :WSMAN

}


define service{
use Dell EMC Device Health Status
host_name 192.168.50.244
service_description Dell EMC Server Overall Health Status
check_command dellemc_check_script! --devicetype=iDRAC! --componentname=Subsystem! --protocol=2! --http.user=root! --http.password=admin! --http.timeout=30! --http.port=443! --http.retries=1! --logPath=None!
}


define service{
use Dell EMC Device Inventory Information
host_name 192.168.50.244
service_description Dell EMC Server Information
check_command dellemc_check_script! --devicetype=iDRAC! --componentname=System,iDRAC! --protocol=2! --http.user=root! --http.password=admin! --http.timeout=30! --http.port=443! --http.retries=1! --logPath=None! --setservicestatus=0!
}


define service{
use Dell EMC Traps
host_name 192.168.50.244
service_description Dell EMC Server Traps
}

define service{
use Dell EMC Device Component Status
host_name 192.168.50.244
service_description Dell EMC Server Physical Disk Status
check_command dellemc_check_script! --devicetype=iDRAC! --componentname=PhysicalDisk! --protocol=2! --http.user=root! --http.password=admin! --http.timeout=30! --http.port=443! --http.retries=1! --logPath=None! --excludeinstance="Status==OK"!
}


define service{
use Dell EMC Device Inventory Information
host_name 192.168.50.244
service_description Dell EMC Server Warranty Information
check_command dellemc_warranty_check_script! --devicetype=iDRAC! --componentname=warranty! --protocol=2! --http.user=root! --http.password=admin! --http.timeout=30! --http.port=443! --http.retries=1! --logPath=None! --warranty.warningDays=None! --warranty.criticalDays=None!
}


define service{
use Dell EMC Device Component Status
host_name 192.168.50.244
service_description Dell EMC Server Voltage Probe Status
check_command dellemc_check_script! --devicetype=iDRAC! --componentname=Sensors_Voltage! --protocol=2! --http.user=root! --http.password=admin! --http.timeout=30! --http.port=443! --http.retries=1! --logPath=None! --excludeinstance="Status==OK"!
}


define service{
use Dell EMC Device Component Status
host_name 192.168.50.244
service_description Dell EMC Server Intrusion Status
check_command dellemc_check_script! --devicetype=iDRAC! --componentname=Sensors_Intrusion! --protocol=2! --http.user=root! --http.password=admin! --http.timeout=30! --http.port=443! --http.retries=1! --logPath=None! --excludeinstance="Status==OK"!
}


define service{
use Dell EMC Device Component Status
host_name 192.168.50.244
service_description Dell EMC Server Network Device Status
check_command dellemc_check_script! --devicetype=iDRAC! --componentname=NIC! --protocol=2! --http.user=root! --http.password=admin! --http.timeout=30! --http.port=443! --http.retries=1! --logPath=None! --excludeinstance="ConnectionStatus==Up"!
}


define service{
use Dell EMC Device Component Status
host_name 192.168.50.244
service_description Dell EMC Server Virtual Disk Status
check_command dellemc_check_script! --devicetype=iDRAC! --componentname=VirtualDisk! --protocol=2! --http.user=root! --http.password=admin! --http.timeout=30! --http.port=443! --http.retries=1! --logPath=None! --excludeinstance="Status==OK"!
}


define service{
use Dell EMC Device Component Status
host_name 192.168.50.244
service_description Dell EMC Server Power Supply Status
check_command dellemc_check_script! --devicetype=iDRAC! --componentname=PowerSupply! --protocol=2! --http.user=root! --http.password=admin! --http.timeout=30! --http.port=443! --http.retries=1! --logPath=None! --excludeinstance="Status==OK"!
}


define service{
use Dell EMC Device Component Status
host_name 192.168.50.244
service_description Dell EMC Server Amperage Probe Status
check_command dellemc_check_script! --devicetype=iDRAC! --componentname=Sensors_Amperage! --protocol=2! --http.user=root! --http.password=admin! --http.timeout=30! --http.port=443! --http.retries=1! --logPath=None! --excludeinstance="Status==OK"!
}


define service{
use Dell EMC Device Component Status
host_name 192.168.50.244
service_description Dell EMC Server Controller Status
check_command dellemc_check_script! --devicetype=iDRAC! --componentname=Controller! --protocol=2! --http.user=root! --http.password=admin! --http.timeout=30! --http.port=443! --http.retries=1! --logPath=None! --excludeinstance="Status==OK"!
}


define service{
use Dell EMC Device Component Status
host_name 192.168.50.244
service_description Dell EMC Server FC NIC Status
check_command dellemc_check_script! --devicetype=iDRAC! --componentname=FC! --protocol=2! --http.user=root! --http.password=admin! --http.timeout=30! --http.port=443! --http.retries=1! --logPath=None! --excludeinstance="ConnectionStatus==Up"!
}


define service{
use Dell EMC Device Component Status
host_name 192.168.50.244
service_description Dell EMC Server Fan Status
check_command dellemc_check_script! --devicetype=iDRAC! --componentname=Sensors_Fan! --protocol=2! --http.user=root! --http.password=admin! --http.timeout=30! --http.port=443! --http.retries=1! --logPath=None! --excludeinstance="Status==OK"!
}


define service{
use Dell EMC Device Component Status
host_name 192.168.50.244
service_description Dell EMC Server Memory Status
check_command dellemc_check_script! --devicetype=iDRAC! --componentname=Memory! --protocol=2! --http.user=root! --http.password=admin! --http.timeout=30! --http.port=443! --http.retries=1! --logPath=None! --excludeinstance="Status==OK"!
}


define service{
use Dell EMC Device Component Status
host_name 192.168.50.244
service_description Dell EMC Server Battery Status
check_command dellemc_check_script! --devicetype=iDRAC! --componentname=Sensors_Battery! --protocol=2! --http.user=root! --http.password=admin! --http.timeout=30! --http.port=443! --http.retries=1! --logPath=None! --excludeinstance="Status==OK"!
}


define service{
use Dell EMC Device Component Status
host_name 192.168.50.244
service_description Dell EMC Server CPU Status
check_command dellemc_check_script! --devicetype=iDRAC! --componentname=CPU! --protocol=2! --http.user=root! --http.password=admin! --http.timeout=30! --http.port=443! --http.retries=1! --logPath=None! --excludeinstance="Status==OK"!
}


define service{
use Dell EMC Device Component Status
host_name 192.168.50.244
service_description Dell EMC Server SD Card Status
check_command dellemc_check_script! --devicetype=iDRAC! --componentname=VFlash! --protocol=2! --http.user=root! --http.password=admin! --http.timeout=30! --http.port=443! --http.retries=1! --logPath=None! --excludeinstance="Status==OK"!
}


define service{
use Dell EMC Device Component Status
host_name 192.168.50.244
service_description Dell EMC Server Temperature Probe Status
check_command dellemc_check_script! --devicetype=iDRAC! --componentname=Sensors_Temperature! --protocol=2! --http.user=root! --http.password=admin! --http.timeout=30! --http.port=443! --http.retries=1! --logPath=None! --excludeinstance="Status==OK"!
}


[size=200]dell_commands.cfg[/size]

###############################################################################
# DELL_COMMANDS.CFG - SAMPLE COMMAND DEFINITIONS FOR NAGIOS Core
#
# Last Modified: 01-Apr-2018
#
# NOTES: This config file provides you with some example command definitions
# that you can reference in host, service, and contact definitions.
#
# You don't need to keep commands in a separate file from your other
# object definitions. This has been done just to make things easier to
# understand.
# Copyright (c) 2018 Dell Inc. or its subsidiaries. All rights reserved. Dell, EMC,
# and other trademarks are trademarks of Dell Inc. or its subsidiaries.
# Other trademarks may be trademarks of their respective owners.
###############################################################################


################################################################################
#
# SAMPLE NOTIFICATION COMMANDS
#
# These are some example notification commands. They may or may not work on
# your system without modification. As an example, some systems will require
# you to use "/usr/bin/mailx" instead of "/usr/bin/mail" in the commands below.
#
################################################################################


define command{
command_name notify-dell-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}

# 'notify-service-by-email' command definition
define command{
command_name notify-dell-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}

define command{
command_name check_dell_oob_server_component_snmp
command_line perl /usr/local/nagios/dell/scripts/dell_check_idrac_snmp.pl -H $HOSTADDRESS$ "-F" $ARG1$ "-i" $ARG2$
}

define command{
command_name check_dell_oob_server_component_wsman
command_line perl /usr/local/nagios/dell/scripts/dell_check_idrac_wsman.pl -H $HOSTADDRESS$ "-F" $ARG1$ "-i" $ARG2$
}

define command{
command_name check_dell_chassis_component
command_line perl /usr/local/nagios/dell/scripts/dell_check_chassis.pl -H $HOSTADDRESS$ "-F" $ARG1$ "-i" $ARG2$
}

define command{
command_name check_dell_equallogic_component
command_line perl /usr/local/nagios/dell/scripts/dell_check_equallogic.pl -H $HOSTADDRESS$ "-F" $ARG1$ "-i" $ARG2$ "-x" $_HOSTINDEX$
}

define command{
command_name check_dell_compellent_component
command_line perl /usr/local/nagios/dell/scripts/dell_check_compellent.pl -H $HOSTADDRESS$ "-F" $ARG1$ "-i" $ARG2$ "-x" $_HOSTINDEX$
}

define command{
command_name check_dell_md_component
command_line perl /usr/local/nagios/dell/scripts/dell_check_md.pl -H $HOSTADDRESS$ "-F" $ARG1$ "-i" $ARG2$
}

define command{
command_name dell_check_warranty
command_line perl /usr/local/nagios/dell/scripts/dell_check_warranty.pl -H $HOSTADDRESS$ "-F" $ARG1$ "-i" $ARG2$ "-svt" $_HOSTSERVICETAG$
}

define command{
command_name dellemc_check_script
command_line python /usr/local/nagios/dell/scripts/dellemc_device_check.py --host=$HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$ $ARG7$ $ARG8$ $ARG9$ $ARG10$ $ARG11$


}
define command{
command_name dellemc_warranty_check_script
command_line python /usr/local/nagios/dell/scripts/dellemc_device_check.py --host=$HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$ $ARG7$ $ARG8$ $ARG9$ $ARG10$ $ARG11$
}

################################################################################
#
# SAMPLE HOST CHECK COMMANDS
#
################################################################################


# This command checks to see if a host is "alive" by pinging it
# The check must result in a 100% packet loss or 5 second (5000ms) round trip
# average time to produce a critical error.
# Note: Five ICMP echo packets are sent (determined by the '-p 5' argument)

# 'check-host-alive' command definition
define command{
command_name check-dell-host-alive
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
}



dell_templates.cfg

###############################################################################
# DELL_TEMPLATES.CFG - SAMPLE OBJECT TEMPLATES
#
# Last Modified: 01-Apr-2018
#
# NOTES: This config file provides you with some example object definition
# templates that are refered by other host, service, contact, etc.
# definitions in other config files.
#
# You don't need to keep these definitions in a separate file from your
# other object definitions. This has been done just to make things
# easier to understand.
# Copyright (c) 2018 Dell Inc. or its subsidiaries. All rights reserved. Dell, EMC,
# and other trademarks are trademarks of Dell Inc. or its subsidiaries.
# Other trademarks may be trademarks of their respective owners.
###############################################################################



###############################################################################
###############################################################################
#
# CONTACT TEMPLATES
#
###############################################################################
###############################################################################

# Generic contact definition template - This is NOT a real contact, just a template!

define contact{
name Dell-contact ; The name of this contact template
service_notification_period Dell-24x7 ; service notifications can be sent anytime
host_notification_period Dell-24x7 ; host notifications can be sent anytime
service_notification_options w,u,c,r,f,s ; send notifications for all service states, flapping events, and scheduled downtime events
host_notification_options d,u,r,f,s ; send notifications for all host states, flapping events, and scheduled downtime events
service_notification_commands notify-dell-service-by-email ; send service notifications via email
host_notification_commands notify-dell-host-by-email ; send host notifications via email
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE!
}





###############################################################################
#
# HOST TEMPLATES
#
###############################################################################

#################################
# Dell Host templates
##################################
define host{
name Dell EMC Device ; The name of this host template
check_period Dell-24x7 ; By default, Linux hosts are checked round the clock
check_interval 5 ; Actively check the host in minutes interval
retry_interval 3 ; Schedule host check retries in minutes interval
max_check_attempts 3 ;
check_command check-dell-host-alive
notification_period dellworkhours ; Linux delladmins hate to be woken up, so we only notify during the day
notification_interval 120 ; Resend notifications every 2 hours
notification_options d,u,r ; Only send notifications for specific host states
contact_groups delladmins ; Notifications get sent to the delladmins by default
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}

define host{
name Dell EMC Agent-free Server ; The name of this host template
use Dell EMC Device
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}

define host{
name Dell EMC Chassis ; The name of this host template
use Dell EMC Device
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}

define host{
name Dell EMC Storage ; The name of this host template
use Dell EMC Device
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}
define host{
name Dell EMC Networking ; The name of this host template
use Dell EMC Device
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}
#################################
# Dell Service templates
##################################

define service{
name Dell EMC-Service ; The 'name' of this service template
active_checks_enabled 1 ; Active service checks are enabled
passive_checks_enabled 1 ; Passive service checks are enabled/accepted
parallelize_check 1 ; Active service checks should be parallelized (disabling this can lead to major performance problems)
obsess_over_service 1 ; We should obsess over this service (if necessary)
check_freshness 0 ; Default is to NOT check service 'freshness'
notifications_enabled 1 ; Service notifications are enabled
event_handler_enabled 1 ; Service event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
failure_prediction_enabled 1 ; Failure prediction is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
is_volatile 0 ; The service is not volatile
check_period Dell-24x7 ; The service can be checked at any time of the day
max_check_attempts 10 ; Re-check the service up to 3 times in order to determine its final (hard) state
normal_check_interval 6 ; Check the service in minutes interval under normal conditions
retry_check_interval 3 ; Re-check the service in minutes interval until a hard state can be determined
contact_groups delladmins ; Notifications get sent out to everyone in the 'delladmins' group
notification_options w,u,c,r ; Send notifications about warning, unknown, critical, and recovery events
notification_interval 720 ; Re-notify about service problems every hour
notification_period Dell-24x7 ; Notifications can be sent out at any time
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
}


define service{
name Dell EMC Device Health Status
use Dell EMC-Service
register 0
service_description Dell EMC Device Overall Health Status
normal_check_interval 60 ; Polling interval in minutes
retry_check_interval 15
contact_groups delladmins
}


define service{
name Dell EMC Device Inventory Information
use Dell EMC-Service
register 0
service_description Dell EMC Device Inventory Information
normal_check_interval 1440 ; Polling interval in minutes
notification_interval 1440
retry_check_interval 60
contact_groups delladmins
}
define service{
name Dell EMC Device Component Status
use Dell EMC-Service
register 0
service_description Dell EMC Device Component Status
normal_check_interval 240 ; Polling interval in minutes
retry_check_interval 30
contact_groups delladmins
}

define service{
name Dell EMC Traps
use Dell EMC-Service
register 0
service_description Dell EMC SNMP Trap Service
is_volatile 1
flap_detection_enabled 0
check_command check-dell-host-alive
active_checks_enabled 0
max_check_attempts 1
normal_check_interval 1
retry_check_interval 1
passive_checks_enabled 1
check_period Dell-24x7
#notification_interval 1
notification_interval 31536000
contact_groups delladmins
}


##########################################
#Dell Host Group Templates
##########################################
define hostgroup{
hostgroup_name Dell EMC Agent-free Servers
alias Dell EMC Agent-free Servers
}

define hostgroup{
hostgroup_name Dell EMC XC
alias Dell EMC XC
}
define hostgroup{
hostgroup_name Dell EMC VxRail
alias Dell EMC VxRail
}
define hostgroup{
hostgroup_name Dell EMC Chassis
alias Dell EMC Chassis
}

define hostgroup{
hostgroup_name Dell EMC Storage
alias Dell EMC Storage
}
define hostgroup{
hostgroup_name Dell EMC Networking
alias Dell EMC Networking
}
SPAGHETTI
 
Posts: 5
Joined: Tue Mar 19, 2019 2:50 am

Re: Dell OpenManage Plugin with Nagios core 4.0.7 with CCM 1

Postby ssax » Fri Mar 22, 2019 2:37 pm

Try this:

Code: Select all
define service {
   use Dell EMC Device Health Status
   host_name 192.168.50.244
   service_description Dell EMC Server Overall Health Status
   check_command dellemc_check_script!--devicetype=iDRAC!--componentname=Subsystem!--protocol=2!--http.user='USERNAME'!--http.password='PASSWORD'!--http.timeout=30!--http.port=443!--http.retries=1!--logPath=/usr/local/nagios/var/dell!--nagios.type=0!
}

define command {
   command_name dellemc_check_script
   command_line python /usr/local/nagios/dell/scripts/dellemc_device_check.py --host=$HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$ $ARG7$ $ARG8$ $ARG9$ $ARG10$ $ARG11$
}


Is there a verbose option for the dellemc_device_check.py command?

Code: Select all
python /usr/local/nagios/dell/scripts/dellemc_device_check.py -h


If there is, please add it to the command and then run the check with it and send us the full output from the Service Details page.


Let us know the results.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
ssax
Dreams In Code
 
Posts: 4433
Joined: Wed Feb 11, 2015 12:54 pm

Re: Dell OpenManage Plugin with Nagios core 4.0.7 with CCM 1

Postby SPAGHETTI » Fri Mar 22, 2019 8:10 pm

can't believe it.

Everything is working now. All I had to do was to put the 2.7 on the python command python2.7:

python2.7 /usr/local/nagios/dell/scripts/dellemc_device_check.py --host=$HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$ $ARG7$ $ARG8$ $ARG9$ $ARG10$ $ARG11$

why there was no need to put 2.7 when running from the shell?

Thanks for you help guys,
Regards
SPAGHETTI
 
Posts: 5
Joined: Tue Mar 19, 2019 2:50 am

Re: Dell OpenManage Plugin with Nagios core 4.0.7 with CCM 1

Postby scottwilkerson » Mon Mar 25, 2019 7:57 am

SPAGHETTI wrote:can't believe it.

Everything is working now. All I had to do was to put the 2.7 on the python command python2.7:

python2.7 /usr/local/nagios/dell/scripts/dellemc_device_check.py --host=$HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$ $ARG7$ $ARG8$ $ARG9$ $ARG10$ $ARG11$

why there was no need to put 2.7 when running from the shell?

Thanks for you help guys,
Regards


You likely have that set in your path from the CLI

Glad to hear it is working!

Locking thread
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 17368
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises


Return to Nagios Core Student/Pro VM

Who is online

Users browsing this forum: No registered users and 1 guest