Nagios Plugin for Cacti (NPC) 2.0.4

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
palbandoz
Posts: 12
Joined: Wed May 07, 2008 11:20 am

Post by palbandoz »

Hi all.

Am I the only one having problems with the NPC packages? I've tried versions 2.0.0a-136, 2.0.0a-151 and 2.0.0b-166 but every time I untar those packages an error occours:
[root@localhost plugins]# tar xzvf npc-2.0.0b.166.tar.gz
npc/queries/scheduled_downtime.sql
npc/queries/service_flapping_history.sql
npc/queries/contact_notifications.sql
npc/queries/timed_events.sql
npc/queries/host_comments.sql
npc/queries/services.sql
npc/queries/flapping_history.sql
npc/queries/service_status.sql
npc/queries/comments.sql
npc/queries/service_state_history.sql
npc/queries/host_state_history.sql
npc/queries/contacts.sql
npc/queries/comment_history.sql
npc/queries/contactgroup_membership.sql
npc/queries/service_downtime_history.sql
npc/queries/contact_status.sql
npc/queries/state_history.sql
npc/queries/hosts.sql
npc/queries/event_handlers.sql
npc/queries/service_event_handlers.sql
npc/queries/downtime_history.sql
npc/queries/host_flapping_history.sql
npc/queries/notifications.sql
npc/queries/host_status.sql
npc/queries/contact_notification_methods.sql
npc/queries/hostgroup_membership.sql
npc/queries/host_notifications.sql
npc/queries/timed_event_queue.sql
npc/queries/service_notifications.sql
npc/queries/host_downtime_history.sql
npc/queries/servicegroup_membership.sql
npc/queries/host_event_handlers.sql
npc/queries/service_comments.sql
npc/controllers/hostgroups.php
npc/controllers/downtime.php
npc/controllers/logentries.php
npc/controllers/statehistory.php
npc/controllers/layout.php
npc/controllers/servicegroups.php
npc/controllers/controller.php
npc/controllers/comments.php
npc/controllers/settings.php
npc/controllers/layoutDev.php
npc/controllers/services.php
npc/controllers/sync.php
npc/controllers/hosts.php
npc/controllers/nagios.php
npc/controllers/cacti.php
npc/controllers/notifications.php
npc/js/portlets-all-min.js
npc/js/src/Portlet.js
npc/js/src/build.xml
npc/js/src/monitoring/n2c.js
tar: Skipping to next header

gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error exit delayed from previous errors
[root@localhost plugins]#
And there is free disk space to unpack it...

Any idea? (or any other link?)

Thanks
pheezy
Cacti User
Posts: 61
Joined: Thu Oct 26, 2006 5:30 pm

Post by pheezy »

palbandoz wrote:Hi all.

Am I the only one having problems with the NPC packages? I've tried versions 2.0.0a-136, 2.0.0a-151 and 2.0.0b-166 but every time I untar those packages an error occours:
[root@localhost plugins]# tar xzvf npc-2.0.0b.166.tar.gz
npc/queries/scheduled_downtime.sql
npc/queries/service_flapping_history.sql
npc/queries/contact_notifications.sql
npc/queries/timed_events.sql
npc/queries/host_comments.sql
npc/queries/services.sql
npc/queries/flapping_history.sql
npc/queries/service_status.sql
npc/queries/comments.sql
npc/queries/service_state_history.sql
npc/queries/host_state_history.sql
npc/queries/contacts.sql
npc/queries/comment_history.sql
npc/queries/contactgroup_membership.sql
npc/queries/service_downtime_history.sql
npc/queries/contact_status.sql
npc/queries/state_history.sql
npc/queries/hosts.sql
npc/queries/event_handlers.sql
npc/queries/service_event_handlers.sql
npc/queries/downtime_history.sql
npc/queries/host_flapping_history.sql
npc/queries/notifications.sql
npc/queries/host_status.sql
npc/queries/contact_notification_methods.sql
npc/queries/hostgroup_membership.sql
npc/queries/host_notifications.sql
npc/queries/timed_event_queue.sql
npc/queries/service_notifications.sql
npc/queries/host_downtime_history.sql
npc/queries/servicegroup_membership.sql
npc/queries/host_event_handlers.sql
npc/queries/service_comments.sql
npc/controllers/hostgroups.php
npc/controllers/downtime.php
npc/controllers/logentries.php
npc/controllers/statehistory.php
npc/controllers/layout.php
npc/controllers/servicegroups.php
npc/controllers/controller.php
npc/controllers/comments.php
npc/controllers/settings.php
npc/controllers/layoutDev.php
npc/controllers/services.php
npc/controllers/sync.php
npc/controllers/hosts.php
npc/controllers/nagios.php
npc/controllers/cacti.php
npc/controllers/notifications.php
npc/js/portlets-all-min.js
npc/js/src/Portlet.js
npc/js/src/build.xml
npc/js/src/monitoring/n2c.js
tar: Skipping to next header

gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error exit delayed from previous errors
[root@localhost plugins]#
And there is free disk space to unpack it...

Any idea? (or any other link?)

Thanks
It looks like the archive you downloaded is corrupt. I'd try again, maybe with a different browser.
manafo
Posts: 6
Joined: Sun Apr 20, 2008 1:10 am

Post by manafo »

i made all the configuration but i still cant see the devices in NPC!! i got this message in nagios.log:

Error: Could not load module '/usr/local/nagios/bin/ndomod.o' -> /usr/local/nagios/var/spool/checkresults/nebmodrPvthL: undefined symbol: find_serviceextinfo
mati
Posts: 7
Joined: Tue Jun 10, 2008 5:06 pm

Post by mati »

Hi all, I keep getting the below error everytime I click on the NPC tab in Cacti. I have tripple checked that I meet all the requirements, etc... I'm using Ubuntu Server 8.04LTS, thank for any help.

Fatal error: Uncaught exception 'Doctrine_Manager_Exception' with message 'Empty data source name' in /usr/share/cacti/site/plugins/npc/lib/Doctrine/Manager.php:383 Stack trace: #0 /usr/share/cacti/site/plugins/npc/lib/Doctrine/Manager.php(277): Doctrine_Manager->parseDsn('mysql://cacti:S...') #1 /usr/share/cacti/site/plugins/npc/lib/Doctrine/Manager.php(237): Doctrine_Manager->openConnection('mysql://cacti:S...', NULL) #2 /usr/share/cacti/site/plugins/npc/config.php(14): Doctrine_Manager::connection('mysql://cacti:S...') #3 /usr/share/cacti/site/plugins/npc/npc.php(23): include('/usr/share/cact...') #4 {main} thrown in /usr/share/cacti/site/plugins/npc/lib/Doctrine/Manager.php on line 383
sterpstra
Posts: 45
Joined: Tue May 27, 2008 11:48 pm
Location: So Cal
Contact:

Uncaught Exception

Post by sterpstra »

I'm getting the same error:

Fatal error: Uncaught exception 'Doctrine_Manager_Exception' with message 'Empty data source name' in /usr/share/cacti/site/plugins/npc/lib/Doctrine/Manager.php:383 Stack trace: #0 /usr/share/cacti/site/plugins/npc/lib/Doctrine/Manager.php(277): Doctrine_Manager->parseDsn('mysql://cacti:c...') #1 /usr/share/cacti/site/plugins/npc/lib/Doctrine/Manager.php(237): Doctrine_Manager->openConnection('mysql://cacti:c...', NULL) #2 /usr/share/cacti/site/plugins/npc/config.php(14): Doctrine_Manager::connection('mysql://cacti:c...') #3 /usr/share/cacti/site/plugins/npc/npc.php(23): include('/usr/share/cact...') #4 {main} thrown in /usr/share/cacti/site/plugins/npc/lib/Doctrine/Manager.php on line 383

Any ideas?

UPDATE: OK, so I've tried a few things and here's the deal. When I initially installed NPC, the cacti database populated with all of the npc_ tables, however NDO wasn't working correctly.. I disable the plugin and fixed the NDO issue. I moved all of my Nagios data (it was in the Nagios db) to the Cacti db and tested the new connection with Nagios. Data is being populated and NDO looks good. I re-enable NPC and still got the above error. Did a reinstall of NPC (moved current dir and downloaded fresh copy), followed the instructions and still receive the same error.

I'm definitely NOT a SQL guru but from what I can tell, it appears the php file is trying to add entries to a table it doesn't like. It's quoting an Empty Data Source but I can't see exactly what table it is trying to populate. The error says mysql://cacti.c... Shouldn't it be npc_... Anyway, I'm probably saying something everyone already knows so forgive me...

Any help would be SUPER appreciated... Especially considering I am suppose to present the system soon. And I LOVE this piece of the puzzle.

-st
sterpstra
Posts: 45
Joined: Tue May 27, 2008 11:48 pm
Location: So Cal
Contact:

Post by sterpstra »

[quote="mati"]Hi all, I keep getting the below error everytime I click on the NPC tab in Cacti. I have tripple checked that I meet all the requirements, etc... I'm using Ubuntu Server 8.04LTS, thank for any help.

Hi Mati.. I received a PM from divigater and he helped point me in the right direction. Try this: Edit your /plugins/npc/config.php file and replace

$dsn = "$database_type://$database_username:$database_password@$database_hostname:$database_port/$database_default";

with:

$dsn = "$database_type://'$database_username':'$database_password'@'$database_hostname':$database_port/$database_default";

Let us know if that works.

-st
mati
Posts: 7
Joined: Tue Jun 10, 2008 5:06 pm

Post by mati »

Thank you sir, the gui is coming up in Cacti now. Thank again.
sterpstra
Posts: 45
Joined: Tue May 27, 2008 11:48 pm
Location: So Cal
Contact:

Post by sterpstra »

sonartribe wrote:okay, I've worked around it. I can't find any documentation which explains what the config_type relates to, but I have got my NPC to work by modifying my controllers/hosts.php and controllers/services.php so that both searches in each which is looking for config_type=1 is now looking for config_type=0! I also found this in setup.php which I've also changed to be consistent.

:D

Thanks for your help on this divagater!

Regards

Ian
Hi guys... It appears that I am also part of this crowd. I checked mysql and found my config_type is also 0. I modified the services.php and hosts.php but still am unable to see any data in NPC (including trying to import from N2C). I looked in the setup.php file but all config_type lines say this: config_type ..... NOT NULL default '0'

Any ideas now?
sterpstra
Posts: 45
Joined: Tue May 27, 2008 11:48 pm
Location: So Cal
Contact:

Re: config_type revisited

Post by sterpstra »

divagater wrote:
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
Hey guys... Just a couple quick add-ons to this... I checked my nagio.cfg file and I have retain_state_information set to 1. I checked my database and my npc_hosts and npc_services have an id of 0 still. I have restarted Nagios thinking perhaps I missed doing that when I originally changed the file... I'll try to change the controllers/services.php and hosts.php back to 0 but since that didn't work before, I would hazard to guess it would work this time.

-st
sterpstra
Posts: 45
Joined: Tue May 27, 2008 11:48 pm
Location: So Cal
Contact:

Post by sterpstra »

mati wrote:Thank you sir, the gui is coming up in Cacti now. Thank again.
Hey mati.. Just curious if you are seeing your NPC populated now? Mine is still blank and I'm not so sure my fix was the root of the problem.
mati
Posts: 7
Joined: Tue Jun 10, 2008 5:06 pm

Post by mati »

No sir, I can see the NPC now in Cacti but it's all blank even thought I can see data been populated in the database. Try various thing but still blank.
mati
Posts: 7
Joined: Tue Jun 10, 2008 5:06 pm

Post by mati »

hey Sterpstra can you run the below link and see what you get, thanks.

Code: Select all

http://<cacti_url>/plugins/npc/npc.php?module=services&action=getServices&p_state=any
mati
Posts: 7
Joined: Tue Jun 10, 2008 5:06 pm

Post by mati »

I finally got NPC to show data in Cacti, I kept getting this error,

<b>Fatal error</b>: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2005] Unknown MySQL server host '''' (1)' in /usr/share/cacti/site/plugins/npc/lib/Doctrine/Connection.php:381
Stack trace:
#0 /usr/share/cacti/site/plugins/npc/lib/Doctrine/Connection.php(381): PDO->__construct('mysql:host='';d...', ''cacti'', '''', Array)
#1 /usr/share/cacti/site/plugins/npc/lib/Doctrine/Connection.php(904): Doctrine_Connection->connect()
#2 /usr/share/cacti/site/plugins/npc/lib/Doctrine/Connection.php(705): Doctrine_Connection->execute('SELECT COUNT(DI...', Array)
#3 /usr/share/cacti/site/plugins/npc/lib/Doctrine/Query.php(1789): Doctrine_Connection->fetchAll('SELECT COUNT(DI...', Array)
#4 /usr/share/cacti/site/plugins/npc/lib/Doctrine/Pager.php(109): Doctrine_Query->count(Array)
#5 /usr/share/cacti/site/plugins/npc/lib/Doctrine/Pager.php(499): Doctrine_Pager->_initialize(Array)
#6 /usr/share/cacti/site/plugins/npc/controllers/services.php(196): Doctrine_Pager->execute(Array, 3)
#7 /usr/share/cacti/site/plugins/npc/c in <b>/usr/share/cacti/site/plugins/npc/lib/Doctrine/Connection.php</b> on line <b>381</b><br />

everytime I ran this link http://<cacti_url>/plugins/npc/npc.php?module=services&action=getServices&p_state=any to check if the NPC plugin could read the data from the SQL Database, so I went into /usr/share/cacti/site/plugins/npc/lib/Doctrine/Connection.php and commented out line 381 and 382 and added

Code: Select all

$this->dbh = new PDO('mysql:host=localhost;dbname=test','root','xxxxxxxxxx');
instead and now everything seems to be working. Hopefully this will help anyone else who is stuck and maybe someone can come up with a better fix.
sterpstra
Posts: 45
Joined: Tue May 27, 2008 11:48 pm
Location: So Cal
Contact:

Post by sterpstra »

mati wrote:I finally got NPC to show data in Cacti, I kept getting this error,

everytime I ran this link http://<cacti_url>/plugins/npc/npc.php?module=services&action=getServices&p_state=any to check if the NPC plugin could read the data from the SQL Database, so I went into /usr/share/cacti/site/plugins/npc/lib/Doctrine/Connection.php and commented out line 381 and 382 and added

Code: Select all

$this->dbh = new PDO('mysql:host=localhost;dbname=test','root','xxxxxxxxxx');
instead and now everything seems to be working. Hopefully this will help anyone else who is stuck and maybe someone can come up with a better fix.
Hi mati.. Are you getting ALL of your data? I made some quick hacks to see if I could find the root of the problem but only was able to populate the main screen.. Nothing else was visible (hosts, services, etc...)

I was waiting on divigater to see if he could come up with a solution.

-st
mati
Posts: 7
Joined: Tue Jun 10, 2008 5:06 pm

Post by mati »

Yes, I'm. After making the changes you posted and the PDO change it's all working now.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest