Page 3 of 4

Re: Cisco UCSM Plugin Discovery

Posted: Thu Jun 04, 2015 10:16 am
by CFT6Server
I've PM you the zipped up configs, and I used the overwrite option when importing.

Re: Cisco UCSM Plugin Discovery

Posted: Thu Jun 04, 2015 11:02 am
by ssax
What version of XI are you running? It worked fine for me.

Here's how I did it:

- Copied the files to /usr/local/nagios/etc/import
- Go to Configure > Core Config Manager > Tools > Import Config Files
- Make sure Overwrite Database is checked.
- Import cmd.cfg, if yours is saying it already exists, just skip it and see if the rest work for you.
- Import cisco_ucs_host.cfg and all cfg files under kdbchucs01/kdbchucs02/kdbchucs03 except for the services.cfg files.
- Import hostgrp.cfg and hostextinfo.cfg
- Import cisco_ucs_service.cfg, kdbchucs01/services.cfg, kdbchucs02/services.cfg, and kdbchucs03/services.cfg

Apply configuration.

Re: Cisco UCSM Plugin Discovery

Posted: Thu Jun 04, 2015 11:48 am
by CFT6Server
I tried the import by following the import documentation from Nagios. No luck.

I tested with your method by putting the files in import folder, and tested the first file cisco_ucs_host.cfg and got the same error.

Code: Select all

Error: Could not add object property in file '/usr/local/nagios/etc/cisco/ucsObjs/cisco_ucs_host.cfg' on line 2. 

Nagios Core 4.0.8 
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors 
Copyright (c) 1999-2009 Ethan Galstad 
Last Modified: 08-12-2014 
License: GPL 

Website: http://www.nagios.org 
Reading configuration data... 
Read main config file okay... 
WARNING: Extinfo objects are deprecated and will be removed in future versions 
WARNING: Extinfo objects are deprecated and will be removed in future versions 
WARNING: Extinfo objects are deprecated and will be removed in future versions 
WARNING: Extinfo objects are deprecated and will be removed in future versions 
WARNING: Extinfo objects are deprecated and will be removed in future versions 
WARNING: Extinfo objects are deprecated and will be removed in future versions 
Warning: Duplicate definition found for host 'cisco-ucs-host' (config file '/usr/local/nagios/etc/cisco/ucsObjs/cisco_ucs_host.cfg', starting on line 1) 
Error: Could not add object property in file '/usr/local/nagios/etc/cisco/ucsObjs/cisco_ucs_host.cfg' on line 2. 
Error processing object config files! 


***> One or more problems was encountered while processing the config files... 

Check your configuration file(s) to ensure that they contain valid 
directives and data defintions. If you are upgrading from a previous 
version of Nagios, you should be aware that some variables/definitions 
may have been removed or modified in this version. Make sure to read 
the HTML documentation regarding the config files, as well as the 
'Whats New' section to find out what has changed. 
I ensured I am importing from the import folder but noticed it was still complaining about '/usr/local/nagios/etc/cisco/ucsObjs/cisco_ucs_host.cfg'

We are on XI 2014 R2.6

Re: Cisco UCSM Plugin Discovery

Posted: Thu Jun 04, 2015 12:00 pm
by ssax
Can you try removing or moving that /usr/local/nagios/etc/cisco folder out of etc and try it again? Not sure why it's complaining about that.

Re: Cisco UCSM Plugin Discovery

Posted: Thu Jun 04, 2015 4:11 pm
by CFT6Server
So removing the files and then importing it works. I tested it with a few files and will do this for all the cfg files. So my question is this, Should I be changing the default location where the discovery is going. The cfg files works well, just that we cannot manage them within CCM, which is a problem.

Re: Cisco UCSM Plugin Discovery

Posted: Thu Jun 04, 2015 4:35 pm
by ssax
Yes, I would change the default location to outside the etc directory, it will be a manual procedure because the plugin was really written for Nagios Core where you just had flat config files.

Re: Cisco UCSM Plugin Discovery

Posted: Thu Jun 04, 2015 6:51 pm
by CFT6Server
Looks like that works! The only oddity I found was the hostextinfo.cfg file. I can import this but only the first device of each group gets the icon. Everything else is missing it. So for example blade1_1 has the icon, but blade1_x doesn't. I then place the hostextinfo.cfg file back to /usr/local/nagios/etc/cisco/ucsObjs/ folder and all the icons shows up.

Re: Cisco UCSM Plugin Discovery

Posted: Thu Jun 04, 2015 7:06 pm
by CFT6Server
Spoke too soon. Looks like the services were put it as "services".
services.JPG

Re: Cisco UCSM Plugin Discovery

Posted: Fri Jun 05, 2015 11:58 am
by ssax
Oh, yeah, you will need to run the config import prep tool, sorry about that.

Here's how I did it:

First you will need to copy the images to the XI location as well

Code: Select all

cp /path/to/your/plugin/installer/cisco-ucs-nagios-0.9.3/autodiscovery/payload/logos/* /usr/local/nagiosxi/html/includes/components/nagioscore/ui/images/logos/
Prep

Code: Select all

cp -R /your/full/path/cisco/ucsObjs /usr/local/nagios/etc/import
cd /usr/local/nagios/etc/import
for f in ucsObjs/*.cfg ; do /usr/local/nagiosxi/tools/xiprepimport.php $f ; done
for f in ucsObjs/kdcbchucs01/*.cfg ; do /usr/local/nagiosxi/tools/xiprepimport.php $f ; done
for f in ucsObjs/kdcbchucs02/*.cfg ; do /usr/local/nagiosxi/tools/xiprepimport.php $f ; done
for f in ucsObjs/kdcbchucs03/*.cfg ; do /usr/local/nagiosxi/tools/xiprepimport.php $f ; done
Cleanup
- The services.cfg and cisco_ucs_service.cfg are empty that's why I'm having you delete them.

Code: Select all

rm -rf /usr/local/nagios/etc/import/ucsObjs
rm -rf /usr/local/nagios/etc/import/services.cfg
rm -rf /usr/local/nagios/etc/import/cisco_ucs_service.cfg
Now go into the XI import interface (Configure > Core Config Manager > Tools > Import Config Files)
- Host extinfo is deprecated so you should not import it, that's why the images don't show up, I'll give you a fix below.
- In the import search bar, type "import" to limit the scope.
- Select and import the cmd.cfg file.
- Select all the configs (including _empty_host.cfg) that are listed except hostgrp.cfg and cmd.cfg and import them.
- Select hostgrp.cfg and import it.

Cleanup old extinfo

Code: Select all

echo "delete from tbl_hostextinfo where icon_image like '%CISCO%';" | mysql -pnagiosxi nagiosql
Now to add the images:

Code: Select all

echo "UPDATE tbl_host SET icon_image = 'CISCO.UCS.R2.Domain.40x40Image.png', icon_image_alt = 'CiscoUCS', statusmap_image = 'CISCO.UCS.R2.Domain.40x40Image.png' WHERE host_name IN ('kdcbchucs01','kdcbchucs03','kdcbchucs02');" | mysql -pnagiosxi nagiosql

echo "UPDATE tbl_host SET icon_image = 'CISCO.UCS.R2.Chassis.40x40Image.png', icon_image_alt = 'CiscoUCSChassis', statusmap_image = 'CISCO.UCS.R2.Chassis.40x40Image.png' WHERE host_name IN ('kdcbchucs01_chassis_1','kdcbchucs01_chassis_2','kdcbchucs01_chassis_3','kdcbchucs01_chassis_4','kdcbchucs01_chassis_5','kdcbchucs01_chassis_6','kdcbchucs03_chassis_1','kdcbchucs03_chassis_2','kdcbchucs03_chassis_3','kdcbchucs03_chassis_4','kdcbchucs03_chassis_5','kdcbchucs03_chassis_6','kdcbchucs02_chassis_1','kdcbchucs02_chassis_2','kdcbchucs02_chassis_3','kdcbchucs02_chassis_4','kdcbchucs02_chassis_5','kdcbchucs02_chassis_6');" | mysql -pnagiosxi nagiosql

echo "UPDATE tbl_host SET icon_image = 'CISCO.UCS.R2.Blade.40x40Image.png', icon_image_alt = 'CiscoUCSBlade', statusmap_image = 'CISCO.UCS.R2.Blade.40x40Image.png' WHERE host_name IN ('kdcbchucs01_blade_1_1','kdcbchucs01_blade_1_2','kdcbchucs01_blade_1_3','kdcbchucs01_blade_1_4','kdcbchucs01_blade_1_5','kdcbchucs01_blade_1_6','kdcbchucs01_blade_1_7','kdcbchucs01_blade_1_8','kdcbchucs01_blade_2_3','kdcbchucs01_blade_2_1','kdcbchucs01_blade_2_5','kdcbchucs01_blade_2_7','kdcbchucs01_blade_2_6','kdcbchucs01_blade_2_8','kdcbchucs01_blade_3_7','kdcbchucs01_blade_3_1','kdcbchucs01_blade_3_2','kdcbchucs01_blade_3_5','kdcbchucs01_blade_3_8','kdcbchucs01_blade_3_4','kdcbchucs01_blade_3_3','kdcbchucs01_blade_4_7','kdcbchucs01_blade_4_5','kdcbchucs01_blade_4_2','kdcbchucs01_blade_4_1','kdcbchucs01_blade_4_3','kdcbchucs01_blade_4_6','kdcbchucs01_blade_4_8','kdcbchucs01_blade_5_2','kdcbchucs01_blade_5_3','kdcbchucs01_blade_5_1','kdcbchucs01_blade_5_4','kdcbchucs01_blade_5_5','kdcbchucs01_blade_5_7','kdcbchucs01_blade_5_8','kdcbchucs01_blade_6_1','kdcbchucs01_blade_6_3','kdcbchucs01_blade_6_7','kdcbchucs01_blade_6_5','kdcbchucs01_blade_6_8','kdcbchucs01_blade_3_6','kdcbchucs03_blade_1_1','kdcbchucs03_blade_1_2','kdcbchucs03_blade_1_5','kdcbchucs03_blade_1_7','kdcbchucs03_blade_1_8','kdcbchucs03_blade_1_3','kdcbchucs03_blade_2_1','kdcbchucs03_blade_2_2','kdcbchucs03_blade_2_3','kdcbchucs03_blade_2_4','kdcbchucs03_blade_2_5','kdcbchucs03_blade_2_6','kdcbchucs03_blade_3_1','kdcbchucs03_blade_3_2','kdcbchucs03_blade_3_6','kdcbchucs03_blade_3_7','kdcbchucs03_blade_4_1','kdcbchucs03_blade_5_1','kdcbchucs03_blade_5_3','kdcbchucs03_blade_5_7','kdcbchucs03_blade_2_8','kdcbchucs03_blade_4_2','kdcbchucs03_blade_5_5','kdcbchucs03_blade_3_3','kdcbchucs03_blade_1_4','kdcbchucs03_blade_4_6','kdcbchucs03_blade_4_7','kdcbchucs03_blade_4_8','kdcbchucs03_blade_4_5','kdcbchucs03_blade_6_7','kdcbchucs03_blade_6_1','kdcbchucs03_blade_6_3','kdcbchucs03_blade_6_4','kdcbchucs03_blade_6_2','kdcbchucs03_blade_5_6','kdcbchucs03_blade_1_6','kdcbchucs03_blade_3_4','kdcbchucs03_blade_4_4','kdcbchucs03_blade_3_5','kdcbchucs03_blade_2_7','kdcbchucs03_blade_4_3','kdcbchucs03_blade_6_5','kdcbchucs03_blade_6_6','kdcbchucs02_blade_1_4','kdcbchucs02_blade_1_3','kdcbchucs02_blade_1_2','kdcbchucs02_blade_1_1','kdcbchucs02_blade_1_5','kdcbchucs02_blade_1_6','kdcbchucs02_blade_1_7','kdcbchucs02_blade_1_8','kdcbchucs02_blade_2_4','kdcbchucs02_blade_2_8','kdcbchucs02_blade_2_7','kdcbchucs02_blade_2_5','kdcbchucs02_blade_2_1','kdcbchucs02_blade_2_6','kdcbchucs02_blade_2_3','kdcbchucs02_blade_2_2','kdcbchucs02_blade_3_1','kdcbchucs02_blade_3_2','kdcbchucs02_blade_3_3','kdcbchucs02_blade_3_4','kdcbchucs02_blade_3_5','kdcbchucs02_blade_4_2','kdcbchucs02_blade_4_1','kdcbchucs02_blade_5_1','kdcbchucs02_blade_5_2','kdcbchucs02_blade_5_3','kdcbchucs02_blade_5_4','kdcbchucs02_blade_5_6','kdcbchucs02_blade_5_7','kdcbchucs02_blade_5_8','kdcbchucs02_blade_4_3','kdcbchucs02_blade_4_5','kdcbchucs02_blade_3_6','kdcbchucs02_blade_3_7','kdcbchucs02_blade_4_7','kdcbchucs02_blade_6_1','kdcbchucs02_blade_6_3','kdcbchucs02_blade_6_5','kdcbchucs02_blade_4_6','kdcbchucs02_blade_6_8','kdcbchucs02_blade_3_8');" | mysql -pnagiosxi nagiosql

echo "UPDATE tbl_host SET icon_image = 'CISCO.UCS.R2.FabricInterconnect.40x40Image.png', icon_image_alt = 'FabricInterconnect', statusmap_image = 'CISCO.UCS.R2.FabricInterconnect.40x40Image.png' WHERE host_name IN ('10.242.2.1_fi_A','10.242.2.2_fi_B','10.242.2.129_fi_A','10.242.2.130_fi_B','10.242.2.65_fi_A','10.242.2.66_fi_B');" | mysql -pnagiosxi nagiosql

echo "UPDATE tbl_host SET icon_image = 'CISCO.UCS.R2.RackUnit.40x40Image.png', icon_image_alt = 'CiscoUCSRack', statusmap_image = 'CISCO.UCS.R2.RackUnit.40x40Image.png' WHERE host_name IN ('kdcbchucs01_rack_1','kdcbchucs01_rack_2','kdcbchucs01_rack_3','kdcbchucs01_rack_4','kdcbchucs01_rack_5','kdcbchucs01_rack_6','kdcbchucs01_rack_7','kdcbchucs01_rack_8','kdcbchucs01_rack_9','kdcbchucs01_rack_10','kdcbchucs01_rack_11');" | mysql -pnagiosxi nagiosql

echo "UPDATE tbl_host SET icon_image = 'CISCO.UCS.R2.IOM.40x40Image.png', icon_image_alt = 'CiscoUCSIOM', statusmap_image = 'CISCO.UCS.R2.IOM.40x40Image.png' WHERE host_name IN ('kdcbchucs01_iom_1_1','kdcbchucs01_iom_2_1','kdcbchucs01_iom_1_2','kdcbchucs01_iom_2_2','kdcbchucs01_iom_3_2','kdcbchucs01_iom_3_1','kdcbchucs01_iom_4_2','kdcbchucs01_iom_4_1','kdcbchucs01_iom_5_2','kdcbchucs01_iom_5_1','kdcbchucs01_iom_6_2','kdcbchucs01_iom_6_1','kdcbchucs03_iom_1_1','kdcbchucs03_iom_1_2','kdcbchucs03_iom_2_1','kdcbchucs03_iom_2_2','kdcbchucs03_iom_3_1','kdcbchucs03_iom_3_2','kdcbchucs03_iom_4_2','kdcbchucs03_iom_4_1','kdcbchucs03_iom_5_1','kdcbchucs03_iom_5_2','kdcbchucs03_iom_6_1','kdcbchucs03_iom_6_2','kdcbchucs02_iom_1_1','kdcbchucs02_iom_1_2','kdcbchucs02_iom_2_2','kdcbchucs02_iom_2_1','kdcbchucs02_iom_3_1','kdcbchucs02_iom_4_1','kdcbchucs02_iom_5_1','kdcbchucs02_iom_3_2','kdcbchucs02_iom_5_2','kdcbchucs02_iom_4_2','kdcbchucs02_iom_6_1','kdcbchucs02_iom_6_2');" | mysql -pnagiosxi nagiosql
Now apply configuration and it should be good.

If you import new ones in the future, edit the host in the CCM and click the Misc tab and set the Status Image, Icon Image, and Icon Image Alt Text in there.

Re: Cisco UCSM Plugin Discovery

Posted: Fri Jun 05, 2015 4:16 pm
by CFT6Server
Thanks. This worked. I was trying to import individually after the preptool, but ran in to errors when writing configs. By accidental, after prepping the files and removing the services. I just hit apply configurations. It took all the cfg files in import and imported it. That worked without a hitch and the hosts and services showed. I resumed from there.