Nagios Plugin for Cacti (NPC) 2.0.4

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

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

Re: Can't see NPC

Post by divagater »

jointheclub76 wrote:I have installed cacti, nagios, and now NPC. when I go to the tab I get...
As liamr suggested make sure you have all the required packages installed. Check the requirements section of the quick start guide

If you are unsure what you have and are on an RPM based system show me the out put from:

rpm -qa | grep php

As an FYI there is a new alpha release available... check the 1st post in this thread.

~Billy
jointheclub76
Posts: 3
Joined: Tue Apr 01, 2008 3:29 pm

It was the json!

Post by jointheclub76 »

Yes, thanks for the follow-up. Liamr's suggestions proved correct. I did have the pdo in there, but forgot to add in the json extension. thanks.

I am really excited about this because my company is moving towards nagios, and I run the NOC. This user interface is much better than the out-of-the-box nagios interface. I will be following this project in detail.
wasmum
Posts: 7
Joined: Thu Jan 12, 2006 5:55 pm

PDO not Found

Post by wasmum »

divagater wrote:Hi aleto. When you click the NPC tab all you see for instance is a big white background without any part of the interface being drawn? If that is the case either php is dying with a fatal error or the javascript is not loading.

Do me a favor and tail your apache error logs then click the tab again. Look for a log entry with "PHP Fatal error" in it.

If you are on an rpm based system get me the output of
rpm -qa | grep php

NPC requires PDO which I thought was included in PHP 5.2 however I just noticed that the php-pdo module may need to be installed seperatley.

Also, let me know what web browser you are using. I have tested in firefox 2.x and IE 7

~Billy
I'm getting this:
Class 'PDO' not found in /srv/www/htdocs/cacti/plugins/npc/lib/Doctrine/Connection/Mysql.php on line 49
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

Looks like you do not have the PDO module for PHP installed. If you are on an RPM based system do:

yum install php-pdo

Otherwise you will need to follow the appropriate steps for your linux distribution to get the PHP PDO module installed.

~Billy
wmunguiam
Posts: 16
Joined: Fri Jan 19, 2007 7:05 pm

Something strange

Post by wmunguiam »

I have just installed NPC:
npc-2.0.0a.136.tar.gz
Issue:

Whe I go to:
User Management-> user -> Realm Permissions

"View Monitoring" Option is not there any more. Of course "View NPC " is visible. Now, when I disable "View NPC " option, also disable "View Monitoring" automatically. So the new "View NPC" box, controll both plugins(Monitoring and NPC)

Maybe something is wrong with my installation. Please can anybody tell me if this issue happend to you too?


My server is:
Cacti Version - 0.8.7b
Plugin Architecture - 2.0
Poller Type - Cactid v
Server Info - Linux 2.6.22-14-server
Web Server - Apache/2.2.4 (Ubuntu) PHP/5.2.3-1ubuntu6.3 mod_ssl/2.2.4 OpenSSL/0.9.8e
PHP - 5.2.3-1ubuntu6.3
PHP Extensions - zip, xmlwriter, libxml, dom, xmlreader, xml, wddx, tokenizer, sysvshm, sysvsem, sysvmsg, session, pcre, SimpleXML, sockets, soap, SPL, shmop, standard, Reflection, posix, mime_magic, mbstring, json, iconv, hash, gettext, ftp, filter, exif, dba, date, ctype, calendar, bz2, bcmath, zlib, openssl, apache2handler, imap, mcrypt, curl, gd, imagick, mhash, ming, mysql, mysqli, PDO, pdo_mysql, pdo_sqlite, ps, pspell, recode, snmp, SQLite, tidy, xmlrpc, xsl
MySQL - 5.0.45-Debian_1ubuntu3.3-log
RRDTool - 1.2.19
SNMP - 5.3.1
Plugins
  • Host Info (hostinfo - v0.2)
    Device Monitoring (monitor - v0.8.2)
    NTop Viewer (ntop - v0.1)
    Nagios plugin for Cacti (npc - v2.0.0a)
    Global Plugin Settings (settings - v0.3)
    SSH Viewer (ssh - v1.0)
    Syslog Monitoring (syslog - v0.5.2)
    Thresholds (thold - v0.3.9)
    Network Tools (tools - v0.2)
    Update Checker (update - v0.4)
    PHP Network Weathermap (weathermap - v0.95b)
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

That would be a realm conflict I guess. I am not sure what the monitor realm is because I dont have it installed. Look in setup.php under npc/ and look for the following lines:

$user_auth_realms[32]='View NPC';
$user_auth_realm_filenames['npc.php'] = 32;
$user_auth_realm_filenames['test.php'] = 32;
$user_auth_realm_filenames['npc_layout.php'] = 32;
$user_auth_realm_filenames['npc_service_detail.php'] = 32;


Change the number 32 on each line to some other arbitrary number. If that fixes issue than it was a realm conflict. Let me know if that resolves the issue. I will also grab the monitor plugin and check out the realm it uses.

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

Post by divagater »

The issue was a realm conflict. I found a list of KNown relams and monitor and npc are sharing a realm. Looks like 90+ is free so I will change NPC to 90 and see if I can get the list updated at cactiusers.

So find the following lines in npc/setup.php:
$user_auth_realms[32]='View NPC';
$user_auth_realm_filenames['npc.php'] = 32;
$user_auth_realm_filenames['test.php'] = 32;
$user_auth_realm_filenames['npc_layout.php'] = 32;
$user_auth_realm_filenames['npc_service_detail.php'] = 32;
And change to:
$user_auth_realms[90]='View NPC';
$user_auth_realm_filenames['npc.php'] = 90;
$user_auth_realm_filenames['test.php'] = 90;
$user_auth_realm_filenames['npc_layout.php'] = 90;
$user_auth_realm_filenames['npc_service_detail.php'] = 90;
~Billy
sonartribe
Posts: 25
Joined: Mon May 08, 2006 10:31 am

different error

Post by sonartribe »

When I try to go into the NPC tab I just get a blank screen, and I get this in my Apache error log

PHP Parse error: syntax error, unexpected T_VARIABLE, expecting T_STRING in /store/cacti/plugins/npc/controllers/controller.php on line 363, referer: http:

Any ideas?

Thanks
wmunguiam
Posts: 16
Joined: Fri Jan 19, 2007 7:05 pm

Post by wmunguiam »

divagater wrote:...

So find the following lines in npc/setup.php:
$user_auth_realms[32]='View NPC'; ...

And change to:
$user_auth_realms[90]='View NPC';
$user_auth_realm_filenames['npc.php'] = 90;
$user_auth_realm_filenames['test.php'] = 90;
$user_auth_realm_filenames['npc_layout.php'] = 90;
$user_auth_realm_filenames['npc_service_detail.php'] = 90;
~Billy
@Divagater
Thanks you, I made changes over setup.php and now NPC has its own realm!

Now I have to continue with NPC..
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Re: different error

Post by divagater »

sonartribe wrote:When I try to go into the NPC tab I just get a blank screen, and I get this in my Apache error log

PHP Parse error: syntax error, unexpected T_VARIABLE, expecting T_STRING in /store/cacti/plugins/npc/controllers/controller.php on line 363, referer: http:
Hi sonartribe. As I cannot immediately see a reason for that line to fail for you could you send me the output from:

rpm -qa | grep php

Its possible I have an error on that or near that line but I don't see it and I suspect its related to json/php version.

~Billy
munozm
Posts: 18
Joined: Sun Jul 08, 2007 10:14 pm

Post by munozm »

Great work on the plugin. I use Nagios 2.x (I know its not supported so I understand if this won't work) and it seems to have imported everything ok. I'm curious on the Data Input Method, what is the value that is imported? I click N2C and it says its imported and I see the item listed under the devices link in Cacti. When I go to create a data template, you said in an earlier post that you need to pull the data input method that was posted from your plugin. What should I be looking for. Thanks again.

On a side note, I use Monarch for configuration of Nagios. There doesn't seem to be a place for the event_broker_options or broker_module options. I added these manually for this plugin but I'm just wondering if anyone has modified their monarch config to be able to edit these fields through monarch. Thanks!
sonartribe
Posts: 25
Joined: Mon May 08, 2006 10:31 am

Post by sonartribe »

divagater,

Here you go

php5-dom-5.2.0-10
php5-tokenizer-5.2.0-10
apache2-mod_php5-5.2.0-10
php5-ldap-5.2.0-10
php5-dbase-5.2.0-10
php5-ctype-5.2.0-10
php5-iconv-5.2.0-10
php5-pdo-5.2.0-10
php5-mysql-5.2.0-10
php5-xmlrpc-5.2.0-10
php5-sockets-5.2.0-10
php5-posix-5.2.0-10
php5-pear-5.2.0-10
php5-5.2.0-10
php5-json-5.2.0-10
php5-sqlite-5.2.0-10
php5-mbstring-5.2.0-10
php5-snmp-5.2.0-10
php5-gd-5.2.0-10
php5-zlib-5.2.0-10

I managed to get pass the error by changing the $class->$method to class->method. Which obviously removed some functionality, but I can't see why this would be failing.

Right now I get it displaying the npc screen, but no data. I can see the data being populated into the database, so my ndo2db is working, but the only funtion that works is the event log. (even this only works properly on firefox, on IE6 it doesn't show the text of the event log....but that's another issue :roll: ).

All in all it's looking good. I've been relying on the old npc plugin for a while, but was always frustrated by it's lack of functionality.

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

Post by divagater »

I managed to get pass the error by changing the $class->$method to class->method. Which obviously removed some functionality, but I can't see why this would be failing.

Right now I get it displaying the npc screen, but no data. I can see the data being populated into the database, so my ndo2db is working, but the only funtion that works is the event log. (even this only works properly on firefox, on IE6 it doesn't show the text of the event log....but that's another issue ).
You didn't really remove any functionality by removing the class and method variables. All they were for was to identify the class and method that was producing the log error and then it returns that to the client for debugging.

If you are not seeing any data then I suspect the json module is really at issue. It is what was causing the previous issue you had and the lack of data. I have tested on php 5.1 with a compiled json module and on 5.2.4 with json included. It was first included in 5.2.0 which is right where you are. From the php manual:
As of PHP 5.2.0, the JSON extension is bundled and compiled into PHP by default.
So, with that I see that you have php5-json-5.2.0-10 in your list of php rpm's. Where did that come from? json is supposed to be part of the 5.2.0 base so that module "should" not be needed and may be what is causing trouble.

Assuming you are on a non-production server try getting rid of that module (rpm -e php5-json-5.2.0-10) then restart apache. If it really is supposed to be there make sure you can get it back via yum or from your distribution CD/DVD before removing it. Once removed try accessing NPC. If your 5.2.0-10 php really doesn't have json included you should see a fatal error in your apache logs that say unknown method json_encode etc.
sonartribe
Posts: 25
Joined: Mon May 08, 2006 10:31 am

Post by sonartribe »

Thanks for the suggestion. I tried removing the json module, but when I did, I got the following error in the NPC tab

// Add some properties to the params array npc.params.npc_portlet_refresh = 60; npc.params.npc_date_format = "d/m/Y"; npc.params.npc_time_format = "H:i:s"; npc.params.npc_nagios_url = "http://xx.xx.xx.xx/nagios"; npc.params.userName = "username"; var ExtState = Ext.decode('

and a fatal error in the apache error_log

[Fri Apr 04 13:23:14 2008] [error] [client xx.xx.xx.xx] PHP Fatal error: Call to undefined function json_encode() in /store/cacti/plugins/npc/controllers/layout.php on line 58, referer: http://192.168.112.2/cacti/plugins/npc/npc.php

So looks like in this installation I need the json module.

Right now I've got it to the state where in the Dashboard screen I have data showing in the Hostgroup:host status and Hostgroup: Service Status, but nothing showing up in Hosts or Services from the Navigation Menu.

I suspect that it could be due to the version of PHP. I'll see if I can find a later version I can install. BTW this is on Suse 10.2.

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

Post by sonartribe »

I've updated php to 5.2.5 and it's fixed the original problem in controller.php, but still having problems with the hosts and service grids not showing anything, even though the hostgroups grids are showing data.

I can confirm in mysql that the npc_hosts table is populated with 159 rows.

Any ideas?

Regards
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest