Nagios Plugin for Cacti (NPC) 2.0.4

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
offlinetn
Posts: 3
Joined: Tue Oct 31, 2006 4:24 pm

Load Average Help

Post by offlinetn »

Hi,

I have spent the last two days installing and setting this plugin up. I have to say it was a chore since I am a newb at Cacti. I now have everything working the way I want EXCEPT I can't for whatever reason get my "Load Averages" to graph the 5 and 15 minute averages. Can someone please help point me in the right direction. I can run the php script that shows the current load "php <path_cacti>/plugins/npc/perfdata.php --type=service --id=21 2> /dev/null". I also have the Data Template setup with load1, load5 and load15 as internal data source names. When I look at the graph it shows "nan" next to the 5 and 15 minute load averages.

Thanks for any help,

Chris Edwards
aaronnicoli
Posts: 33
Joined: Tue May 05, 2009 7:28 pm

Re: Nagios Plugin for Cacti (NPC) 2.0.4

Post by aaronnicoli »

bedo wrote:hello all,
i have a question.
my npc database (name:nagios) can get data via ndo2db but the npc view is nothing!
how can i do next?

npc-2.0.4
ndoutils-1.4b9
php-5.2.6
mysql-5.0.22
httpd-2.2.9
nagios-3.2.0
nagios-plugins-1.4.14

tks!!
Bedo,

Run my fixes from earlier...

ALTER TABLE `npc_hostchecks` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
ALTER TABLE `npc_hoststatus` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
ALTER TABLE `npc_servicechecks` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
ALTER TABLE `npc_servicestatus` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
ALTER TABLE `npc_statehistory` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
ALTER TABLE `npc_eventhandlers` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
ALTER TABLE `npc_systemcommands` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
ALTER TABLE `npc_notifications` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
yoyo
Posts: 2
Joined: Mon Jan 25, 2010 4:28 am

Post by yoyo »

Hello!

I look nagios in Cacti but the npc database are empty ! On NPC it's write "no data to display".

in Technical Support in System Utilities i look this :
The Following Tables were Skipped Due to being INNODB
npc_acknowledgements
npc_commands
npc_commenthistory
npc_comments
npc_configfiles
npc_configfilevariables
npc_conninfo
npc_contact_addresses
npc_contact_notificationcommands
npc_contactgroup_members
npc_contactgroups
npc_contactnotificationmethods
npc_contactnotifications
npc_contacts
npc_contactstatus
npc_customvariables
npc_customvariablestatus
npc_dbversion
npc_downtimehistory
npc_eventhandlers
npc_externalcommands
npc_flappinghistory
npc_host_contactgroups
npc_host_contacts
npc_host_graphs
npc_host_parenthosts
npc_hostchecks
npc_hostdependencies
npc_hostescalation_contactgroups
npc_hostescalation_contacts
npc_hostescalations
npc_hostgroup_members
npc_hostgroups
npc_hosts
npc_hoststatus
npc_instances
npc_logentries
npc_notifications
npc_objects
npc_processevents
npc_programstatus
npc_runtimevariables
npc_scheduleddowntime
npc_service_contactgroups
npc_service_contacts
npc_service_graphs
npc_servicechecks
npc_servicedependencies
npc_serviceescalation_contactgroups
npc_serviceescalation_contacts
npc_serviceescalations
npc_servicegroup_members
npc_servicegroups
npc_services
npc_servicestatus
npc_settings
npc_statehistory
npc_systemcommands
npc_timedeventqueue
npc_timedevents
npc_timeperiod_timeranges
npc_timeperiods

And on my apache error log i have this :
PHP Fatal error: Undefined class constant 'ATTR_EMULATE_PREPARES' in /srv/www/htdocs/cacti/plugins/npc/lib/Doctrine/Connection/Mysql.php on line 102, referer: http://IP_nagios_server/cacti/plugins/npc/npc.php?module=layout&action=drawLayout

My current info :
I work in Suse 10
Cacti Version - 0.8.7e
Plugin architecture - 2.6
Web Server - Apache/2.2.3 (Linux/SUSE)
PHP Version 5.1.2
PHP Extensions - HTTP, Date, Json, libxml, mysql, PCRE, PDO, PDO_mysql, reflection, session, simple xml, SNMP, sockets, SPL, standard, xml, zlib,
MySQL - 5.0.26
RRDTool - 1.2.12
SNMP - 5.3.0
Plugins
Nagios plugin for Cacti - 2.0.4
i do the install with : http://wiki.nagios-fr.org/integration/cacti/npc

thanks for your help
yoyo
Posts: 2
Joined: Mon Jan 25, 2010 4:28 am

Post by yoyo »

it's good! I have upgrade php because the constant 'ATTR_EMULATE_PREPARES' is know from php5.1.3.
mimik03
Posts: 1
Joined: Wed Feb 03, 2010 2:45 pm

Post by mimik03 »

bigrat wrote:Hi divagater
Thanks for a great cacti plugin.
However, I just see "No hosts" and "No services" when I click hosts and services tab. In mysql database, I count 155 hosts and 17 services
mysql> npc_hosts;
+----------+
| count(*) |
+----------+
| 155 |
+----------+
1 row in set (0.00 sec)

mysql> npc_services;
+----------+
| count(*) |
+----------+
| 17 |
+----------+
1 row in set (0.00 sec)

I also find this errors in /etc/httpd/logs/ssl_error_log

[Fri Mar 27 10:17:54 2009] [error] [client xxx.xxx.xx.xxx] PHP Fatal error: Uncaught exception 'Doctrine_Connection_Exception' with message 'PDO Connection Error: SQLSTATE[28000] [1045] Access denied for user 'cactiuser'@'localhost' (using password: YES)' in /usr/local/cacti-0.8.7d/plugins/npc/lib/Doctrine/Connection.php:471\nStack trace:\n#0 /usr/local/cacti-0.8.7d/plugins/npc/lib/Doctrine/Connection/Mysql.php(101): Doctrine_Connection->connect()\n#1 /usr/local/cacti-0.8.7d/plugins/npc/lib/Doctrine/Connection.php(1009): Doctrine_Connection_Mysql->connect()\n#2 /usr/local/cacti-0.8.7d/plugins/npc/lib/Doctrine/Query/Abstract.php(986): Doctrine_Connection->execute('SELECT n.servic...', Array)\n#3 /usr/local/cacti-0.8.7d/plugins/npc/lib/Doctrine/Query/Abstract.php(1030): Doctrine_Query_Abstract->_execute(Array)\n#4 /usr/local/cacti-0.8.7d/plugins/npc/controllers/servicegroups.php(327): Doctrine_Query_Abstract->execute(Array, 3)\n#5 /usr/local/cacti-0.8.7d/plugins/npc/controllers/servicegroups.php(344): NpcServicegroupsController->getServicegroups()\n#6 /usr/local/cacti-0.8.7d/plugins/npc/contro in /usr/local/cacti-0.8.7d/plugins/npc/lib/Doctrine/Connection.php on line 471, referer: https://xxx.xxx.x.x/plugins/npc/npc.php ... drawLayout

My Cacti-Nagios
Fedora Core 10 - 2.6.27.12-170.2.5.fc10.i686.PAE
Cacti-0.8.7d
PIA 2.4
Spine-0.8.7c
MySQL 5.0.67
Nagios-3.1.0
NPC-2.0.0b.182
ndoutils-1.4b7

Please help me to fix this issue

Regards,
Bigrat :)
guilou0875
Posts: 3
Joined: Thu Jun 25, 2009 7:50 pm

npc white/empty

Post by guilou0875 »

PLease help I have nagio is running, installed npc plugging, the database is there but when I click on the npc tab it's completely White / empty

am I missing anything Please help I spent 3 days working on this thing and I'm about to give up.

Run Centos (elastix...)

ndoutils
nagios 3.2

#PHP 5.3
#mysql5.0.77
# NDOUtils 1.4
# Nagios 3.x
# Cacti 0.8.7e
# Cacti Plugin Architecture v2.6
# npc 2.0.4
did follow the instructions of http://trac2.assembla.com/npc/wiki/QuickStartGuide

this my cacti table

