Nagios Plugin for Cacti (NPC) 2.0.4

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
amaena
Posts: 5
Joined: Thu Apr 17, 2008 2:02 pm

Post by amaena »

1st, with the duplicates I see that I will have to add the conditional for config_type back. Prior to build 151 hosts and services had a "where config_type = 1" conditional in the queries. I removed it because a user was getting config_type set to some other value. I can't find any docs on ndo2db about why or what config_type should be except that all the sample queries provided with ndo2db used config_type=1 so that has to be right. And I dont know why ndo2db adds duplicates but with different config types. In my setup, config type is equal to 1 always and I don't have duplicates <shrug>. After I change this back anyone not getting entries with config_type=1 will have to troubleshoot their ndo2db/nagios setup.
I think that the duplicate entries comes from ndomod.cfg

Code: Select all

# OUTPUT
# This option determines the name and path of the file or UNIX domain
# socket to which output will be sent if the output type option specified
"/nagios/etc/ndomod.cfg" 151 lines, 4751 characters
data_processing_options=-1

# CONFIG OUTPUT OPTION
# This option determines what types of configuration data the NDO
# NEB module will dump from Nagios.  Values can be OR'ed together.
# Values:
#         0 = Don't dump any configuration information
#         1 = Dump only original config (from config files)
#         2 = Dump config only after retained information has been restored
#         3 = Dump both original and retained configuration

config_output_options=3
Do any of the screens have data? Click on the 'Services' tree menu and let me know what you see. Tail the apache error log and look for any fatal errors.

None of my screens have any data, but if I create a new graph, I have an option for mapping to nagios host names, and that drop down is populated with my duplicate npc_hosts table entries.

I checked the apache logs for any fatal errors and nothing, I checked the ndo2db log file for any failed mysql entries and nothing all looks clean :) really odd.
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

amaena wrote:I think that the duplicate entries comes from ndomod.cfg
Hi amaena. You were right on in that the config_output_options option in ndomod.cfg could cause duplicates depending on the option specified. I tried out each of the options and got the following results:

config_output_options=0 - No hosts/services
config_output_options=1 - hosts/services with config_type=0
config_output_options=2 - hosts/services with config_type=1
config_output_options=3 - duplicate hosts/services with config_type=0 and 1

The queries provided with ndo2db all use config_type=1 as a condition. The next build pf NPC will query on config_type=1 for hosts/services and config_output_options=2 (or 3) will be a documented requirement. Thanks for pointing this out.
amaena wrote:None of my screens have any data, but if I create a new graph, I have an option for mapping to nagios host names, and that drop down is populated with my duplicate npc_hosts table entries.

I checked the apache logs for any fatal errors and nothing, I checked the ndo2db log file for any failed mysql entries and nothing all looks clean really odd.
Point your browser to the following URL:

Code: Select all

http://<cacti_url>/plugins/npc/npc.php?module=services&action=getServices&p_state=any
You should get some json output. Shoot me the first couple lines. A blank white page indicates a fatal error which could be caused by not having pdo or json support.

~Billy
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

NPC 2.0.0 beta (build 166) has been released. All existing users are encouraged to upgrade. See the first post in this thread for notes and download link.

Cheers,
Billy
gimpel
Posts: 5
Joined: Tue Apr 08, 2008 9:19 am

Post by gimpel »

divagater wrote:NPC 2.0.0 beta (build 166) has been released. All existing users are encouraged to upgrade. See the first post in this thread for notes and download link.

Cheers,
Billy
Thanks for the new release!

One thing I found now (didn't check that in previous version though):
* When I click on "View Map" in some service's "Service details" I get a wrong link

Code: Select all

[Mon Apr 21 11:27:58 2008] [error] [client 192.168.80.31] script '/srv/www/htdocs/graph_image.php' not found or unable to stat, referer: http://phmon01/cacti/plugins/npc/npc.php?module=layoutDev&action=drawLayout
That should be /cacti/graph_image.php

Grepping around I only found js/src/npc.js which does a lot with

Code: Select all

<img src="/graph_image.php?action=view&local_graph_id={0}&rra_id=1&graph_height=120&graph_width=500">
and thelike.

Maybe this should use $config['url_path'] = '/cacti/'; from global.php too?

* Second one: If I do not define a refresh rate for the "Service Problems" widget in the dashboard, it initially keeps reloading endlessly and displays nothing. Once a rate is set, it works fine.
So maybe a default rate should be defined.

PS: actually posting bugreports in forums is sub-optimal, do you prefer tickets in your trac? :)
sonartribe
Posts: 25
Joined: Mon May 08, 2006 10:31 am

config_type revisited

Post by sonartribe »

Billy,

In a previous post, I had explained where the config_type value comes from, just in case you missed it.

The config_type value is determined on whether you use the nagios option retain_state_information. If you have "retain_state_information" set to 1, and thus Nagios remembers state information on stops/starts, the npc_hosts/npc_services information is retained and has config_type=1.

If you have "retain_state_information" set to 0, then nagios doesn't remember anything on restart, so it will populate the npc_hosts and npc_services on startup with config_type=0.

And this is where the config in the ndomod.cfg file comes from, whether NDO just posts the retained config, startup config or both.

So I think this needs to be documented. Either you have the "retain_state_information" set as a pre-requisite, so that config_type=1 information is available, or you keep the searches as they are and get the user to select the correct option in ndomod.cfg file, dependent on their config. (and never set it to "3"!)

Regards

Ian :o
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

gimpel wrote:PS: actually posting bugreports in forums is sub-optimal, do you prefer tickets in your trac? :)
gimpel, thanks for catching that bug. I will clean up the url paths and make sure everything is using $config['url_path']. trac would be great for reporting bugs but here is ok too. I usually just open a ticket for myself from the info in the post :)

And that service status portlet should have had a default refresh rate. I will look into what is going on there as well.

Thank,
Billy
Last edited by divagater on Mon Apr 21, 2008 7:20 am, edited 1 time in total.
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Re: config_type revisited

Post by divagater »

sonartribe wrote:Billy, In a previous post, I had explained where the config_type value comes from, just in case you missed it.
Hey Ian, I do remember you brining this up, it jus't didn't fully click. And just when I thought I had it fully figured out you throw a wrench in :) I think what has been throwing me off is that the sample queries in nodutils all use config_type=1 as a condition so I felt like I needed to work within that setup.

I will run through all the combinations of config_output_options in ndomod.cfg and retain_state_information in nagios.cfg so that I fully grasp what is happening. Then I will get the queries updated and documentation on how to configure.

Were you able to get running on the beta release by fixing the queries or changing your config?

~Billy
sonartribe
Posts: 25
Joined: Mon May 08, 2006 10:31 am

Post by sonartribe »

Both. :lol:

I changed the queries to start off with to get it working, but when I figured out where the values were coming from, I changed my Nagios config to retain the state information.

This is really good work, keep it up :-)

Ian
amaena
Posts: 5
Joined: Thu Apr 17, 2008 2:02 pm

Post by amaena »

Results of http://<cacti_url>/plugins/npc/npc.php?module=services&action=getServices&p_state=any

Definitely not blank! :P

Code: Select all

 Revision 158, 10.4 kB (checked in by divagater, 16 hours ago)

Added config_type=1 conditional back to host and service queries

    * Property svn:keywords set to id

Line	 
1 	<?php
2 	/**
3 	 * Services controller class
4 	 *
5 	 * This is the access point to the npc_services table.
6 	 *
7 	 * @filesource
8 	 * @author              Billy Gunn <billy@gunn.org>
9 	 * @copyright           Copyright (c) 2007
10 	 * @link                http://trac2.assembla.com/npc
11 	 * @package             npc
12 	 * @subpackage          npc.controllers
13 	 * @since               NPC 2.0
14 	 * @version             $Id$
15 	 */
Edit: I upgraded to build 166 and now I have:

Code: Select all

Fatal error: Uncaught exception 'Doctrine_Connection_Exception' with message 'Couldn't locate driver named mysql' in /var/www/cacti-0.8.7b/plugins/npc/lib/Doctrine/Connection.php:394 Stack trace: #0 /var/www/cacti-0.8.7b/plugins/npc/lib/Doctrine/Connection.php(904): Doctrine_Connection->connect() #1 /var/www/cacti-0.8.7b/plugins/npc/lib/Doctrine/Connection.php(705): Doctrine_Connection->execute('SELECT COUNT(DI...', Array) #2 /var/www/cacti-0.8.7b/plugins/npc/lib/Doctrine/Query.php(1789): Doctrine_Connection->fetchAll('SELECT COUNT(DI...', Array) #3 /var/www/cacti-0.8.7b/plugins/npc/lib/Doctrine/Pager.php(109): Doctrine_Query->count(Array) #4 /var/www/cacti-0.8.7b/plugins/npc/lib/Doctrine/Pager.php(499): Doctrine_Pager->_initialize(Array) #5 /var/www/cacti-0.8.7b/plugins/npc/controllers/services.php(196): Doctrine_Pager->execute(Array, 3) #6 /var/www/cacti-0.8.7b/plugins/npc/controllers/services.php(39): NpcServicesController->services() #7 /var/www/cacti-0.8.7b/plugins/npc/npc.php(76): NpcServicesController->getServices( in /var/www/cacti-0.8.7b/plugins/npc/lib/Doctrine/Connection.php on line 394
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

amaena wrote:Edit: I upgraded to build 166 and now I have:
You are either missing pdo or mysql module for php. I suspect its php-mysql that is missing. If you are not sure what you have and are on an rpm based system run the following command:

Code: Select all

rpm -qa | grep php


Send me the output. You could also just try doing:

Code: Select all

yum install php-mysql php-pdo
Again this assumes an rpm based system with yum otherwise use the appropriate package management to do the same thing.

Cheers,
Billy
amaena
Posts: 5
Joined: Thu Apr 17, 2008 2:02 pm

Post by amaena »

Oy yoy yoy...

apache wasn't reading my php.ini :)

I have a write up now for getting this all to work on Solaris 9 that I will send you shortly :)

Thanks for your help!
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

I just realized that an error in the build file is causing the latest build (build 166) to load all the javascript source files instead of the minimized/compressed version. If performance is an issue for any of you a single edit can fix the problem. Edit plugins/npc/npc.php.

Change line 34 from this:

Code: Select all

$module = 'layoutDev';
to this:

Code: Select all

$module = 'layout';
This will be updated in the next release.

Cheers,
Billy
Heiko
Cacti User
Posts: 77
Joined: Wed Apr 23, 2008 11:03 am

Post by Heiko »

Hello Forum,

i have cacti running, also with some plugins, but I cant get npc to show me a tab, it is nowhere listed but in the update plugin.
In the quickstart guide it says something about "Plugin Management ".
I cant find that too.
My system is a centos5.1, with the cacti package from centos and manually installed pluginarchitecture.
I have nagios runnning for some time, including NDO2DB which i need for something else.

How can i get npc to show up in cacti?

If you need more information, ill be happy to post them.

greetings


Heiko
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

Heiko wrote:How can i get npc to show up in cacti?
Heiko, you need to have plugin architecture 2.0 or higher. 2.1 is the latest. After the plugin architecture is installed go to Console -> User Management. Select your admin user and check 'Plugin Management'. This will enable plugin management for that user.

Then follow the steps in the quickstart guide for installing NPC.

~Billy
amaena
Posts: 5
Joined: Thu Apr 17, 2008 2:02 pm

Post by amaena »

Is there any additional documentation available for setting up the performance graphs for nagios services in cacti using npc?

I followed the steps from page 8 of the forum by clicking on services, and then service detail and map graph, however the only graphs available are localhost ones and I am wondering what needs to be done from the cacti side.

I see the option on create new host for mapping a hostname to a nagios hostname but would like a bit more guidance. Perhaps something like setting up a performance graph for using the ping results from nagios?

Thanks !
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests