NPC - Nagios Plugin for Cacti

General discussion about Plugins for Cacti

Moderators: Moderators, Developers

Author
Message
User avatar
Osiris
Cacti Pro User
Posts: 863
Joined: Mon Jan 05, 2015 10:10 am

Re: NPC - Nagios Plugin for Cacti

#16 Post by Osiris » Sun Jan 27, 2019 7:49 pm

Are there any indications of errors in the Cacti log? How about the standard error log?
Before history, there was a paradise, now dust.

boluser
Posts: 11
Joined: Sun Jan 13, 2019 11:46 am

Re: NPC - Nagios Plugin for Cacti

#17 Post by boluser » Tue Jan 29, 2019 11:53 am

Hi Osiris,
There are no errors in cacti.log.
But there are many errors in cacti_stderr.log.
Almost all are:" Cannot adopt OID in..." If you need me to upload the file, ask me.
Do you want me to look somewhere else?
Thank you so much for everything. Hopefully we can put it to work :lol:

netniV
Cacti Guru User
Posts: 2872
Joined: Sun Aug 27, 2017 12:05 am

Re: NPC - Nagios Plugin for Cacti

#18 Post by netniV » Wed Jan 30, 2019 2:27 pm

I would compress the file and then email it to [email protected] so that it can be reviewed.

boluser
Posts: 11
Joined: Sun Jan 13, 2019 11:46 am

Re: NPC - Nagios Plugin for Cacti

#19 Post by boluser » Thu Jan 31, 2019 10:33 am

Hi netniV,
As you recommend, I have sent the log to [email protected]
Yesterday I was reviewing the log in depth, and I found something:
In the cacti log, the following errors appear:
- ERROR PHP DEPRECATED in Plugin 'npc': Non-static method NpcHostgroupsController::getHostgroups() should not be called statically in file: /opt/cacti/plugins/npc/controllers/sync.php on line: 150
- CMDPHP PHP ERROR Backtrace: (/plugins/npc/npc.php[76]:NpcSyncController->listHostgroups(), /plugins/npc/controllers/sync.php[150]:CactiErrorHandler())
- ERROR PHP ERROR in Plugin 'npc': Uncaught Error: Using $this when not in object context in /opt/cacti/plugins/npc/controllers/hostgroups.php:332 Stack trace: #0 /opt/cacti/plugins/npc/controllers/sync.php(150): NpcHostgroupsController::getHostgroups() #1 /opt/cacti/plugins/npc/npc.php(76): NpcSyncController->listHostgroups(Array) #2 {main} thrown in file: /opt/cacti/plugins/npc/controllers/hostgroups.php on line: 332
- CMDPHP PHP ERROR Backtrace: (CactiShutdownHandler())
- CMDPHP ERRORS DETECTED - DISABLING PLUGIN 'npc'
** And I'm disabled the plugin, having to go back to Console -> Settings -> Plugins to re-enable it

And on the other hand, when I run the following command in the console:
sudo tail -f /var/log/syslog
I can see that the following error is repeated:
- ndo2db[13992]: mysql_error: 'Unknown column 'long_output' in 'field list''

Hope that helps. Thank you so much for everything!!

*I also attach the log that I have sent by email
Attachments
npc plugin log.zip
(33.39 KiB) Downloaded 24 times

User avatar
Osiris
Cacti Pro User
Posts: 863
Joined: Mon Jan 05, 2015 10:10 am

Re: NPC - Nagios Plugin for Cacti

#20 Post by Osiris » Sat Feb 02, 2019 9:44 pm

Due to your version of phone and doctrine. It's on my list of things to look at, but it's way down it. Likely works better on strait centos 7.
Before history, there was a paradise, now dust.

boluser
Posts: 11
Joined: Sun Jan 13, 2019 11:46 am

Re: NPC - Nagios Plugin for Cacti

#21 Post by boluser » Mon Feb 04, 2019 10:36 am

Hi Osiris,
Sorry for my ignorance, but I think that seeing the log is more likely to be a php problem, rather than the version. :oops:
I am currently using Ubuntu.
Thank you very much for the help!!

netniV
Cacti Guru User
Posts: 2872
Joined: Sun Aug 27, 2017 12:05 am

Re: NPC - Nagios Plugin for Cacti

#22 Post by netniV » Wed Feb 06, 2019 6:59 am

Might have been a mix up there but yea I would agree that this looks like a PHP problem. I have had it before when I switched a function from being an instance function to being a static but the code had a line that referenced $this. Not sure if that was the case with this, but I've just updated the two lines with what I believe to be the correct usage. See how you fair with the latest develop version.

boluser
Posts: 11
Joined: Sun Jan 13, 2019 11:46 am

Re: NPC - Nagios Plugin for Cacti

#23 Post by boluser » Fri Feb 08, 2019 1:58 pm

Hi netniV,
I downloaded the latest version, and it's more stable.
It still does not work, but there are fewer errors.
The errors that appear to me now are:
NPC DEBUG [NpcLayoutController] (drawLayout) - Script execution time: 0.00 seconds
NPC DEBUG [NpcNagiosController] (getProgramStatus) - Script execution time: 0.07 seconds
NPC DEBUG [NpcHostsController] (summary) - Script execution time: 0.00 seconds
NPC DEBUG [NpcHostgroupsController] (getHostgroupServiceStatus) - Script execution time: 0.00 seconds
NPC DEBUG [NpcServicesController] (summary) - Script execution time: 0.00 seconds
NPC DEBUG [NpcServicesController] (getServices) - Script execution time: 0.01 seconds
NPC DEBUG [NpcServicegroupsController] (getServicegroups) - Method execution time: 0.00 seconds
NPC DEBUG [NpcServicegroupsController] (getHostStatusPortlet) - Method execution time: 0.00 seconds
NPC DEBUG [NpcServicegroupsController] (getHostStatusPortlet) - Script execution time: 0.00 seconds
NPC DEBUG [NpcLogentriesController] (getLogs) - Script execution time: 0.01 seconds
NPC DEBUG [NpcServicegroupsController] (getServicegroups) - Method execution time: 0.00 seconds
NPC DEBUG [NpcServicegroupsController] (getServicegroupServiceStatus) - Method execution time: 0.00 seconds
NPC DEBUG [NpcServicegroupsController] (getServicegroupServiceStatus) - Script execution time: 0.00 seconds
NPC DEBUG [NpcHostgroupsController] (getHostgroupHostStatus) - Script execution time: 0.00 seconds
NPC DEBUG [NpcHostsController] (getHosts) - Script execution time: 0.01 seconds
NPC DEBUG [NpcNagiosController] (checkPerf) - Script execution time: 0.01 seconds
NPC DEBUG [NpcHostsController] (getHosts) - Script execution time: 0.01 seconds
NPC DEBUG [NpcCactiController] (getHostTemplates) - Script execution time: 0.02 seconds
NPC DEBUG [NpcSyncController] (listHostgroups) - Script execution time: 0.01 seconds
NPC DEBUG [NpcSyncController] (getHosts) - Script execution time: 0.00 seconds
NPC DEBUG [NpcHostsController] (getHosts) - Script execution time: 0.01 seconds
NPC DEBUG [NpcNagiosController] (getProgramStatus) - Script execution time: 0.00 seconds
NPC DEBUG [NpcHostsController] (getHosts) - Script execution time: 0.01 seconds
NPC DEBUG [NpcHostsController] (summary) - Script execution time: 0.00 seconds
NPC DEBUG [NpcServicesController] (summary) - Script execution time: 0.00 seconds
NPC DEBUG [NpcHostgroupsController] (getHostgroupServiceStatus) - Script execution time: 0.00 seconds
NPC DEBUG [NpcServicesController] (getServices) - Script execution time: 0.01 seconds
NPC DEBUG [NpcServicegroupsController] (getServicegroups) - Method execution time: 0.00 seconds
NPC DEBUG [NpcServicegroupsController] (getServicegroupServiceStatus) - Method execution time: 0.00 seconds
NPC DEBUG [NpcServicegroupsController] (getServicegroupServiceStatus) - Script execution time: 0.00 seconds
NPC DEBUG [NpcServicegroupsController] (getServicegroups) - Method execution time: 0.00 seconds
NPC DEBUG [NpcServicegroupsController] (getHostStatusPortlet) - Method execution time: 0.00 seconds
NPC DEBUG [NpcServicegroupsController] (getHostStatusPortlet) - Script execution time: 0.00 seconds
NPC DEBUG [NpcHostgroupsController] (getHostgroupHostStatus) - Script execution time: 0.00 seconds

I have looked in the cacti database, and it does not insert any data.
Could it be for some privilege of some folder or some executable? ¿Maybe nagios.cmd?
As a tip, I think it would be nice to introduce how the privileges are to be in the manual so that there is no doubt.
It would also be interesting to modify the document "upgrade_schema" and add "IF NOT EXISTS", leaving the structure as follows:
CREATE INDEX IF NOT EXISTS idx1 ON npc_logentries(entry_time, entry_time_usec);
CREATE INDEX IF NOT EXISTS idx1 ON npc_services(config_type);
CREATE INDEX IF NOT EXISTS idx2 ON npc_services(host_object_id);
CREATE INDEX IF NOT EXISTS idx3 ON npc_services(service_object_id);
CREATE INDEX IF NOT EXISTS idx1 ON npc_hosts(host_object_id);
CREATE INDEX IF NOT EXISTS idx2 ON npc_hosts(config_type);
CREATE INDEX IF NOT EXISTS idx1 ON npc_servicestatus(current_state);
CREATE INDEX IF NOT EXISTS idx1 ON npc_hoststatus(current_state);
CREATE INDEX IF NOT EXISTS idx1 ON npc_comments(object_id);
CREATE INDEX IF NOT EXISTS idx1 ON npc_host_graphs(host_object_id);
CREATE INDEX IF NOT EXISTS idx1 ON npc_service_graphs(service_object_id);
CREATE INDEX IF NOT EXISTS idx1 ON npc_servicechecks(service_object_id, start_time);
CREATE INDEX IF NOT EXISTS idx2 ON npc_servicechecks(instance_id, start_time);

We continue making tests. Everything to improve the plugin and start it up.
Thank you very much and greetings, :D

netniV
Cacti Guru User
Posts: 2872
Joined: Sun Aug 27, 2017 12:05 am

Re: NPC - Nagios Plugin for Cacti

#24 Post by netniV » Tue Feb 12, 2019 4:59 am

I would open that as an issue on the NPC plugin so it gets tracked. I only made a minor mod to the code because it's basic PHP functionality. I don't know much about how the plugin itself works as I've never worked on it (aside from the aforementioned minor tweakage).

Post Reply