+-------------------------------------+
| Tables_in_cacti |
+-------------------------------------+
| cdef |
| cdef_items |
| colors |
| data_input |
| data_input_data |
| data_input_fields |
| data_local |
| data_template |
| data_template_data |
| data_template_data_rra |
| data_template_rrd |
| graph_local |
| graph_template_input |
| graph_template_input_defs |
| graph_templates |
| graph_templates_gprint |
| graph_templates_graph |
| graph_templates_item |
| graph_tree |
| graph_tree_items |
| host |
| host_graph |
| host_snmp_cache |
| host_snmp_query |
| host_template |
| host_template_graph |
| host_template_snmp_query |
| nagios_dbversion |
| npc_acknowledgements |
| npc_commands |
| npc_commenthistory |
| npc_comments |
| npc_configfiles |
| npc_configfilevariables |
| npc_conninfo |
| npc_contact_addresses |
| npc_contact_notificationcommands |
| npc_contactgroup_members |
| npc_contactgroups |
| npc_contactnotificationmethods |
| npc_contactnotifications |
| npc_contacts |
| npc_contactstatus |
| npc_customvariables |
| npc_customvariablestatus |
| npc_dbversion |
| npc_downtimehistory |
| npc_eventhandlers |
| npc_externalcommands |
| npc_flappinghistory |
| npc_host_contactgroups |
| npc_host_contacts |
| npc_host_graphs |
| npc_host_parenthosts |
| npc_hostchecks |
| npc_hostdependencies |
| npc_hostescalation_contactgroups |
| npc_hostescalation_contacts |
| npc_hostescalations |
| npc_hostgroup_members |
| npc_hostgroups |
| npc_hosts |
| npc_hoststatus |
| npc_instances |
| npc_logentries |
| npc_notifications |
| npc_objects |
| npc_processevents |
| npc_programstatus |
| npc_runtimevariables |
| npc_scheduleddowntime |
| npc_service_contactgroups |
| npc_service_contacts |
| npc_service_graphs |
| npc_servicechecks |
| npc_servicedependencies |
| npc_serviceescalation_contactgroups |
| npc_serviceescalation_contacts |
| npc_serviceescalations |
| npc_servicegroup_members |
| npc_servicegroups |
| npc_services |
| npc_servicestatus |
| npc_settings |
| npc_statehistory |
| npc_systemcommands |
| npc_timedeventqueue |
| npc_timedevents |
| npc_timeperiod_timeranges |
| npc_timeperiods |
| plugin_config |
| plugin_db_changes |
| plugin_hooks |
| plugin_realms |
| poller |
| poller_command |
| poller_item |
| poller_output |
| poller_reindex |
| poller_time |
| rra |
| rra_cf |
| settings |
| settings_graphs |
| settings_tree |
| snmp_query |
| snmp_query_graph |
| snmp_query_graph_rrd |
| snmp_query_graph_rrd_sv |
| snmp_query_graph_sv |
| user_auth |
| user_auth_perms |
| user_auth_realm |
| user_log |
| version

aurorius
Posts: 1
Joined: Sun Feb 14, 2010 11:18 pm

Post by aurorius »

I'm getting these errors from my Apache error log. From what I gather, everything seems to be working correctly, except that I got blank column for Imported, Mapped, and Message after trying to import from Nagios using N2C. Can anyone give me and idea on how to fix this ?

Code: Select all

[Mon Feb 15 12:20:01 2010] [error] [client 192.168.1.11] PHP Notice:  Undefined index:  action in /var/www/htdocs/cacti/plugins/npc/top_graph_header.php on line 95, referer: http://192.168.1.10/cacti/index.php
[Mon Feb 15 12:20:01 2010] [error] [client 192.168.1.11] PHP Notice:  Undefined index:  action in /var/www/htdocs/cacti/plugins/npc/top_graph_header.php on line 95, referer: http://192.168.1.10/cacti/index.php
[Mon Feb 15 12:20:01 2010] [error] [client 192.168.1.11] PHP Notice:  Undefined index:  action in /var/www/htdocs/cacti/plugins/npc/top_graph_header.php on line 95, referer: http://192.168.1.10/cacti/index.php
BTW, ndo2db.debug and nagios.log are not showing any errors.
mouses
Posts: 6
Joined: Tue Feb 16, 2010 9:54 pm

Post by mouses »

Damn, I'm going nuts. After eventually having both ndo2db and cacti connected to mysql database (and after getting to know that the db user settings for cacti are stored in /etc/cacti/debian.php ... kept me busy for hours 'til I figured this one out :)) Cacti is running, the Plugin Architecture is running, and NPC is running.
But: no data is displayed; it's like not having ndo2db populating. Whats going on here?

Let's see:
* Nagios is working - check
* ndomod is loaded - check
* ndo2db is working - check
* cacti is running - check
* the npc plugin is running - check
* the npc_ - tables are getting filled with data - check.
Hell, even the queries located in the plugins/npc/queries - directory from Cacti are working like a charm and are producing the right output. So the data is there. and available. So where is the error?

Long story short: why the hell isn't the data showed in the NPC-GUI? everywhere "No $OBJECT_HERE", and N2C is finding nothing, too.

Any Ideas? Anyone? Would be great. :)

DAnke im Voraus (sorry; I didn' find the right equivalent for this in English ;))

Mouses

using:
Ubuntu Server 9.04
PHP 5.2.6
Cacti 0.8.7e
PluginArchitecture v2.6
NPC 2.0.4
Nagios 3.0.6
NDOUtils 1.4b7-11

JSON and PDO are both supported and working accodring to phpinfo

checked with (running on Ubuntu Karmic):
Opera 10.10
firefox 3.5
Ritual
Posts: 1
Joined: Wed Feb 17, 2010 5:59 pm

Post by Ritual »

I'm ready to smash my head on a rock. I think the real problem is with Ubuntu honestly I've worked on this for 3 days now and I'm not a newb to Cacti or Nagios but I think Ubu is the problem honestly.

No data displays on the NPC tab all I get is
Attachments
Screenshot.png
Screenshot.png (277.88 KiB) Viewed 28486 times
mouses
Posts: 6
Joined: Tue Feb 16, 2010 9:54 pm

Post by mouses »

Thats exactly what I'm doing, dude :) But eventually I got it working, using another post from here, not really sure which it was.

Howsoever, like this it worked for me:

* go to the directory /usr/share/cacti/site/plugins/npc/lib/Doctrine, and in here open the file Connection.php
* search for the line public function connect()
* in this function, you'll see a line like this one:

Code: Select all

$this->dbh = new PDO($this->options['dsn'], $this->options['username'],
                                     (!$this->options['password'] ? '':$this->options['password']), $this->options['other']);
here these are the lines 466 and 467
* purge those lines and add a new one using the following Values,taken from /etc/cacti/debian.php
  • dbtype = mysql
    database_server = localhost
    database_default = cacti
    database_user = cactiuser
    dadabase_password = cactipassword
* the accordant line would be:

Code: Select all

$this->dbh = new POD('mysql:host=localhost;dbname=cacti','cactiuser','cactipassword');
hint: change this line according to your settings ;)
* save and exit

After this ther will be plenty of data in your NPC-GUI :)

And for those ones whose importing won't work: thats a Problem related to a broken Path in the sync controller. I'm not really shure when this changed, but at least with Cacti-Version 0.8.7e the cli-directory isn't located anymore in the base_directory (which normaly is /usr/share/cacti/site), but has been relocated to the base cacti directory, which reads /usr/share/cacti.

If having a version which such directory structure just navigate to /usr/share/cacti/site/plugins/npc/controllers, open the file sync.php, and change the line

Code: Select all

$path = $config["base_path"] . "/cli/add_device.php";
into

Code: Select all

$path = $config["base_path"] . "/../cli/add_device.php";
After that, the importing should work.

The next thing I'm handling with is using the Nagios - perormance data for making Graphs, and getting the graphs to work. In the Moment there are only links shown where graphical statistics should be.

But thats another story

Good luck!
mouses
Posts: 6
Joined: Tue Feb 16, 2010 9:54 pm

Post by mouses »

the --ds - Option of perfdata.php seemed not to work. So I changed

Code: Select all

foreach ($perfParts as $perf) {
    if (preg_match("/=/", $perf)) {
        preg_match("/(\S+)=([-+]?[0-9]*\.?[0-9]+)/", $perf, $matches);
        if (preg_match("/^iso./", $matches[1])) {
                $matches[1] = 'output';
        }
        $output .= $matches[1] . ":" . $matches[2] . " ";
    }
}
into

Code: Select all

foreach ($perfParts as $perf) {
    if (preg_match("/=/", $perf)) {
        preg_match("/(\S+)=([-+]?[0-9]*\.?[0-9]+)/", $perf, $matches);
        if (preg_match("/^iso./", $matches[1])) {
                $matches[1] = 'output';
        }
        if ($ds and !($matches[1] == $ds)) continue;
        $output .= $matches[1] . ":" . $matches[2] . " ";
    }
}
and now it seemes to be fine.

Did I miss something or may I keep it like this?
thedavidfactor
Posts: 2
Joined: Fri Feb 12, 2010 5:14 pm

NPC Scaling

Post by thedavidfactor »

I've got NPC working, but ever since I got the nagios data loading in to the mysql tables, cacti and npc are running extremely slowly.

I've increased the php.ini timeout from 30 seconds to 60 and I still see timeouts on almost every refresh.

Is there anything else I can try? I've only got 103 host with a total of 757 service checks. I wouldn't expect that to be any where near a large number.

Thanks
User avatar
xtremebassist
Posts: 7
Joined: Sat Feb 17, 2007 2:42 pm
Contact:

Small NPC GUI bugs

Post by xtremebassist »

Great plugin and I have used it for some time now. I just finished installing a new setup and came across of couple of issues:
  • The missing scrollbars in Firefox described earlier. Possibly a CSS fix

    I was able to map system graphs and the graph symbol shows up only on the first service. I can click the other services and view map to see the graphs for the other services

    After figuring out the path for the host icons ($WEBROOT/plugins/npc) NPC will only display the first host icon on the host swidget. But on the services widget, NPC displays all the host icons. Haven't attempted the services icons.
I did see this in the Apache logs that might explain why only one icon is being displayed:

Code: Select all

PHP Warning:  Invalid argument supplied for foreach() in /var/www/cacti/plugins/npc/controllers/sync.php on line 156, referer: http://cacti.mystuff.com/plugins/npc/npc.php?module=layout&action=drawLayout
Just a guess.
rkl
Posts: 1
Joined: Fri Mar 05, 2010 10:53 am

Can't get N2C to display hostgroups / NPC tab is slow

Post by rkl »

After struggling through the install of NPC 2.0.4 (yes, had to do the alter statements to add the missing long_output field to various tables) and finally seeing the hosts/statuses in the NPC tab, I then went to try to use N2C to import the Nagios hostgroups into NPC so I could plot some graphs.

However, when I click on N2C option in the left-hand panel of the NPC tab page, I get no hostgroups listed for import. Yes, I have hosts in the appropriate npc_ tables and I've put debugging on the NDODB stuff, all to no avail. I did restart nagios and ndodb once and the hostgroups magically appeared - I selected them all and tried to import them, but nothing happened either (there were no templates available to select - do you have to create templates first?). Ever since then, the N2C option has failed to list any hostgroups again.

BTW, am I the only one suffering from JSON issues with the NPC tab page? It seems to do multiple simulaneous connections to PHP code that queries a MySQL DB, increasing the load on the server substantially and taking 30+ seconds in the process. With Firefox 3.6, it seems to take so long that it "jams" the browser up on the entire Cacti+NPC site I set up and I have to restart the browser to get things working again (and even after that, some of the httpd's get stuck with 100% CPU!).

Also, has the author disappeared from the thread - there's been no 2.0.5 to fix the several issues present in 2.0.4 and no postings from him since July 2009. Is NPC still being developed?
Markoetie
Posts: 11
Joined: Wed Nov 05, 2008 8:35 am

Post by Markoetie »

Screens:
http://yfrog.com/0dnpc02px

Deleted my post because it was just the browser causing what you can see in the screens.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests