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:

Post by divagater »

amaena wrote:Is there any additional documentation available for setting up the performance graphs for nagios services in cacti using npc?

I followed the steps from page 8 of the forum by clicking on services, and then service detail and map graph, however the only graphs available are localhost ones and I am wondering what needs to be done from the cacti side.

I see the option on create new host for mapping a hostname to a nagios hostname but would like a bit more guidance. Perhaps something like setting up a performance graph for using the ping results from nagios?

Thanks !
Hi amaena. I realise the documentation is slim and I will try to clear this up for you. 1st, your post touches on 2 different pieces of NPC. What you are asking is how to create a graph from the performance data returned by a nagios check plugin. The 'Map Graph' button that you refer to is used to map/link an exisitng Cacti graph to a Nagios host or service.

NPC does not automate the whole process of creating graphs from performance data. Instead it does just the 1st step for you which is creating a data input method. The data input method that gets created will be based on the performance data being returned by Nagios and calls the script plugins/npc/perfdata.php to poll the perfdata from the database.

To create the data input method open up the service detail by double clicking a service from the services list. If the service has performance data available you will see a 'Data Input Method' button on the top toolbar of the 'Service State Information' tab (see screenshot). If there is not any performance data then you won't see the button.

Click the 'Data Input Method' button and confirm. The data input method will be named 'NPC - Perfdata - <host>: <service>'. See the second screenshot.

Now you need to manually create a data template using the data input method you just created followed by a graph template etc. as normal. Once you have a graph you can go back to the appropriate service and use the map graph button to map the graph you created to the service it belongs too.

Hope this helps,
Billy
Attachments
A data input method created by NPC
A data input method created by NPC
data_input2.png (15.07 KiB) Viewed 8346 times
Create data input method
Create data input method
data_input.png (43.19 KiB) Viewed 8346 times
Heiko
Cacti User
Posts: 77
Joined: Wed Apr 23, 2008 11:03 am

Post by Heiko »

divagater wrote:
Heiko wrote:How can i get npc to show up in cacti?
Heiko, you need to have plugin architecture 2.0 or higher. 2.1 is the latest. After the plugin architecture is installed go to Console -> User Management. Select your admin user and check 'Plugin Management'. This will enable plugin management for that user.

Then follow the steps in the quickstart guide for installing NPC.

~Billy
Hello,
i have the latest package installed, could this be some bad permissions?
marsiou
Posts: 7
Joined: Mon Apr 14, 2008 11:28 am

Post by marsiou »

hello, i am on fedora,
I install nagios 3.0.1, cacti 0.87b, Ndoutils, Plugin Architecture 2.1.

I can't see NPC in my browser.

I follow the documentation : http://trac2.assembla.com/npc/wiki/QuickStartGuide

I can see "Plugin Management" and when i went to "user management" to active it, i didn't find....

How i can solve this problem ?

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

Post by divagater »

marsiou wrote: I can see "Plugin Management" and when i went to "user management" to active it, i didn't find....
If you can see "Plugin Management" then click it. On the plugin management screen click the 'Uninstalled' tab. You should see NPC listed with various other attributes as well as some links to install, uninstall, enable etc. You need to click the 'Install' link to install NPC.

If you do not see NPC listed then is the latest version of NPC in the plugins directory? Do you have the same plugin under the plugins directory but with different name like:

Code: Select all

someplugin
someplugin-01
This will break the plugin manager. A plugin can only be in the plugins directory 1 time.

~Billy
marsiou
Posts: 7
Joined: Mon Apr 14, 2008 11:28 am

Post by marsiou »

I found , I forgot to update the database cacti with the pa.sql.

Thanks you
Heiko
Cacti User
Posts: 77
Joined: Wed Apr 23, 2008 11:03 am

Post by Heiko »

marsiou wrote:I found , I forgot to update the database cacti with the pa.sql.

Thanks you
ahh, that hurts.
now i have a npc tab.

But it doesnt say anything about that in this doc http://cactiusers.org/wiki/PluginArchitectureInstall
And i used the zip files which unpack some stuff in the pwd, which i miss to look at.
ralf.kirmis
Posts: 1
Joined: Mon Sep 03, 2007 2:28 am

Post by ralf.kirmis »

Hi,

is it possible to change the table names to say ndo_* instead of
npc_* ?

I've running an ndo installation with the nagvis addon and don't
like to change the complete database layout.

thx,
Ralf
User avatar
chrisgapske
Cacti User
Posts: 278
Joined: Tue May 22, 2007 7:56 am
Location: Pensacola, Fl - Padacuh, Ky-Alpena, MI-Gulf Shores,AL

Post by chrisgapske »

you might be able to link the table .. but I would not think changing the table name would be easy you would have to maintain any updates.
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

ralf.kirmis wrote:Hi,

is it possible to change the table names to say ndo_* instead of
npc_* ?

I've running an ndo installation with the nagvis addon and don't
like to change the complete database layout.

thx,
Ralf
Changing the table names would be complicated. A better approach for you would be to setup another instance of ndo. A new ndomod.cfg like ndomod_npc.cfg and ndo2db_npc.cfg. Add another broker entry to your nagios.cfg and fire up another instance of the ndo2db daemon pointing to the new config. Now all your databases get populated and no code changes needed.

Even with a large nagios install the resources used to populate these databases should be small.

~Billy
gimpel
Posts: 5
Joined: Tue Apr 08, 2008 9:19 am

Post by gimpel »

Hrm, got a bit time to play with graphs again.
I seem to have trouble with parsing the output of perfdata.php or similar..

What I did was
  • 2) select some service (load average in this case) and create the data input method using NPC
  • 5) Created a data source
  • 7) added that to the tree
Now, in the logs I get
04/29/2008 04:50:02 PM - CMDPHP: Poller[0] Host[2] DS[8] WARNING: Result from CMD not valid. Partial Result: load1:0.690 load5:0
04/29/2008 04:50:03 PM - SYSTEM STATS: Time:1.1767 Method:cmd.php Processes:1 Threads:N/A Hosts:3 HostsPerProcess:3 DataSources:6 RRDsProcessed:6
Executing the script behind the data input method manually:

Code: Select all

# php plugins/npc/perfdata.php --type=service --id=84
load1:0.500  load5:0.690  load15:0.710
..and the graph is empty of course.

Bug? Or error on my side?
gimpel
Posts: 5
Joined: Tue Apr 08, 2008 9:19 am

Post by gimpel »

Got it!

The perfdata.php spit out one space too much after the values.

So I edited it from line 65 to look like:

Code: Select all

        $output .= preg_replace("/=/", ':', $perf);
    }
}

echo $output;
Now it passes the validate_result function from functions.php, which tests if number of spaces + 1 equals the number of delimiters.

Now, in the shell it looks like:

Code: Select all

phmon01:/usr/share/cacti # php plugins/npc/perfdata.php --type=service --id=84
load1:0.090 load5:0.370 load15:0.440phmon01:/usr/share/cacti #
Only one space between values, and no newline.

Additionally I edited cmd.php, there is a test if strlen > 20; then strout = 20. That sounds like plain nonsense. I made that if strlen < 20, then set it to at least 20.
From line 367 on:

Code: Select all

                                if (!validate_result($output)) {
                                        if (strlen($output) < 20) {
                                                $strout = 20;
                                        } else {
                                                $strout = strlen($output);
                                        }
Captain, we got graphs! Yay!
padawan
Posts: 25
Joined: Fri Nov 30, 2007 4:54 am

Post by padawan »

hello everyone,

I still have a problem with graph on npc
I got a list of graph but when I selected one nothing happen
Attachments
npcgraph.JPG
npcgraph.JPG (102.73 KiB) Viewed 7911 times
[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
homa
Posts: 3
Joined: Thu Aug 14, 2003 12:19 pm

No maps

Post by homa »

Hello !

Hi i have perhaps the same problem. I can map the graph but I can't see any map.

Thanks
stevetuk31
Posts: 10
Joined: Mon Jul 16, 2007 10:57 am

This is great!!

Post by stevetuk31 »

Just like to say thanks.

Installation instructions are clear.
Functionality is great.

Bloody brilliant!!
endlessocean
Posts: 1
Joined: Thu May 22, 2008 4:19 am

Fatal Error

Post by endlessocean »

Hi, I got a problem here, i can see the npc tab.
but when i click it, a fata error showed like this:
Fatal error: Class 'BaseNpcFlappinghistory' not found in /usr/share/cacti/plugins/npc/models/NpcFlappinghistory.php on line 6

any idea about this?
thanks a lot.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest