Nagios Plugin for Cacti (NPC) 2.0.4

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
padawan
Posts: 25
Joined: Fri Nov 30, 2007 4:54 am

Post by padawan »

well my service grid still empty =/

I'm using npc 2.0.0.a.136
Attachments
hostnpc.JPG
hostnpc.JPG (58.65 KiB) Viewed 9000 times
servicenpc.JPG
servicenpc.JPG (58.29 KiB) Viewed 9000 times
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

I'm using npc 2.0.0.a.136
Man, thats like stone ages version of code. Grab the latest build as the issue you are experiencing has been resolved. I believe it has to do with the config_type conditional in a bunch of the queries. config_type has been removed. The latest build requires PA architecture 2.x. PA 1.x will not work. Read the quick start guide or the README for instructions on installing a PA 2.x plugin.

~Billy
padawan
Posts: 25
Joined: Fri Nov 30, 2007 4:54 am

Post by padawan »

ok i'll try tomorrow and i'll tell you if it works fine :)
pflaherty
Posts: 5
Joined: Mon Mar 17, 2008 3:06 pm

Dupe Host/Service Entries

Post by pflaherty »

I getting duplicate hosts in my npc_ tables which is shows double services and hosts on my dashboard. The hosts and services pages do not show the dupes. I tried wiping my npc tables but the dupes all came back. Is this an npc issue or an ndo issue? I checked the original ndo schema which does not have uiniq constraints and seemed to match the npc_ schema nicely.

Ideas?

Code: Select all

mysql> select host_id,instance_id,display_name from npc_hosts;
+---------+-------------+--------------+
| host_id | instance_id | display_name |
+---------+-------------+--------------+
|      13 |           3 | host1     | 
|      14 |           3 | localhost    | 
|      15 |           3 | host1     | 
|      16 |           3 | localhost    | 
+---------+-------------+--------------+

mysql> select service_id,host_object_id,display_name  from npc_services order by display_name;
+------------+----------------+-----------------+
| service_id | host_object_id | display_name    |
+------------+----------------+-----------------+
|         84 |            132 | Current Load    | 
|         93 |            132 | Current Load    | 
|         85 |            132 | Current Users   | 
|         94 |            132 | Current Users   | 
|         86 |            132 | HTTP            | 
|         95 |            132 | HTTP            | 
|         83 |            142 | PING            | 
|         96 |            132 | PING            | 
|         92 |            142 | PING            | 
|         87 |            132 | PING            | 
|         88 |            132 | Root Partition  | 
|         97 |            132 | Root Partition  | 
|         89 |            132 | SSH             | 
|         98 |            132 | SSH             | 
|         90 |            132 | Swap Usage      | 
|         99 |            132 | Swap Usage      | 
|         91 |            132 | Total Processes | 
|        100 |            132 | Total Processes | 
+------------+----------------+-----------------+
18 rows in set (0.12 sec)

CentOS 5
ndo 1.4.b7
nagios 3.0.1
php-mysql-5.1.6-15.el5
mysql-server-5.0.22-2.2.el5_1.1
(rrdtool/php-rrdtool from dag)
padawan
Posts: 25
Joined: Fri Nov 30, 2007 4:54 am

Post by padawan »

hi it is me again...

I made a new install of cacti with the lastest version 0.8.7b and PA 2.0
and now I don't have any plugins showed.

i mean when I go to user management to give realm to use npc there is no "npc" in the list...

like there is no plugin architecture installed.. very strange...

[edit] I found out what happened, I just need to import pa.sql :)

but now my npc_tables still empty :/ and I got this message when I try to check ndo2db
/usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
Could not bind socket: Address already in use
i got this in syslog
Apr 17 15:32:16 DebianVision nagios: ndomod: Still unable to connect to data sink. 1858 items lost, 5000 queued items to flush.
Apr 17 15:32:32 DebianVision nagios: ndomod: Still unable to connect to data sink. 1934 items lost, 5000 queued items to flush.
[edit2] ndo.sock was created with not enough permissions so I just deleted it and restart nagios/mysql and it works fine now ^^
padawan
Posts: 25
Joined: Fri Nov 30, 2007 4:54 am

Post by padawan »

now can someone explain me how to insert graph in npc ?
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Re: Dupe Host/Service Entries

Post by divagater »

pflaherty wrote:I getting duplicate hosts in my npc_ tables which is shows double services and hosts on my dashboard. The hosts and services pages do not show the dupes. I tried wiping my npc tables but the dupes all came back. Is this an npc issue or an ndo issue? I checked the original ndo schema which does not have uiniq constraints and seemed to match the npc_ schema nicely.

Ideas?
Duplicates entries will be coming from the NDO side. The only npc_ table that NPC writes to at the moment is npc_settings for saving state. Try running this query:

Code: Select all

select host_id,instance_id,config_type,display_name from npc_hosts;
The sample queries provided with ndo all use config_type=1 as a conditional. Some users however were getting config type set to some other value so I removed that conditional from all the queries in the latest build. I am curious if those duplicates have different config_type values.

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

Post by divagater »

padawan wrote:now can someone explain me how to insert graph in npc ?
To map an existing Cacti graph to a nagios/NPC service do the following:

Click the 'Services' link in the left tree menu.

Find the service you want in the services list and double click it.

This will open the service detail screen for that service which includes service state information, state history, notification history, scheduled downtime history, and comments as seen in this screen shot.

On the Service State Information tab click the 'Map Graph' button. Select the graph you want.

Now you can click 'View Graph' on the service state info tab or when viewing the services list you will see a graph icon indicating the service has a graph mapped as seen in this screen shot.

A single left click on the graph icon will pop open the graph which will the hover over the rest of the UI.

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

Post by amaena »

I also have duplicate entries in my npc tables:

mysql> select host_id,instance_id,config_type,display_name from npc_hosts;
+---------+-------------+-------------+--------------+
| host_id | instance_id | config_type | display_name |
+---------+-------------+-------------+--------------+
| 25 | 1 | 0 | dev-2 |
| 26 | 1 | 0 | joomla-prod |
| 27 | 1 | 0 | joomla-stg |
| 28 | 1 | 0 | localhost |
| 29 | 1 | 0 | mysql-prod |
| 30 | 1 | 0 | mysql-slave |
| 31 | 1 | 0 | mysql-stg |
| 32 | 1 | 0 | prod-1 |
| 33 | 1 | 0 | prod-2 |
| 34 | 1 | 0 | prod-3 |
| 35 | 1 | 0 | stg-1 |
| 36 | 1 | 0 | stg-2 |
| 37 | 1 | 1 | dev-2 |
| 38 | 1 | 1 | joomla-prod |
| 39 | 1 | 1 | joomla-stg |
| 40 | 1 | 1 | localhost |
| 41 | 1 | 1 | mysql-prod |
| 42 | 1 | 1 | mysql-slave |
| 43 | 1 | 1 | mysql-stg |
| 44 | 1 | 1 | prod-1 |
| 45 | 1 | 1 | prod-2 |
| 46 | 1 | 1 | prod-3 |
| 47 | 1 | 1 | stg-1 |
| 48 | 1 | 1 | stg-2 |
+---------+-------------+-------------+--------------+
24 rows in set (0.01 sec)

All of my npc tables seem populated as well, but my dash board is empty as well.

I dont see any errors in ndo2db.debug aside from the npc table thats not currently in use or in my nagios log.

Solaris 9 sparc
ndoutils-1.4b7
cacti-0.8.7b
nagios-3.0.1
PHP 5.2.1
mysql 5.0.45
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 also have duplicate entries in my npc tables:
It looks like you are having a couple different issues.

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.

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.

I updated subversion with the queries set to config_type=1. If you are familiar with subversion you will just want to grab controllers/services.php and controllers/hosts.php. Run the following command in a temp directory. Just copy hosts.php and services.php, do not deploy the entire npc source as it wont be setup for production and performance will be bad.

Code: Select all

svn co http://svn2.assembla.com/svn/npc/trunk
Otherwise you can wait for the next build which will come this weekend and includes configurable refresh rate and display rows for all the grids.

Cheers,
Billy
padawan
Posts: 25
Joined: Fri Nov 30, 2007 4:54 am

Post by padawan »

On the Service State Information tab click the 'Map Graph' button. Select the graph you want.
There is no list when I click in "Map Graph" :/
[Debian]
cacti 0.8.7b
nagios 3
ndoutils 1.4b7
cacti PA 2.1
npc 2.1.151
php5 5.2.0-8+etch10
libmysqlclient15-dev 5.0.32-7etch5
mysql-server 5.0.32-7etch5
php5-mysql 5.2.0-8+etch10
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

padawan wrote:
On the Service State Information tab click the 'Map Graph' button. Select the graph you want.
There is no list when I click in "Map Graph" :/
The Map Graph action calls the following URL:

Code: Select all

<cacti_url>/plugins/npc/npc.php?module=cacti&action=getGraphList
It runs a simple query and the results are returned via json. Try hitting the url directly and see if you get any output. Watch your apache error logs while you do it and look for errors.

Also try running this query:

Code: Select all

            SELECT
                graph_templates_graph.id,          
                graph_templates_graph.local_graph_id,          
                graph_templates_graph.height, 
                graph_templates_graph.width, 
                graph_templates_graph.title_cache as title, 
                graph_templates.name, 
                graph_local.host_id 
            FROM
                (graph_local,graph_templates_graph)
            LEFT JOIN 
                graph_templates ON graph_local.graph_template_id = graph_templates.id
            WHERE
                graph_local.id = graph_templates_graph.local_graph_id
                AND graph_templates_graph.title_cache like '%'          
            ORDER BY   
                graph_templates_graph.title_cache, graph_local.host_id
~Billy
padawan
Posts: 25
Joined: Fri Nov 30, 2007 4:54 am

Post by padawan »

when I try to hit directly the url i got this error :
Warning: Missing argument 2 for NpcCactiController::getGraphList(), called in /var/www/cacti/plugins/npc/npc.php on line 76 and defined in /var/www/cacti/plugins/npc/controllers/cacti.php on line 128
{"totalCount":13,"data":[{"title":"None","local_graph_id":0},{"id":"64","local_graph_id":"9","height":"120","width":"500","title":"BC-GSS-Liberte - Byte Cache\/Source Rate","name":"BlueCoat - Byte Cache\/Source Rate","host_id":"4"},{"id":"61","local_graph_id":"6","height":"120","width":"500","title":"BC-GSS-Liberte - Client HTTP Requests\/Hits","name":"BlueCoat - 2 - Client HTTP Requests\/Hits","host_id":"4"},{"id":"62","local_graph_id":"7","height":"120","width":"500","title":"BC-GSS-Liberte - CPU Usage","name":"BlueCoat - 3 - CPU Usage","host_id":"4"},{"id":"65","local_graph_id":"10","height":"120","width":"500","title":"BC-GSS-Liberte - Object Cache\/Source Rate","name":"BlueCoat - Object Cache\/Source Rate","host_id":"4"},{"id":"66","local_graph_id":"11","height":"120","width":"500","title":"BC-GSS-Liberte - Server HTTP Requests","name":"BlueCoat - Server HTTP Requests","host_id":"4"},{"id":"63","local_graph_id":"8","height":"120","width":"500","title":"BC-GSS-Liberte - Server\/Client HTTP Errors","name":"BlueCoat - 4 - Server\/Client HTTP Errors","host_id":"4"},{"id":"67","local_graph_id":"12","height":"120","width":"500","title":"BC-GSS-Liberte - Traffic - 10.20.48.7 (Interface0:0)","name":"Interface - Traffic (bits\/sec)","host_id":"4"},{"id":"60","local_graph_id":"5","height":"120","width":"500","title":"BC-GSS-Liberte - Workers","name":"BlueCoat - 1- Workers","host_id":"4"},{"id":"39","local_graph_id":"2","height":"120","width":"500","title":"Localhost - Load Average","name":"Unix - Load Average","host_id":"1"},{"id":"40","local_graph_id":"3","height":"120","width":"500","title":"Localhost - Logged in Users","name":"Unix - Logged in Users","host_id":"1"},{"id":"38","local_graph_id":"1","height":"120","width":"500","title":"Localhost - Memory Usage","name":"Linux - Memory Usage","host_id":"1"},{"id":"41","local_graph_id":"4","height":"120","width":"500","title":"Localhost - Processes","name":"Unix - Processes","host_id":"1"}]}
and when I try to run this query i got every graph I add in cacti
[Debian]
cacti 0.8.7b
nagios 3
ndoutils 1.4b7
cacti PA 2.1
npc 2.1.151
php5 5.2.0-8+etch10
libmysqlclient15-dev 5.0.32-7etch5
mysql-server 5.0.32-7etch5
php5-mysql 5.2.0-8+etch10
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

padawan wrote:when I try to hit directly the url i got this error :
That would be a bug. So you have warnings enabled in your PHP setup and you are getting a warning because of bad code. The warning is breaking the json response. To get you fixed do the following:

Edit plugins/npc/controllers/cacti.php

On line 128 you should see this:

Code: Select all

function getGraphList($npc_id, $cacti_id) {
Chage that line to this:

Code: Select all

function getGraphList() {
I already fixed this on my end so the changes will be included in the build I put out this weekend.

Thanks,
Billy
padawan
Posts: 25
Joined: Fri Nov 30, 2007 4:54 am

Post by padawan »

I change cacti.php on line 128 it works now I got a list of graph but when I choose one nothing happen
[Debian]
cacti 0.8.7b
nagios 3
ndoutils 1.4b7
cacti PA 2.1
npc 2.1.151
php5 5.2.0-8+etch10
libmysqlclient15-dev 5.0.32-7etch5
mysql-server 5.0.32-7etch5
php5-mysql 5.2.0-8+etch10
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests