NPC - Nagios Plugin for Cacti

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: NPC - Nagios Plugin for Cacti

Post by TheWitness »

This is so funny "Console tab of the Debug Window", not the Cacti console tab. Lol
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Tiki10
Posts: 10
Joined: Tue Apr 07, 2020 4:06 am

Re: NPC - Nagios Plugin for Cacti

Post by Tiki10 »

Oh Damn, you are right. I'm feeling really stupid :D
Please find the correct screenshot.

Kind regards,

Tiki
Attachments
SnapCrab_NoName_2020-4-9_10-10-30_No-00.png
SnapCrab_NoName_2020-4-9_10-10-30_No-00.png (129.46 KiB) Viewed 4609 times
User avatar
Osiris
Cacti Guru User
Posts: 1424
Joined: Mon Jan 05, 2015 10:10 am

Re: NPC - Nagios Plugin for Cacti

Post by Osiris »

There is a setting in 1.2.11 that allows you to ease the CSP for this plugin. It's on the general tab towards the bottom. Be careful upgrading as users have reported loving errors due to a new setting in config.php that was supposed to be commented out. $cacti_cookie_domain.
Before history, there was a paradise, now dust.
Tiki10
Posts: 10
Joined: Tue Apr 07, 2020 4:06 am

Re: NPC - Nagios Plugin for Cacti

Post by Tiki10 »

Hello,

I upgraded and activate the option in general tab.
In configuration/extension, the plugin is shown as installed but not activated. When I activate it, the plugin is deactivated few secondes after (or when I refresh my page).
I have no more the npc tab in configuration/setup/ but I still have the npc tab at the top of the page.
I ll try to contact the author on his github. This plugin could be a really alternative to Nagios GUI.

Thank for your help.

Tiki
Attachments
SnapCrab_NoName_2020-4-10_11-59-9_No-00.png
SnapCrab_NoName_2020-4-10_11-59-9_No-00.png (134.06 KiB) Viewed 4608 times
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: NPC - Nagios Plugin for Cacti

Post by TheWitness »

There will be errors in the cacti.log. post them.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Tiki10
Posts: 10
Joined: Tue Apr 07, 2020 4:06 am

Re: NPC - Nagios Plugin for Cacti

Post by Tiki10 »

Hello TheWitness,

This the most relevant information I've found in logs.

Code: Select all

2020/04/10 14:48:33 - ERROR PHP ERROR in  Plugin 'npc': Uncaught Doctrine_Connection_Exception: PDO Connection Error: SQLSTATE[HY000] [1045] Access denied for user 'cactiuser'@'localhost' (using password: YES) in /var/www/cacti/site/plugins/npc/lib/Doctrine/Connection.php:471 Stack trace: #0 /var/www/cacti/site/plugins/npc/lib/Doctrine/Connection/Mysql.php(101): Doctrine_Connection->connect() #1 /var/www/cacti/site/plugins/npc/lib/Doctrine/Connection.php(1009): Doctrine_Connection_Mysql->connect() #2 /var/www/cacti/site/plugins/npc/lib/Doctrine/Connection.php(808): Doctrine_Connection->execute('SELECT COUNT(*)...', Array) #3 /var/www/cacti/site/plugins/npc/lib/Doctrine/Query.php(1894): Doctrine_Connection->fetchAll('SELECT COUNT(*)...', Array) #4 /var/www/cacti/site/plugins/npc/lib/Doctrine/Pager.php(108): Doctrine_Query->count(Array) #5 /var/www/cacti/site/plugins/npc/lib/Doctrine/Pager.php(570): Doctrine_Pager->_initialize(Array) #6 /var/www/cacti/site/plugins/npc/controllers/hosts.php(217): Doctrine_Pager->execute(Array, 3) #7 /var/www/cacti/site/plugins/npc/co in file: /var/www/cacti/site/plugins/npc/lib/Doctrine/Connection.php on line: 471
2020/04/10 14:48:33 - CMDPHP PHP ERROR Backtrace:  (CactiShutdownHandler())
2020/04/10 14:48:33 - CMDPHP ERRORS DETECTED - DISABLING PLUGIN 'npc'
The fact is I can't find where I should setup login.

Kind regards,

Tiki
Last edited by Tiki10 on Fri Apr 10, 2020 9:10 am, edited 1 time in total.
Tiki10
Posts: 10
Joined: Tue Apr 07, 2020 4:06 am

Re: NPC - Nagios Plugin for Cacti

Post by Tiki10 »

Hello,

For records, there are missing column in tables npc_hosts and npc_services.
You have to add "importance" after "address" in npc_hosts (int 11), and "importance" after "display_name" in npc_services (int 11).

Now, my table npc_hosts is feeded after restarting ndo2db and nagios
Tiki
Tiki10
Posts: 10
Joined: Tue Apr 07, 2020 4:06 am

Re: NPC - Nagios Plugin for Cacti

Post by Tiki10 »

Hello,

I've found where was the problem : In include/config.php, rdatabase_* must be filled.

Thank you for all.

Kind regards,

Tiki
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: NPC - Nagios Plugin for Cacti

Post by TheWitness »

Post the updated table structure:

SHOW CREATE TABLE table_name;
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Tiki10
Posts: 10
Joined: Tue Apr 07, 2020 4:06 am

Re: NPC - Nagios Plugin for Cacti

Post by Tiki10 »

Please find table structure :

npc_hosts :

Code: Select all

| npc_hosts | CREATE TABLE `npc_hosts` (
  `host_id` int(11) NOT NULL AUTO_INCREMENT,
  `instance_id` smallint(6) NOT NULL DEFAULT '0',
  `config_type` smallint(6) NOT NULL DEFAULT '0',
  `host_object_id` int(11) NOT NULL DEFAULT '0',
  `alias` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `display_name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `address` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `importance` int(11) NOT NULL DEFAULT '0',
  `check_command_object_id` int(11) NOT NULL DEFAULT '0',
  `check_command_args` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `eventhandler_command_object_id` int(11) NOT NULL DEFAULT '0',
  `eventhandler_command_args` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `notification_timeperiod_object_id` int(11) NOT NULL DEFAULT '0',
  `check_timeperiod_object_id` int(11) NOT NULL DEFAULT '0',
  `failure_prediction_options` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `check_interval` double NOT NULL DEFAULT '0',
  `retry_interval` double NOT NULL DEFAULT '0',
  `max_check_attempts` smallint(6) NOT NULL DEFAULT '0',
  `first_notification_delay` double NOT NULL DEFAULT '0',
  `notification_interval` double NOT NULL DEFAULT '0',
  `notify_on_down` smallint(6) NOT NULL DEFAULT '0',
  `notify_on_unreachable` smallint(6) NOT NULL DEFAULT '0',
  `notify_on_recovery` smallint(6) NOT NULL DEFAULT '0',
  `notify_on_flapping` smallint(6) NOT NULL DEFAULT '0',
  `notify_on_downtime` smallint(6) NOT NULL DEFAULT '0',
  `stalk_on_up` smallint(6) NOT NULL DEFAULT '0',
  `stalk_on_down` smallint(6) NOT NULL DEFAULT '0',
  `stalk_on_unreachable` smallint(6) NOT NULL DEFAULT '0',
  `flap_detection_enabled` smallint(6) NOT NULL DEFAULT '0',
  `flap_detection_on_up` smallint(6) NOT NULL DEFAULT '0',
  `flap_detection_on_down` smallint(6) NOT NULL DEFAULT '0',
  `flap_detection_on_unreachable` smallint(6) NOT NULL DEFAULT '0',
  `low_flap_threshold` double NOT NULL DEFAULT '0',
  `high_flap_threshold` double NOT NULL DEFAULT '0',
  `process_performance_data` smallint(6) NOT NULL DEFAULT '0',
  `freshness_checks_enabled` smallint(6) NOT NULL DEFAULT '0',
  `freshness_threshold` smallint(6) NOT NULL DEFAULT '0',
  `passive_checks_enabled` smallint(6) NOT NULL DEFAULT '0',
  `event_handler_enabled` smallint(6) NOT NULL DEFAULT '0',
  `active_checks_enabled` smallint(6) NOT NULL DEFAULT '0',
  `retain_status_information` smallint(6) NOT NULL DEFAULT '0',
  `retain_nonstatus_information` smallint(6) NOT NULL DEFAULT '0',
  `notifications_enabled` smallint(6) NOT NULL DEFAULT '0',
  `obsess_over_host` smallint(6) NOT NULL DEFAULT '0',
  `failure_prediction_enabled` smallint(6) NOT NULL DEFAULT '0',
  `notes` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `notes_url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `action_url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `icon_image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `icon_image_alt` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `vrml_image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `statusmap_image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `have_2d_coords` smallint(6) NOT NULL DEFAULT '0',
  `x_2d` smallint(6) NOT NULL DEFAULT '0',
  `y_2d` smallint(6) NOT NULL DEFAULT '0',
  `have_3d_coords` smallint(6) NOT NULL DEFAULT '0',
  `x_3d` double NOT NULL DEFAULT '0',
  `y_3d` double NOT NULL DEFAULT '0',
  `z_3d` double NOT NULL DEFAULT '0',
  PRIMARY KEY (`host_id`),
  UNIQUE KEY `instance_id` (`instance_id`,`config_type`,`host_object_id`),
  KEY `idx1` (`host_object_id`),
  KEY `idx2` (`config_type`)
) ENGINE=InnoDB AUTO_INCREMENT=582 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Host definitions' |

and npc_services :

Code: Select all

| npc_services | CREATE TABLE `npc_services` (
  `service_id` int(11) NOT NULL AUTO_INCREMENT,
  `instance_id` smallint(6) NOT NULL DEFAULT '0',
  `config_type` smallint(6) NOT NULL DEFAULT '0',
  `host_object_id` int(11) NOT NULL DEFAULT '0',
  `service_object_id` int(11) NOT NULL DEFAULT '0',
  `display_name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `importance` int(11) NOT NULL DEFAULT '0',
  `check_command_object_id` int(11) NOT NULL DEFAULT '0',
  `check_command_args` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `eventhandler_command_object_id` int(11) NOT NULL DEFAULT '0',
  `eventhandler_command_args` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `notification_timeperiod_object_id` int(11) NOT NULL DEFAULT '0',
  `check_timeperiod_object_id` int(11) NOT NULL DEFAULT '0',
  `failure_prediction_options` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `check_interval` double NOT NULL DEFAULT '0',
  `retry_interval` double NOT NULL DEFAULT '0',
  `max_check_attempts` smallint(6) NOT NULL DEFAULT '0',
  `first_notification_delay` double NOT NULL DEFAULT '0',
  `notification_interval` double NOT NULL DEFAULT '0',
  `notify_on_warning` smallint(6) NOT NULL DEFAULT '0',
  `notify_on_unknown` smallint(6) NOT NULL DEFAULT '0',
  `notify_on_critical` smallint(6) NOT NULL DEFAULT '0',
  `notify_on_recovery` smallint(6) NOT NULL DEFAULT '0',
  `notify_on_flapping` smallint(6) NOT NULL DEFAULT '0',
  `notify_on_downtime` smallint(6) NOT NULL DEFAULT '0',
  `stalk_on_ok` smallint(6) NOT NULL DEFAULT '0',
  `stalk_on_warning` smallint(6) NOT NULL DEFAULT '0',
  `stalk_on_unknown` smallint(6) NOT NULL DEFAULT '0',
  `stalk_on_critical` smallint(6) NOT NULL DEFAULT '0',
  `is_volatile` smallint(6) NOT NULL DEFAULT '0',
  `flap_detection_enabled` smallint(6) NOT NULL DEFAULT '0',
  `flap_detection_on_ok` smallint(6) NOT NULL DEFAULT '0',
  `flap_detection_on_warning` smallint(6) NOT NULL DEFAULT '0',
  `flap_detection_on_unknown` smallint(6) NOT NULL DEFAULT '0',
  `flap_detection_on_critical` smallint(6) NOT NULL DEFAULT '0',
  `low_flap_threshold` double NOT NULL DEFAULT '0',
  `high_flap_threshold` double NOT NULL DEFAULT '0',
  `process_performance_data` smallint(6) NOT NULL DEFAULT '0',
  `freshness_checks_enabled` smallint(6) NOT NULL DEFAULT '0',
  `freshness_threshold` smallint(6) NOT NULL DEFAULT '0',
  `passive_checks_enabled` smallint(6) NOT NULL DEFAULT '0',
  `event_handler_enabled` smallint(6) NOT NULL DEFAULT '0',
  `active_checks_enabled` smallint(6) NOT NULL DEFAULT '0',
  `retain_status_information` smallint(6) NOT NULL DEFAULT '0',
  `retain_nonstatus_information` smallint(6) NOT NULL DEFAULT '0',
  `notifications_enabled` smallint(6) NOT NULL DEFAULT '0',
  `obsess_over_service` smallint(6) NOT NULL DEFAULT '0',
  `failure_prediction_enabled` smallint(6) NOT NULL DEFAULT '0',
  `notes` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `notes_url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `action_url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `icon_image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `icon_image_alt` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  PRIMARY KEY (`service_id`),
  UNIQUE KEY `instance_id` (`instance_id`,`config_type`,`service_object_id`),
  KEY `idx1` (`config_type`),
  KEY `idx2` (`host_object_id`),
  KEY `idx3` (`service_object_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2138 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Service definitions' |
Some tables, in cacti databases, needs to be altered like that too

Code: Select all

ALTER TABLE `npc_hostchecks` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
ALTER TABLE `npc_hoststatus` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
ALTER TABLE `npc_servicechecks` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
ALTER TABLE `npc_servicestatus` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
ALTER TABLE `npc_statehistory` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
ALTER TABLE `npc_eventhandlers` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
ALTER TABLE `npc_systemcommands` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
ALTER TABLE `npc_notifications` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
The easiest way to compare is to create a nagios_test database with ndo2db tools and the npc_* with npc tools then compare.

Kind regards,

Tiki
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests