Nagios Plugin for Cacti (NPC) 2.0.4

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

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

NPC shows no hosts/service information

Post by stevetuk31 »

I am having the same issue as o51974.

I have read through all or most posts and haven't been able to find anything that would assist in resolving the problem. It would appear that most issues are down to inaccurate configuration. However, I believe my configuration to be accurate, or as per documentation.

My NPC page looks exactly the same as o51974, showing the nagios status information, plus I am getting information in the event log, which I guess would indicate NDOUtils is functioning as expected. I have also made sure, host and performance data is present in the DB.

I am hoping I haven’t missed anything obvious in the forum or documentation.

Any help would be much appreciated!

Excerpt from ndo2db.debug:
[1250681780.161596] [002.0] [pid=9624] INSERT INTO npc_servicechecks SET instance_id='1', service_object_id='51', check_type='0', current_check_attempt='1', max_check_attempts='4', state='0', state_type='1', start_time=FROM_UNIXTIME(1250681780), start_time_usec='154858', end_time=FROM_UNIXTIME(0), end_time_usec='0', timeout='60', early_timeout='0', execution_time='0.000000', latency='0.154000', return_code='0', output='', long_output='(null)', perfdata='time=0\.069628s;;;0\.000000 size=1699B;;;0', command_object_id='6', command_args='', command_line='/usr/local/nagios/libexec/check_http -I 127\.0\.0\.1 ' ON DUPLICATE KEY UPDATE instance_id='1', service_object_id='51', check_type='0', current_check_attempt='1', max_check_attempts='4', state='0', state_type='1', start_time=FROM_UNIXTIME(1250681780), start_time_usec='154858', end_time=FROM_UNIXTIME(0), end_time_usec='0', timeout='60', early_timeout='0', execution_time='0.000000', latency='0.154000', return_code='0', output='', long_output='(null)', perfdata='time=0\.069628s;;;0\.000000 size=1699B;;;0'

System Info:

Ubuntu 8.04 LTS Server

PHP 5.2 - [PHP Modules],bcmath, bz2, calendar, ctype, date, dba, dom, exif, filter, ftp, gettext, hash, iconv, json, ldap, libxml, mbstring, mime_magic, mysql, mysqli, ncurses, openssl, pcntl, pcre, PDO, pdo_mysql, pdo_sqlite, posix, readline, Reflection, session, shmop, SimpleXML, snmp, soap, sockets, SPL, standard, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xml, xmlreader, xmlwriter, zip, zlib

Mysql server - 5.0.51a-3ubuntu5.4
cacti version=0.8.7e
cacti-Plugin Architecture=2.5
nagios version = 3.2
NDOUtils version = 1.4b8
npc version=2.0.4
webserver = Apache/2.2.8
rrdtool = 1.2.19

ndo2db.cfg:
ndo2db_user=nagios
ndo2db_group=nagios
socket_type=tcp
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=npc_
db_user=cactiuser
db_pass=pa55w0rd
max_timedevents_age=1440
max_systemcommands_age=10080
max_servicechecks_age=10080
max_hostchecks_age=10080
max_eventhandlers_age=44640
debug_level=0
debug_verbosity=1
debug_file=/usr/local/nagios/var/ndo2db.debug
max_debug_file_size=1000000

ndomod.cfg:
instance_name=default
output_type=tcpsocket
output=127.0.0.1
tcp_port=5668
output_buffer_items=5000
buffer_file=/usr/local/nagios/var/ndomod.tmp
file_rotation_interval=14400
file_rotation_timeout=60
reconnect_interval=15
reconnect_warning_interval=15
data_processing_options=-1
config_output_options=2
erickbe
Cacti User
Posts: 52
Joined: Sat Jan 17, 2009 1:01 am

Post by erickbe »

You need to use NDOUtils 1.4b7. There was a note here the other day about 1.4b8 changing something with SQL and a updated NPC coming out in 3-4 weeks to handle it. But you can use older version of NDOUtils and it will work. Thats what I did on my new box after having those NDO2DB errors.
stevetuk31
Posts: 10
Joined: Mon Jul 16, 2007 10:57 am

NPC shows no hosts/service information

Post by stevetuk31 »

erickbe wrote:You need to use NDOUtils 1.4b7. There was a note here the other day about 1.4b8 changing something with SQL and a updated NPC coming out in 3-4 weeks to handle it. But you can use older version of NDOUtils and it will work. Thats what I did on my new box after having those NDO2DB errors.
Thanks erickbe. Sorted the problem.

Much appreciated.
o51974
Posts: 2
Joined: Fri Aug 14, 2009 6:08 pm

Post by o51974 »

erickbe wrote:You need to use NDOUtils 1.4b7. There was a note here the other day about 1.4b8 changing something with SQL and a updated NPC coming out in 3-4 weeks to handle it. But you can use older version of NDOUtils and it will work. Thats what I did on my new box after having those NDO2DB errors.
This is perfect!! I have tested that NDOUtils 1.4b7 solves the problem of NO HOSTS/ SERVICES in both Centos 5.2 & 5.3.

Thank you VERY MUCH.
cskp12
Posts: 21
Joined: Thu Jun 18, 2009 8:52 pm

Post by cskp12 »

hi I use npc 2.0.4 run output show nothig
I check out my database some table not creative
my Config
cacti server on fedora core 11
Cacti Version - 0.8.7d
Plugin Architecture - 2.4
Poller Type - Cactid v
Server Info - Linux 2.6.30
Web Server - Apache/2.2.11 (Fedora)
PHP - 5.2.9
PHP Extensions - libxml, xml, tokenizer, session, pcre, SimpleXML, sockets, SPL, shmop, standard, Reflection, iconv, hash, gmp, gettext, ftp, filter, exif, date, ctype, calendar, bz2, zlib, openssl, apache2handler, curl, dbase, dom, json, ldap, memcache, mysql, mysqli, PDO, pdo_mysql, pdo_sqlite, rrdtool, snmp, wddx, xmlreader, xmlwriter, xsl, zip, eAccelerator, Zend Optimizer
MySQL - 5.0.81-community-nt
RRDTool - 1.3.4
SNMP - 5.4.2.1
Plugins
  • Global Plugin Settings (settings - v0.5)
    Host Info (hostinfo - v0.2)
    Update Checker (update - v0.4)
    Network Tools (tools - v0.3)
    NetTools for Cacti (NetTools - v0.1.5)
data base mysql 5.0.51 on windows 2003


how I run npc pa normale
thx your rely
stevetuk31
Posts: 10
Joined: Mon Jul 16, 2007 10:57 am

Portlet Configuration Tab

Post by stevetuk31 »

Hi,

Was curious if anyone else is having issues with the portlet configuration tab, as I am not able to change the refresh or display the number of rows. Both settings do not appear to be available for selection!

Thanks in advance
dononeil
Cacti User
Posts: 194
Joined: Wed Aug 06, 2008 4:45 pm

Post by dononeil »

I was wondering if there was any way to use this plugin when my Nagios service is running on a different machine?

We have 4 cacti servers, and 2 nagios servers, querying about 500,000+ services, and 50,000 hosts, way too much for one server.

It would be nice to be able to view the nagios data in Cacti with this plugin. Is this possible? Perhaps via some NFS mounted volume or something so that the plugin can get at the nagios data?

Thanks!
npc
Posts: 1
Joined: Wed Sep 02, 2009 11:34 am

Empty tab

Post by npc »

hello,
Same problem (cf o51974):
Successfully connected to data sink. ......, 5000 queued items to flush.
ndomod: Successfully flushed 5000 queued items to data sink.
cacti version=0.8.7d
cacti-Plugin Architecture=2.4
npc version=2.0.4
npc_hosts, npc_services are populated but graphs are empty.
I have spent lost of time to read this forum and i think it is a config_type problem.

config_type is 0 , parameter in settings have been tested 0 then 1
deluxemongo
Posts: 3
Joined: Mon Aug 17, 2009 5:05 am

Problem importing hosts with n2c

Post by deluxemongo »

hello,

i have got problems with the import of hots using the n2c funktion. cacti won't add the selected hosts.
is there anybody having the same problem or does anyone has a solution for this problem.

system:
SLES11
Cacti 087e
nagios 3.12
ndoutils 1.4b7
pluginaarch 087e
npc 204
Attachments
look of n2c in IE8
look of n2c in IE8
N2C.JPG (124.19 KiB) Viewed 8001 times
data input method - works fine
data input method - works fine
N2C_dim.JPG (183.9 KiB) Viewed 8001 times
after data input method
after data input method
N2C_dim_ok.JPG (165.59 KiB) Viewed 8001 times
look of n2c in firefox after import
look of n2c in firefox after import
N2C_import.JPG (131.36 KiB) Viewed 8001 times
koaps
Posts: 12
Joined: Thu Feb 15, 2007 1:37 pm

Where's localhost

Post by koaps »

Well, I finally got things working...

Missed the part about not creating a nagios database for ndoutils so wasn't sure why I wasn't seeing anything.

Changed to using cacti's database and things started working.

Though wondering why localhost doesn't show up in the hosts/services list, currently it's the only thing being monitored by nagios.
nazark
Posts: 1
Joined: Mon Oct 19, 2009 10:20 pm

No data in NPC Module

Post by nazark »

Hello,

I just installed fresh copy of cacti with NPC module, but I am unable to get hostgroup data from nagios.

npc tables are populated with nagios data
ysql> select * from npc_conninfo;
+-------------+-------------+------------+---------------+-------------+----------------+--------------+---------------------+---------------------+---------------------+---------------------+---------------------+-----------------+-----------------+-------------------+
| conninfo_id | instance_id | agent_name | agent_version | disposition | connect_source | connect_type | connect_time | disconnect_time | last_checkin_time | data_start_time | data_end_time | bytes_processed | lines_processed | entries_processed |
+-------------+-------------+------------+---------------+-------------+----------------+--------------+---------------------+---------------------+---------------------+---------------------+---------------------+-----------------+-----------------+-------------------+
| 1 | 1 | NDOMOD | 1.4b7 | REALTIME | UNIXSOCKET | RECONNECT | 2009-10-19 21:58:30 | 0000-00-00 00:00:00 | 2009-10-19 22:04:36 | 2009-10-19 21:58:30 | 0000-00-00 00:00:00 | 963332 | 104781 | 4592 |
| 2 | 1 | NDOMOD | 1.4b7 | REALTIME | UNIXSOCKET | RECONNECT | 2009-10-19 22:09:34 | 0000-00-00 00:00:00 | 2009-10-19 23:29:53 | 2009-10-19 22:09:34 | 0000-00-00 00:00:00 | 11592614 | 1274923 | 57227 |
+-------------+-------------+------------+---------------+-------------+----------------+--------------+---------------------+---------------------+---------------------+---------------------+---------------------+-----------------+-----------------+-------------------+
2 rows in set (0.00 sec)

when accessing
npc.php?module=hosts&action=getHosts&p_state=any

{"response":{"value":{"items":[],"total_count":0,"version":1}}}

When adding two lines to plugins/npc/controllers/hosts.php
print_r($q->getQuery());
exit;

I get this result


Doctrine_Query Object ( [_subqueryAliases:protected] => Array ( ) [_aggregateAliasMap:protected] => Array ( [host_name] => n2__0 ) [_pendingAggregates:protected] => Array ( ) [_needsSubquery:protected] => 1 [_isSubquery:protected] => [_neededTables:protected] => Array ( [0] => n2 [1] => n [2] => n3 [3] => n4 [4] => n5 [5] => n6 ) [_pendingSubqueries:protected] => Array ( ) [_pendingFields:protected] => Array ( ) [_parsers:protected] => Array ( [from] => Doctrine_Query_From Object ( [query:protected] => Doctrine_Query Object *RECURSION* [_tokenizer:protected] => Doctrine_Query_Tokenizer Object ( ) ) [select] => Doctrine_Query_Select Object ( [query:protected] => Doctrine_Query Object *RECURSION* [_tokenizer:protected] => Doctrine_Query_Tokenizer Object ( ) ) [where] => Doctrine_Query_Where Object ( [query:protected] => Doctrine_Query Object *RECURSION* [_tokenizer:protected] => Doctrine_Query_Tokenizer Object ( ) ) [orderby] => Doctrine_Query_Orderby Object ( [query:protected] => Doctrine_Query Object *RECURSION* [_tokenizer:protected] => Doctrine_Query_Tokenizer Object ( ) ) [limit] => Doctrine_Query_Limit Object ( [query:protected] => Doctrine_Query Object *RECURSION* [_tokenizer:protected] => Doctrine_Query_Tokenizer Object ( ) ) [offset] => Doctrine_Query_Offset Object ( [query:protected] => Doctrine_Query Object *RECURSION* [_tokenizer:protected] => Doctrine_Query_Tokenizer Object ( ) ) ) [_pendingJoinConditions:protected] => Array ( ) [_expressionMap:protected] => Array ( [host_name] => Array ( [0] => n2.name1 [1] => 1 ) ) [_sql:protected] => SELECT n.hoststatus_id AS n__hoststatus_id, n.instance_id AS n__instance_id, n.host_object_id AS n__host_object_id, n.status_update_time AS n__status_update_time, n.output AS n__output, n.perfdata AS n__perfdata, n.current_state AS n__current_state, n.has_been_checked AS n__has_been_checked, n.should_be_scheduled AS n__should_be_scheduled, n.current_check_attempt AS n__current_check_attempt, n.max_check_attempts AS n__max_check_attempts, n.last_check AS n__last_check, n.next_check AS n__next_check, n.check_type AS n__check_type, n.last_state_change AS n__last_state_change, n.last_hard_state_change AS n__last_hard_state_change, n.last_hard_state AS n__last_hard_state, n.last_time_up AS n__last_time_up, n.last_time_down AS n__last_time_down, n.last_time_unreachable AS n__last_time_unreachable, n.state_type AS n__state_type, n.last_notification AS n__last_notification, n.next_notification AS n__next_notification, n.no_more_notifications AS n__no_more_notifications, n.notifications_enabled AS n__notifications_enabled, n.problem_has_been_acknowledged AS n__problem_has_been_acknowledged, n.acknowledgement_type AS n__acknowledgement_type, n.current_notification_number AS n__current_notification_number, n.passive_checks_enabled AS n__passive_checks_enabled, n.active_checks_enabled AS n__active_checks_enabled, n.event_handler_enabled AS n__event_handler_enabled, n.flap_detection_enabled AS n__flap_detection_enabled, n.is_flapping AS n__is_flapping, n.percent_state_change AS n__percent_state_change, n.latency AS n__latency, n.execution_time AS n__execution_time, n.scheduled_downtime_depth AS n__scheduled_downtime_depth, n.failure_prediction_enabled AS n__failure_prediction_enabled, n.process_performance_data AS n__process_performance_data, n.obsess_over_host AS n__obsess_over_host, n.modified_host_attributes AS n__modified_host_attributes, n.event_handler AS n__event_handler, n.check_command AS n__check_command, n.normal_check_interval AS n__normal_check_interval, n.retry_check_interval AS n__retry_check_interval, n.check_timeperiod_object_id AS n__check_timeperiod_object_id, n3.host_id AS n3__host_id, n3.alias AS n3__alias, n3.address AS n3__address, n3.notes AS n3__notes, n3.notes_url AS n3__notes_url, n3.action_url AS n3__action_url, n3.icon_image AS n3__icon_image, n3.icon_image_alt AS n3__icon_image_alt, n4.instance_id AS n4__instance_id, n4.instance_name AS n4__instance_name, n5.service_id AS n5__service_id, n5.service_object_id AS n5__service_object_id, n5.display_name AS n5__display_name, n6.host_graph_id AS n6__host_graph_id, n6.local_graph_id AS n6__local_graph_id, n2.name1 AS n2__0 FROM npc_hoststatus n LEFT JOIN npc_objects n2 ON n.host_object_id = n2.object_id LEFT JOIN npc_hosts n3 ON n.host_object_id = n3.host_object_id LEFT JOIN npc_instances n4 ON n.instance_id = n4.instance_id LEFT JOIN npc_services n5 ON n.host_object_id = n5.host_object_id LEFT JOIN npc_host_graphs n6 ON n.host_object_id = n6.host_object_id WHERE (n.current_state in (0, 1, 2, 3, -1) AND n3.config_type = 1) ORDER BY n4.instance_name ASC, n2__0 ASC [_tableAliasMap:protected] => Array ( [n] => hs [n2] => o [n3] => h [n4] => i [n5] => s [n6] => g ) [_view:protected] => [_state:protected] => 1 [_params:protected] => Array ( [join] => Array ( ) [where] => Array ( ) [set] => Array ( ) [having] => Array ( ) ) [_resultCache:protected] => [_expireResultCache:protected] => [_resultCacheTTL:protected] => [_queryCache:protected] => [_expireQueryCache:protected] => [_queryCacheTTL:protected] => [_conn:protected] => Doctrine_Connection_Mysql Object ( [driverName:protected] => Mysql [dbh:protected] => PDO Object ( ) [tables:protected] => Array ( [NpcHoststatus] => Doctrine_Table Object ( [_data:protected] => Array ( ) [_identifier:protected] => hoststatus_id [_identifierType:protected] => 1
pulsartec
Posts: 1
Joined: Fri Oct 30, 2009 4:19 am

Solution to hosts/services/groups filtering by logged user

Post by pulsartec »

Hi, we have implemented a solution in order to allow the access to view hosts/services/hostgroups/hostservices in NPC only to the Nagios contacts of the corresponding hosts/services.

We have done changes in the following files of NPC:

models/NpcHosts.php
models/NpcServices.php
models/NpcHostgroupMembers.php
models/NpcServicegroupMembers.php

controllers/hosts.php -> function hosts()
controllers/services.php -> function services()
controllers/hostgroups.php -> function getHostgroups()
controllers/servicegroups.php -> function getServicegroups()

Requirements:
* Cacti with BuiltIn authentication method
* Same usernames in Cacti than those of the ALIAS tag in contacts.cfg of Nagios

Changes in models/NpcHosts.php:
* Add the line: $this->hasMany('NpcHostContacts as HostContact', array('local' => 'host_id', 'foreign' => 'host_id'));

Changes in models/NpcServices.php:
* Add the line: $this->hasOne('NpcServiceContacts as ServiceContact', array('local' => 'service_id', 'foreign' => 'service_id'));

Changes in models/NpcHostgroupMembers.php:
* $this->hasOne('NpcHosts as Hosts', array('local' => 'host_object_id', 'foreign' => 'host_object_id'));

Changes in models/NpcServicegroupMembers.php:
* $this->hasOne('NpcServices as Services', array('local' => 'service_object_id', 'foreign' => 'service_object_id'));

Changes in controllers / hosts.php, services.php, hostgroups.php and servicegroups.php:
* include_once("CACTI_PATH/include/config.php"); //for direct database connection to cacti DB
* new query to get the contact_object_id of the Cacti logged user
* modify the Doctrine query to join more required tables and include the new condition of the contact_object_id in the WHERE section of the DB query
Attachments
npc-filterbyuser-oct09.tgz
(7.74 KiB) Downloaded 265 times
aaronnicoli
Posts: 33
Joined: Tue May 05, 2009 7:28 pm

No data in NPC cacti section

Post by aaronnicoli »

Hi people,

I have just installed NPC on our existing Cacti setup it looks great however I have some issues...

I have no errors on the NPC tab, imports to the DB are working fab, by first Unix Socket, now TCP. and Nagios is not crashing great start...

However, in the NPC tab I cannot see any data in the fields, no hosts found no services etc..

I do get the green on Nagios, Notifications, Host Checks and Service Checks, but everything else is "no ..." etc...., same thing in the N2C, I get no hosts....

Now, in devices however, I have the drop down all populated with my nagios hosts, (proving once again I do have data in my tables, as I can see it from the cli also). They come up in the dropdown as default: Hostname etc.

But I cannot work out why nothing in the NPC tab is working...

Any help please, I have been at this all day!

Thanks in advance :)
aaronnicoli
Posts: 33
Joined: Tue May 05, 2009 7:28 pm

More info

Post by aaronnicoli »

Sorry for the bump guys, but I have some more information...

I thought I would install Centreon as a test to see if I can get the Nagios data into there, as it also uses the same ndo2db, so i went created second ndo configs added a new broker to nagios config and started a second ndo poller.

Restarted everything Nagios, httpd etc and same as NPC, I have all the data now being entered into both the Cacti - npc_ and Centreon SQL DB's, the conninfo table shows INITIAL connects and that the tables are populated...

However, same thing with Centreon as NPC, nothing shows up in the interface, no hosts or services or anything etc.

I am really surprised by this, it seems like I might have an NDO2DB problem rather than an NPC problem, is anyone still able to help or know of a contact to speak to about the issues I am having...?

Thanks again,
ponwude
Posts: 4
Joined: Sat Oct 03, 2009 2:17 am

no DATA in NPC

Post by ponwude »

Hi all, I have bin struggling with NPC and Cacti for 4 days now.

I followed all the instructions in http://trac2.assembla.com/npc/wiki/QuickStartGuide.

My Nagios looks ok and is monitoring the localhost. but i nothing shows up on the NPC side.

my setup is

Cacti 0.8.7e
Ubuntu 9.04
NPC 2.0.4
nagios 3.2.0
ndoutils 1.4b7 (i have tried with versions b8 and b9, no luck)

i have attached screenshots of my dashboard and nagios services page.

Please any help would be greatly appreciated. i honestly do not know where to start troubleshooting from.
Attachments
Dashboard
Dashboard
dashboard.jpg (136.31 KiB) Viewed 7458 times
Nagios Page
Nagios Page
New Picture (2).jpg (153.69 KiB) Viewed 7458 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest