Switch / Router wizard and NagVis weathermap colours

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
solarmon
Posts: 81
Joined: Fri Sep 13, 2019 3:57 am

Switch / Router wizard and NagVis weathermap colours

Post by solarmon »

Hi,

As per:

https://support.nagios.com/forum/viewto ... =6&t=51280

I was able to add in the check_iftraffic64 check to be able to generate the perfdata data required by NagVis weathermap feature.

I have tested it in NagVis yet, but I have a question.

Does this mean that the Switch / Router wizard becomes redundant/useless as we would need to replace the check command from check_rrdtraf to check_iftraffic64 for each interface service check?

I suppose the wizard is still useful to automatically detect and create the service for each interface, but then I would still have to manually change each interface service to use check_iftraffic64. So the MRTG checks and RRD file for each interface seems a bit redundant?
Last edited by solarmon on Tue Oct 01, 2019 6:22 am, edited 1 time in total.
solarmon
Posts: 81
Joined: Fri Sep 13, 2019 3:57 am

Re: Switch / Router wizard and NagVis weathermap colours

Post by solarmon »

To get the switch/router wizard to use the check_iftraffic64 check, is it a case of editing the following in switch.inc.php?

Code: Select all

$objs[] = array(
                                        "type" => OBJECTTYPE_SERVICE,
                                        "host_name" => $serviceargs['hostname'],
                                        "service_description" => $portname . " Bandwidth",
                                        "use" => "xiwizard_switch_port_bandwidth_service",
                                        "check_command" => "check_xi_service_mrtgtraf!" . strtolower($serviceargs['ip_address']) . "_" . $portnum . ".rrd!" . $warn_pair . "!" . $crit_pair . "!" . $label,
                                        "_xiwizard" => $wizard_name,
                                    );
But like I said, the MRTG part of this solution would still become redundant?
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Switch / Router wizard and NagVis weathermap colours

Post by cdienger »

The wizard works by configuring a mrtg configuration that polls interfaces to get bandwidth information. Check_rrdtraff then polls the database file that mrtg stores bandwidth information in. With check_itraffic64, these steps are not necessary since check_iftraffic64 pulls the information directly from the switch.

There are likely a few places that need to be modified in the switch.inc.php file(and other files in the wizard package) that would need to be modified to make the wizard work properly with a different plugin. If you're inclined to modify, I'd suggest downloading the wizard and changing the name so that you create a new wizard and leave the old one in place. The wizard can be downloaded from Admin > System Extensions > System Config Wizards, and we have a short dev guide at https://assets.nagios.com/downloads/nag ... ios-XI.pdf
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
solarmon
Posts: 81
Joined: Fri Sep 13, 2019 3:57 am

Re: Switch / Router wizard and NagVis weathermap colours

Post by solarmon »

@cdienger

I understand how the switch/router wizard works and how it uses MRTG.

What I don't understand is why it does make use of MRTG to poll and create the RRD files. Why use another polling and data storage method, when Nagios does that already? What can MRTG do that Nagios cannot?

I just need an SNMP based wizard that will scan the interfaces and create the services in a format that NagVis can use to display weathermap colours. I'm surprised that such a wizard does not exist already.

Thanks for the dev guide link. I think I will try/attempt to create a new wizard. For now, I just want it to create the services and use check_itraffic64 instead of check_rrdtraff. Then, I need to figure out how to remove the mrtg elements of it, as this is not required.

This is going to be a steep learning curve for me!
solarmon
Posts: 81
Joined: Fri Sep 13, 2019 3:57 am

Re: Switch / Router wizard and NagVis weathermap colours

Post by solarmon »

OK, so I made a first attempt at creating a modified wizard based on the Switch/Router one.

I hashed out the existing objs array and replaced it with one that uses check_xi_service_iftraffic64:

Code: Select all

//$objs[] = array(
                                    //    "type" => OBJECTTYPE_SERVICE,
                                    //    "host_name" => $serviceargs['hostname'],
                                    //    "service_description" => $portname . " Bandwidth",
                                    //    "use" => "xiwizard_switch_port_bandwidth_service",
                                    //    "check_command" => "check_xi_service_mrtgtraf!" . strtolower($serviceargs['ip_address']) . "_" . $portnum . ".rrd!" . $warn_pair . "!" . $crit_pair . "!" . $label,
                                    //    "_xiwizard" => $wizard_name,
                                    //);
									
									$objs[] = array(
                                        "type" => OBJECTTYPE_SERVICE,
                                        "host_name" => $serviceargs['hostname'],
                                        "service_description" => $portname . " Bandwidth - iftraffic64",
                                        "use" => "xiwizard_switch_port_bandwidth_service", // Service Template
                                        "check_command" => "check_xi_service_iftraffic64" . "!" . $serviceargs['snmpcommunity'] . "!" . $portname,
                                        "_xiwizard" => $wizard_name,
                                    );
I had to add "iftraffic64" to various functions as they would be clashing with the existing switch/router wizard functions. (It seems like the wizard php file files just gets included, so any functions used needs to be uniquely named?)

The first attempt seems to work, and the 'Bandwidth' service for the interface now uses of the check_xi_service_iftraffic64 check command.

Obviously it will still create the MRTG configs, which is now redundant. So the next iteration of this iftraffic64 wizard needs to remove that.
Last edited by solarmon on Fri Oct 04, 2019 2:21 am, edited 1 time in total.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Switch / Router wizard and NagVis weathermap colours

Post by cdienger »

Thanks for the update. One of the advantages of the current wizard is that it uses mrtg to scan and find interfaces. A wizard using iftraffic64 does sound useful though so feel free to help others and post it on exchange.nagios.org :)
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked