Nagios Plugin for Cacti (NPC) 2.0.4

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
gizmos
Posts: 6
Joined: Sun Jun 21, 2009 2:44 pm

Post by gizmos »

Hi,

NPC = 2.0.4
I have the following problem.
When i click on a graph icon on NPC, I get a icon with a red cross.

In the apache error log i get this.
[Wed Jun 24 00:12:56 2009] [error] [client 10.0.0.20] script '/srv/www/htdocs/graph_image.php' not found or unable to stat, referer: http://10.0.0.50/cacti/plugins/npc/npc. ... drawLayout
[Wed Jun 24 00:12:59 2009] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /srv/www/htdocs/

(seems that it's not fix correctly)
http://trac2.assembla.com/npc/ticket/39

Regards
gizmos
Posts: 6
Joined: Sun Jun 21, 2009 2:44 pm

noob question

Post by gizmos »

Can someone explain how to make graphs from the nagios data?

I think I have to use the "Data Input Method" button and then I can't find any new created data input in cacti?

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

Re: noob question

Post by divagater »

gizmos wrote:Can someone explain how to make graphs from the nagios data?

I think I have to use the "Data Input Method" button and then I can't find any new created data input in cacti?

Best Regards,
G
When viewing the service detail of a service if performance data is enabled for that service you should see a button called 'Data Input Method'. When you click that button you will then be prompted with a popup asking if you are sure you want to create a data input method. Clicking yes will cause the window to close but you otherwise don't get any indication that something happened.

I have a service called Current Load that is returning perfdata. I click Data Input Method and then click yes on the acknowledgment. Next I click the Console tab -> Data Input Methods

Under Data Input Methods I now have a data input method named 'NPC - Perfdata - localhost: Current Load'. Clicking on that I see a commandline argument like:

php <path_cacti>/plugins/npc/perfdata.php --type=service --id=3 2> /dev/null

and I see three outputs defined called load1, load5, and load15. If I run that command from the command line I get the following output:

Code: Select all

[bgunn@localhost npc]$ php /var/www/html/cacti/plugins/npc/perfdata.php --type=service --id=3
load1:0.000 load5:0.020 load15:0.000 
So from that I can see that my data input which was auto created correctly identifies all the outputs from the perfdata. You still have to create a data template and graph template manually.

Because I create so many graphs for services that just return a single value I have predefined a data input method, data template, and graph template that use the service and hostname rather than an ID which makes adding the graphs a lot easier. Here is an example of a command line that works with NPC:

Code: Select all

php <path_cacti>/plugins/npc/perfdata.php --type=service --host=<hostname> --service="<service_name>" 2> /dev/null
Filling in the blanks with a know host and service I get:

Code: Select all

[bgunn@localhost npc]$ php /var/www/html/cacti/plugins/npc/perfdata.php --type=service --host=localhost --service="Current Load"
load1:0.000 load5:0.000 load15:0.000 
This is pretty cool because the <hostname> parameter can be auto populated by Cacti so when you go to graph something with a single value you only need to add the service name.

When your perfdata has multiple values letting NPC create the data input is probably the easiest way but its only a small fraction of getting you to a full graph.

Verify for me that you actually don't get a data input method created. If not tail your http error logs, try again, and post any errors here.

Cheers,
Billy
[url=http://forums.cacti.net/viewtopic.php?t=26540][b]NPC 2.0.4[/b][/url]
[url=http://trac2.assembla.com/npc][size=75]Trac[/size][/url] | [url=http://trac2.assembla.com/npc/newticket?type=defect][size=75]Bugs[/size][/url] | [url=http://trac2.assembla.com/npc/newticket?type=enhancement][size=75]Requests[/size][/url]
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

gizmos wrote:Hi,

NPC = 2.0.4
I have the following problem.
When i click on a graph icon on NPC, I get a icon with a red cross.

In the apache error log i get this.
[Wed Jun 24 00:12:56 2009] [error] [client 10.0.0.20] script '/srv/www/htdocs/graph_image.php' not found or unable to stat, referer: http://10.0.0.50/cacti/plugins/npc/npc. ... drawLayout
[Wed Jun 24 00:12:59 2009] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /srv/www/htdocs/

(seems that it's not fix correctly)
http://trac2.assembla.com/npc/ticket/39

Regards
Sadly it seems so. Can you send me the $config['url_path'] value that is set in <cacti_dir>/include/global.php ? I will test and reproduce. Should be a very simple patch.

Thanks,
Billy
[url=http://forums.cacti.net/viewtopic.php?t=26540][b]NPC 2.0.4[/b][/url]
[url=http://trac2.assembla.com/npc][size=75]Trac[/size][/url] | [url=http://trac2.assembla.com/npc/newticket?type=defect][size=75]Bugs[/size][/url] | [url=http://trac2.assembla.com/npc/newticket?type=enhancement][size=75]Requests[/size][/url]
DarkMan
Posts: 38
Joined: Wed Mar 18, 2009 3:17 pm

Post by DarkMan »

Hi,

this is a really great plugin for Cacti. Been testing it and configuring Nagios here but I got a strange graphical glitch. The nagios status portlet worked ok at first but when I started to add some host to monitor I lost the status of nagios. Everything seems to be working, nagios and NDO are running, the DB is getting data and the dashboard is showing the updated data fine. When I shutdown nagios, the status portlet seems to print in double.

I've attached 2 screenshot. Anyone seen this? What can I check/test?

Cacti : 0.8.7d
PA : 2.4
NPC : 2.0.3 (updated today to 2.0.4 no change)
also running
Mactrack 1.1
Thold 0.4.1
Weathermap 0.96a
monitor 0.8.2
update 0.4
settings 0.5

php 5.2.5
SLES 10 SP2
Attachments
npc-status.png
npc-status.png (8.79 KiB) Viewed 9106 times
npc-status2.png
npc-status2.png (9.06 KiB) Viewed 9106 times
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

DarkMan wrote:Hi,

this is a really great plugin for Cacti. Been testing it and configuring Nagios here but I got a strange graphical glitch. The nagios status portlet worked ok at first but when I started to add some host to monitor I lost the status of nagios. Everything seems to be working, nagios and NDO are running, the DB is getting data and the dashboard is showing the updated data fine. When I shutdown nagios, the status portlet seems to print in double.
That is pretty strange. Try this for me. Connect to your cacti database and issue the following command:

Code: Select all

DELETE FROM npc_settings
Then clear your browser cache and reload NPC.

If you still have an issue reply back and let me know what browser and version you are using. UI issues are pretty rare so I am definitley interested in this.

~Billy
[url=http://forums.cacti.net/viewtopic.php?t=26540][b]NPC 2.0.4[/b][/url]
[url=http://trac2.assembla.com/npc][size=75]Trac[/size][/url] | [url=http://trac2.assembla.com/npc/newticket?type=defect][size=75]Bugs[/size][/url] | [url=http://trac2.assembla.com/npc/newticket?type=enhancement][size=75]Requests[/size][/url]
DarkMan
Posts: 38
Joined: Wed Mar 18, 2009 3:17 pm

Post by DarkMan »

There were 2 entries in npc_settings. Deleted then, cleared the cache and I still get the same thing.

Tested with :
Debian/Opera 10 Beta
Debian/Iceweasel 3.0.9
XP/Firefox 3.0.10
DarkMan
Posts: 38
Joined: Wed Mar 18, 2009 3:17 pm

Post by DarkMan »

Don't know if this could be related but I get this error in apache error log :

PHP Notice: Undefined index: action in /cacti-0.8.7d/plugins/npc/top_graph_header.php on line 95, referer: http://<...>/cacti/settings.php?tab=npc

PHP Notice: Undefined index: action in /cacti-0.8.7d/include/top_graph_header.php on line 102, referer: http://<...>/cacti/graph_view.php?action=tree&tree_id=2&leaf_id=12

From what I found, it might be due to thold and not very important warning. I'm going to delete thold see if it helps (got a test server so I can poke around).

Edit:

Removed all plugins except for npc. Still get that Undefined index. I'm looking if I can find something about this.
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

DarkMan wrote:Don't know if this could be related but I get this error in apache error log :

PHP Notice: Undefined index: action in /cacti-0.8.7d/plugins/npc/top_graph_header.php on line 95, referer: http://<...>/cacti/settings.php?tab=npc

PHP Notice: Undefined index: action in /cacti-0.8.7d/include/top_graph_header.php on line 102, referer: http://<...>/cacti/graph_view.php?action=tree&tree_id=2&leaf_id=12

From what I found, it might be due to thold and not very important warning. I'm going to delete thold see if it helps (got a test server so I can poke around).

Edit:

Removed all plugins except for npc. Still get that Undefined index. I'm looking if I can find something about this.
I don't think that undefined index is your issue. That is just a notice so script execution was not interrupted. If you are able to reproduce with all those browsers then it will most likely be something related to your environment. Let me tweak a few things to see if I can make it break in the way you have shown.

Billy
[url=http://forums.cacti.net/viewtopic.php?t=26540][b]NPC 2.0.4[/b][/url]
[url=http://trac2.assembla.com/npc][size=75]Trac[/size][/url] | [url=http://trac2.assembla.com/npc/newticket?type=defect][size=75]Bugs[/size][/url] | [url=http://trac2.assembla.com/npc/newticket?type=enhancement][size=75]Requests[/size][/url]
gizmos
Posts: 6
Joined: Sun Jun 21, 2009 2:44 pm

Post by gizmos »

Regards[/quote]
Sadly it seems so. Can you send me the $config['url_path'] value that is set in <cacti_dir>/include/global.php ? I will test and reproduce. Should be a very simple patch.
Thanks,
Billy[/quote]

cacti url = http://10.0.0.50/cacti/

$config['url_path'] = '/cacti/';

Thanks
gizmos
Posts: 6
Joined: Sun Jun 21, 2009 2:44 pm

Re: noob question

Post by gizmos »

divagater wrote:
gizmos wrote:Can someone explain how to make graphs from the nagios data?

I think I have to use the "Data Input Method" button and then I can't find any new created data input in cacti?

Best Regards,
G
When viewing the service detail of a service if performance data is enabled for that service you should see a button called 'Data Input Method'. When you click that button you will then be prompted with a popup asking if you are sure you want to create a data input method. Clicking yes will cause the window to close but you otherwise don't get any indication that something happened.

I have a service called Current Load that is returning perfdata. I click Data Input Method and then click yes on the acknowledgment. Next I click the Console tab -> Data Input Methods

Under Data Input Methods I now have a data input method named 'NPC - Perfdata - localhost: Current Load'. Clicking on that I see a commandline argument like:

php <path_cacti>/plugins/npc/perfdata.php --type=service --id=3 2> /dev/null

and I see three outputs defined called load1, load5, and load15. If I run that command from the command line I get the following output:

Code: Select all

[bgunn@localhost npc]$ php /var/www/html/cacti/plugins/npc/perfdata.php --type=service --id=3
load1:0.000 load5:0.020 load15:0.000 
So from that I can see that my data input which was auto created correctly identifies all the outputs from the perfdata. You still have to create a data template and graph template manually.

Because I create so many graphs for services that just return a single value I have predefined a data input method, data template, and graph template that use the service and hostname rather than an ID which makes adding the graphs a lot easier. Here is an example of a command line that works with NPC:

Code: Select all

php <path_cacti>/plugins/npc/perfdata.php --type=service --host=<hostname> --service="<service_name>" 2> /dev/null
Filling in the blanks with a know host and service I get:

Code: Select all

[bgunn@localhost npc]$ php /var/www/html/cacti/plugins/npc/perfdata.php --type=service --host=localhost --service="Current Load"
load1:0.000 load5:0.000 load15:0.000 
This is pretty cool because the <hostname> parameter can be auto populated by Cacti so when you go to graph something with a single value you only need to add the service name.

When your perfdata has multiple values letting NPC create the data input is probably the easiest way but its only a small fraction of getting you to a full graph.

Verify for me that you actually don't get a data input method created. If not tail your http error logs, try again, and post any errors here.

Cheers,
Billy
Billy,

I'm able to create the "Data Input Methods"
But getting a graph in to cacti is something else :)
I'm currently looking for a good tutorial that explains how to create graphs from "Data Input Methods".

I'm testing with a simple PING check from nagios

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

Post by divagater »

gizmos wrote:Regards
cacti url = http://10.0.0.50/cacti/
$config['url_path'] = '/cacti/';

Thanks[/quote]

Ok, here is a quick fix you can do for now until I get a patch out. This was submitted to me by another user.

Edit plugins/npc/controllers/layout.php and find this section:

Code: Select all


 npc.params.cacti_path          = "<?php echo URL_PATH; ?>";
 var strLen = npc.params.cacti_path;
 if (npc.params.cacti_path.charAt(strLen-1) == '/') {
        npc.params.cacti_path = npc.params.cacti_path.slice(0,strLen-1);
 }

Comment out all but the first line with // so the end result looks like:

Code: Select all


 npc.params.cacti_path          = "<?php echo URL_PATH; ?>";
 //var strLen = npc.params.cacti_path;
 //if (npc.params.cacti_path.charAt(strLen-1) == '/') {
 //       npc.params.cacti_path = npc.params.cacti_path.slice(0,strLen-1);
 //}

That should get your graphs working.

Cheers,
Billy
[url=http://forums.cacti.net/viewtopic.php?t=26540][b]NPC 2.0.4[/b][/url]
[url=http://trac2.assembla.com/npc][size=75]Trac[/size][/url] | [url=http://trac2.assembla.com/npc/newticket?type=defect][size=75]Bugs[/size][/url] | [url=http://trac2.assembla.com/npc/newticket?type=enhancement][size=75]Requests[/size][/url]
gizmos
Posts: 6
Joined: Sun Jun 21, 2009 2:44 pm

Post by gizmos »

divagater wrote:
gizmos wrote:Regards
Ok, here is a quick fix you can do for now until I get a patch out. This was submitted to me by another user.

Edit plugins/npc/controllers/layout.php and find this section:

Code: Select all


 npc.params.cacti_path          = "<?php echo URL_PATH; ?>";
 var strLen = npc.params.cacti_path;
 if (npc.params.cacti_path.charAt(strLen-1) == '/') {
        npc.params.cacti_path = npc.params.cacti_path.slice(0,strLen-1);
 }

Comment out all but the first line with // so the end result looks like:

Code: Select all


 npc.params.cacti_path          = "<?php echo URL_PATH; ?>";
 //var strLen = npc.params.cacti_path;
 //if (npc.params.cacti_path.charAt(strLen-1) == '/') {
 //       npc.params.cacti_path = npc.params.cacti_path.slice(0,strLen-1);
 //}

That should get your graphs working.

Cheers,
Billy
Sorry for the late reply, but the temp fix is working perfectly 8)
cgaeth
Posts: 5
Joined: Thu Jul 09, 2009 9:54 am
Location: Wilmington, DE

Post by cgaeth »

So far i am working my way through this and really enjoying it. i do have an odd issue though as i have inherited and existing Cacti/Nagios setup. NPC wants the URL setup as http://servername/nagios. However we already have a virtual host setup as http://servername. So things like the Status Map and the various Reporting do not work. I get "The requested URL /cgi-bin/trends.cgi was not found on this server.". If I put the /nagios on the end it does work but then breaks things elsewhere. Any suggestions on how to fix this?
Chrysalis
Cacti User
Posts: 70
Joined: Fri Sep 19, 2008 10:14 am
Location: UK

Post by Chrysalis »

Hi guys the plugin looks good but I am having issues.

I can confirm the following all in place on my server.

mysql 5.0+
php 5.2+
pdo
pdo_mysql
json
ndo2db and running

cacti database has npc_ tables which seem to be filled with data correctly.

Now when I view the npc tab in cacti I get the spinning circles whilst it tries to fetch data, the nagios status in the top left has all green boxes.

The 2 hostgroup boxes bottom right host status and service status show correct stats.

However the first 4 boxes are all 0s and and my host status summary and service status summary at the top are all 0s.

any ideas? thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests