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:

Nagios Plugin for Cacti (NPC) 2.0.4

Post by divagater »

Download NPC 2.0.4

NOTE: If you are upgrading there is a sql file in the root of plugins/npc called upgrade_schema.sql. Run this against your cacti database. It adds a handful of indexes to the npc tables. Skip this if doing a clean install.

Code: Select all

cd <cacti_home>/plugins/npc
mysql -u USERNAME -p DATABASE < upgrade_schema.sql
As always make sure you meet all the dependencies listed in the quick start guide.

2009-06-22 - 2.0.4 release notes:

Added few small features and fixed a couple bugs.

* Updated the graph paths to use the Cacti path defined on global.php. This should resolve the issues some people were having displaying or mapping graphs.
* Made the host and service status summaries clickable. When clicked the service or hosts grid will open filtered based on the clicked cell. For instance clicking the warnings cell will show all the services in a warning state. This feature will be expanded to all grids that show counts by state but currently is only available on the host and service status summary portlets (the ones at the top of NPC).
* Added the ability to acknowledge warnings.
* Added an 'Unhandled' toggle to the service problems (and portlet) grid. This button is on the bottom toolbar. Toggling it will filter the display to only show issues that have not been acknowledged.

2009-06-08 - 2.0.3 release notes:

This is a bug fix release.

* Added index to npc_objects to improve performance of perdata.php.
* Updated index on npc_configfilevariables which was preventing writes.
* Fixed host icon handling.
* Fixes comment handling which was breaking service and host detail screens.
* Added cli.php which will become a replacement for perfdata.php

2009-05-17 - 2.0.2 release notes:

NPC releases are no longer following beta/build release versioning. This release is skipping ahead to 2.0.2 and future releases will increment accordingly.

* Host and status summary portlets have been moved above the dashboard and navigation panels (see updated screenshot).
* Added A Nagios Status portlet which displays whether or not Nagios is running and if global checks and notifications are enabled.
* Made the portlet refresh rate a global property under NPC settings.
* Fixed bug where NPC was preventing other pages from auto refreshing by including and overriding top_graph_header.
* Added a realm (permission) for executing global commands like disabling all notifications or checks.
* Fixed bug that was causing double checkboxes on various forms.
* Added a cog icon to represent when host/services are in scheduled downtime.
* Added support to represent the icons defined in the Nagios host/service definitions (see dashboard screenshot). This feature must be enabled in NPC settings.
* Added support for hostgroup commands. These are accessed via right click on a hostgroup name from the hostgroup dashboard portlets.
* Updated most portlets and the comments grids to use live scrolling rather than paging.
* Fixed bug with searching comments.
* Added an Additional Information tab to service and host detail. This tab activates automatically if the notes_url parameter is defined in the Nagios host/service definition. See notes_url screenshot.
* Upates to support additional list methods using perfdata.php. This script is slowly become a Nagios/NPC general purpose CLI script.

2.0.0b Build 182 notes:

Big performance updates and a few new features including:

* Updated Doctrine ORM to 1.0.7 Stable
* Fixed some very inefficient queries.
* Updated the methods for getting host and service status summary. (Huge performanace gain)
* Added many new indexes
* Updated many of the grids to be buffered scrolling "live" grids rather than paging grids.

Live Grids: While scrolling up or down the grids will fetch the records relating to the scroll bar position plus some extra to give a buffer. See the attached screen shots that show a live hosts grid in action. The scrolling action should be preferable to paging through a large amount of data.

2.0.0b Build 166 notes:
* This beta release of NPC fixes a few minor bugs.
* Setting config_output_options=2 (or 3) in ndomod.cfg is now a requirement. This corrects some instances of no data or duplicate data.
* All grids were updated to fit the bottom bar to the bottom of the browser.
* All grids now have an option for configuring the number of rows displayed.
* All grids now have the option for configuring the refresh rate.
* Portlet rows/refresh is adjusted by clicking the configuration icon in top right corner of the portlet.
* Like all other aspects of the UI the rows and refresh configuration is saved server side on a per user basis.

2.0.0b Build 151 notes:
Besides a few bug fixes this release takes advantage of many of the plugin management features found in the plugin
architecture 2.x. including install/uninstall options as well as enable/disable option.
Uninstall removes all database traces of NPC.

NOTE: NPC now has to be installed via the plugin management section even if you are upgrading from a previous release. If you have an entry for NPC in global.php it can be removed.

----------------------------

I setup a community Trac site to host the NPC project. The NPC source as well as install guide, screen shots, etc. can be found there.

With the exception of some installation notes documentation is very slim. Here are a few tips to get you started:
  • * Most lists including services or hosts can be double clicked to open additional detail screens.

    * Most lists including services or hosts can be right clicked to popup a context menu used to issue service or host commands.

    * If a graph is mapped to a service or host, a graph icon will be displayed in the hosts and services screens. A single left click of this icon will popup the graph.

    * Most green check marks (started/enabled) or most red X (stopped/disabled) can be double clicked to toggle the option (requires that remote commands are enabled.)

    * Most grid columns can be re-ordered via drag and drop.

    * Most grid columns can be hidden and currently hidden columns can be viewed by clicking a down arrow to the right of the column heading.

    * Dashboard portlets can be closed or minimized. Closed portlets can be made visible again by clicking the Portlets button on the far right of the toolbar on the Dashboard tab and then select which portlets you want displayed.

    * All changes to the interface (portlets, column order, etc.) are saved server side on a per user basis. Customize the UI your way and it is available anywhere you login.

    * Importing Nagios hosts is done from the N2C link on the left side tree menu. Before starting an import you need to click in the template field to the right of the hostgroup you are importing. Doing so will expose a select box for assigning a host template.

Bugs/support

The interface currently has some quirks that I am aware of. Dragging a portlet will sometimes move several portlets at once. When this happens just reload the NPC page and the portlet order should be correct.

Grids will sometimes fail to render or display fully. Closing and re-opening the problem tab usually resolves that. When viewing host/service detail screens, allow all the data to load before clicking through the tabs.

For all other issues post your problem here, or if you are inclined open a ticket on the NPC Trac site. This is an alpha release so I fully expect issues and I need your help to find them :)

Cheers,
Billy
Attachments
Additional information tab auto loads the URL defined in the Nagios host/service notes_url parameter
Additional information tab auto loads the URL defined in the Nagios host/service notes_url parameter
notes_url.png (799.62 KiB) Viewed 83077 times
The grid correctly calculates which records will be displayed while scrolling. The bottom toolbar displays which records will be visible while the grid is fetching the results.
The grid correctly calculates which records will be displayed while scrolling. The bottom toolbar displays which records will be visible while the grid is fetching the results.
liveGrid2.png (101.55 KiB) Viewed 87736 times
The grid looks like it has preloaded all the records. Paging options are gone. Obviously preloading all records would be very slow. The grid has actually only fetched about 150 records.
The grid looks like it has preloaded all the records. Paging options are gone. Obviously preloading all records would be very slow. The grid has actually only fetched about 150 records.
liveGrid1.png (93.85 KiB) Viewed 87736 times
NPC Dashboard
NPC Dashboard
npc_dashboard.png (643.68 KiB) Viewed 87736 times
Last edited by divagater on Fri Jun 26, 2009 9:06 pm, edited 22 times in total.
[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]
UpSa
Posts: 3
Joined: Tue Mar 04, 2008 2:01 pm

Post by UpSa »

this looks very promising :wink:

time for alpha test !
aleto
Posts: 39
Joined: Wed May 25, 2005 3:57 am

Post by aleto »

Hi,

I have installed successfully the plugin, ndo2db is populaiting the tables with data so thats working correctly.

However when i select the "NPC" tab, no data or what so ever is displayed.

#php -v
PHP 5.2.3 (cli) (built: Aug 20 2007 17:53:31)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
with the ionCube PHP Loader v3.1.32, Copyright (c) 2002-2007, by ionCube Ltd.
# mysql -V
mysql Ver 14.12 Distrib 5.0.45, for pc-linux-gnu (i686) using readline 5.0

ndoutils-1.4b7
nagios-3.0
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

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
rmcclain
Posts: 9
Joined: Fri Mar 28, 2008 3:16 am

N2C isn't showing any hosts

Post by rmcclain »

I think I'm missing something.. how does the configuration information get populated in the database? I see various npc_tables, but they are all empty. ndo2db is running. Clicking the N2C link brings up an empty list. There doesn't seem to be any way to add any of the hosts from my Nagios setup.

This looks fantastic if I can get it to work ;)

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

Post by divagater »

I think I'm missing something.. how does the configuration information get populated in the database?
Everything requires that ndo2db populate the npc_ tables. Without that you can not actually use n2c to import the Nagios hosts or view any status data etc.

So for you the issue is clearly that ndo2b is not getting Nagios events into the database. You should have 2 ndo config files:

ndo2db.cfg (Config for the ndo2db daemon)
ndomod.cfg (Config for the module ndo2db.o)

Both of these configs need to be setup the same in terms of whether you are using the tcpsocket option or the unixsocket. So in both files I have the tcpsocket option uncommented (not the default) and they are both set to use port 5668 (that was default). Also double check the database params in ndo2db.cfg.

Next, edit ndo2db.cfg and set:

debug_level=1
debug_file=<some/path>

Restart ndo2db and restart nagios. Check the ndo2db debug log for errors.

~Billy
miky_willis
Posts: 20
Joined: Tue Apr 25, 2006 6:08 am

Post by miky_willis »

Hello ;) Good job thanks !

So I try this. And I got this issue

The installation of the plugin into cacti was good I got the tab and interface is good...

But when I compile ndo and tell nagios to use it, it does not work. Nagios won't start.

First of all I had a problem with php-json

[root@manage var]# rpmbuild --rebuild /home/xxxx/php-json-4.3.2_1.2.1-1.aurore.src.rpm
Installation de /home/xxxx/php-json-4.3.2_1.2.1-1.aurore.src.rpm
erreur: échec du déballage de l'archive dans fichier /usr/src/redhat/SOURCES/php-json-ext-1.2.1.tar.bz2;47ecc86b: cpio: read
erreur: /home/xxxx/php-json-4.3.2_1.2.1-1.aurore.src.rpm ne peut être installé


I have this in nagios.log

ndomod seems to be launched

[1206699130] Nagios 3.0 starting... (PID=4381)
[1206699130] Local time is Fri Mar 28 11:12:10 CET 2008
[1206699130] LOG VERSION: 2.0
[1206699130] ndomod: NDOMOD 1.4b7 (10-31-2007) Copyright (c) 2005-2007 Ethan Galstad (nagios@nagios.org)
[1206699130] ndomod: Successfully connected to data sink. 0 queued items to flush.


[root@manage ndoutils-1.4b7]# service nagios restart
Running configuration check...done.
Stopping nagios: kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
done.
Starting nagios: done.
[root@manage ndoutils-1.4b7]#


So nagios do not run and I don't see any errors


In my nagios.cfg:

check_external_commands=1

command_check_interval=-1

event_broker_options=-1

broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg

process_performance_data=1


AND

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Total Warnings: 0
Total Errors: 0

I'm using fedora core 8, nagios3, cacti 0.8.7b, php5.2.4-3, mysql 5.0.45-4

Any idea... I am trying to look at the problem with json...

thx
Ubuntu / Cacti 0.8.7g / PIA 2.9
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

json is included in PHP 5.2 and above so don't install the RPM.
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

Sorry for that short answer above but I wanted you to get that message right away :)

So Nagios "appears" to start but the actual process is just gone? Or is the nagios process there but its not doing anything?
miky_willis
Posts: 20
Joined: Tue Apr 25, 2006 6:08 am

Post by miky_willis »

OK great for json I found the answer juste after my message...

For nagios it seems to start but the process is not there. :-?
Ubuntu / Cacti 0.8.7g / PIA 2.9
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

By default nagios does not have debug enabled. In nagios.cfg find/set the following parameter:

debug_level=1

Make note of where it writes the debug log:

debug_file=/usr/local/nagios/var/nagios.debug

Additionaly you could crank up the verbosity from 1 to 2

debug_verbosity=1

I suspect that the ndomod.o is crashing Nagios. To test that just comment out the line that loads the module:

broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg

Also be sure that the ndomod.o was copied from ndomod-3x.o is the ndoutils source. Check the file size and verify they are the same. Accidently using the 2x version of ndomod would probably kill Nagios.

~Billy
miky_willis
Posts: 20
Joined: Tue Apr 25, 2006 6:08 am

Post by miky_willis »

Thanks for rapid answer :o ;)

When I comment out the broker nagios starts great

with debug level -1 (everything) I got this output when I do a restart

[1206707430.078748] [001.0] [pid=9433] drop_privileges() start
[1206707430.078801] [004.0] [pid=9433] Original UID/GID: 0/0
[1206707430.079338] [004.0] [pid=9433] New UID/GID: 504/504
[1206707430.080008] [064.1] [pid=9433] Making callbacks (type 9)...
[1206707430.080165] [064.1] [pid=9433] Making callbacks (type 9)...
[1206707430.080247] [064.1] [pid=9433] Making callbacks (type 9)...
[1206707430.083438] [064.1] [pid=9433] Making callbacks (type 9)...
[1206707430.095762] [064.1] [pid=9433] Making callbacks (type 9)...

ndomod.o in /usr/local/nagios/bin/ really is the ndomod-3x.o

I miss somtehing but I don't know what...
Ubuntu / Cacti 0.8.7g / PIA 2.9
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 fedora core 8, nagios3, cacti 0.8.7b, php5.2.4-3, mysql 5.0.45-4
I just installed an FC8 system. I will emulate your environment and see what I come up with. Should have it all setup pretty soon.

~Billy
miky_willis
Posts: 20
Joined: Tue Apr 25, 2006 6:08 am

Post by miky_willis »

perhaps I miss something with ndomod config...

in ndo2db.cfg or in ndomod.cfg

ndo2db.cfg:

ndo2db_user=nagios
ndo2db_group=nagios
socket_type=unix
socket_name=/usr/local/nagios/var/ndo.sock
tcp_port=5668
db_servertype=mysql
db_host=localhost
db_port=3306
db_name=cacti
db_prefix=nagios_
db_user=cactiuser
db_pass=cactisuer
# Keep timed events for 24 hours
max_timedevents_age=1440
# Keep system commands for 1 week
max_systemcommands_age=10080
# Keep service checks for 1 week
max_servicechecks_age=10080
# Keep host checks for 1 week
max_hostchecks_age=10080
# Keep event handlers for 31 days
max_eventhandlers_age=44640
debug_level=1
debug_verbosity=1
debug_file=@localstatedir@/ndo2db.debug
max_debug_file_size=1000000


ndomod.cfg:

instance_name=default

#output_type=file
#output_type=tcpsocket
output_type=unixsocket

#output=/usr/local/nagios/var/ndo.dat
#output=127.0.0.1
output=/usr/local/nagios/var/ndo.sock

tcp_port=5668
output_buffer_items=5000
buffer_file=/usr/local/nagios/var/ndomod.tmp
file_rotation_interval=14400
#file_rotation_command=rotate_ndo_log
file_rotation_timeout=60
reconnect_interval=15
reconnect_warning_interval=15
#reconnect_warning_interval=900

data_processing_options=-1
config_output_options=2

Please tell me if there is something wrong there ;)
Ubuntu / Cacti 0.8.7g / PIA 2.9
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

Thanks for posting your configs. Still working on getting a matching env setup but in the mean time I see one thing wrong and have a suggestion for trying something different.

1st, in ndo2db.cfg db_prefix has to be set like:

db_prefix=npc_

You have it currently as nagios_.

Next, I notice that you are using unix socket for the communication between ndo2db daemon and ndo module. This is the default setting however I recall having an issue with that as well. Try doing the following for me and see if it helps:

In ndomod.cfg set:

output_type=tcpsocket
output=127.0.0.1
tcp_port=5668

In ndo2db.cfg set:

socket_type=tcp
tcp_port=5668

This causes the ndomod.o module to post events to port 5668 on localhost and for ndo2db daemon to listen on port 5668 for events passed from ndomod.o.

~Billy
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests