After installing a poller in version 23.10, I cannot start the centreontrapd service because of the following error, do you have any idea how to correct this?
2024-05-02 11:35:31 - ERROR - 1654796 - MySQL error: no such table: cfg_nagios (caller: centreon::script::centreontrapd:/usr/share/perl5/vendor_perl/centreon/script/centreontrapd.pm:1233) Query: SELECT `command_file` FROM `cfg_nagios` WHERE `nagios_activate` = '1' LIMIT 1
OS : Redhat 8.8
cdt
Page 1 / 1
Hi @rachidkh on poller centreontrapd use a SQLite database.
You need to configure on your poller the /etc/centreon/centreontrapd.pm file:
but, the centreontrapd service does not start and I still get this error:
2024-05-03 15:02:25 - ERROR - 1312732 - MySQL error: no such table: cfg_nagios (caller: centreon::script::centreontrapd:/usr/share/perl5/vendor_perl/centreon/script/centreontrapd.pm:1233) Query: SELECT `command_file` FROM `cfg_nagios` WHERE `nagios_activate` = '1' LIMIT 1
Regards
What is the content of /etc/centreon/conf.pm on your poller?
The content of this file it’s empty
Hello,
I have the same problem with Centreon 24.04 on Debian 12, from packages.
When I manually launch the service with debug on the Poller:
su - centreon -s/bin/bash -c "/usr/share/centreon/bin/centreontrapd --logfile=/var/log/centreon/centreontrapd.log --severity=debug --config=/etc/centreon/conf.pm --config-extra=/etc/centreon/centreontrapd.pm"
/var/log/centreon/centreontrapd.log:
2024-05-22 14:29:22 - INFO - 472530 - ********** Net-SNMP version 5.0903 Perl module enabled ********** 2024-05-22 14:29:22 - DEBUG - 472530 - ********** MIBS: ********** 2024-05-22 14:29:22 - DEBUG - 472530 - centreontrapd launched.... 2024-05-22 14:29:22 - DEBUG - 472530 - PID: 472530 2024-05-22 14:29:22 - INFO - 472530 - Mode: poller 2024-05-22 14:29:22 - ERROR - 472530 - MySQL error: no such table: cfg_nagios (caller: centreon::script::centreontrapd:/usr/share/perl5/centreon/script/centreontrapd.pm:1233) Query: SELECT `command_file` FROM `cfg_nagios` WHERE `nagios_activate` = '1' LIMIT 1
2024-05-22 14:29:22 - INFO - 472530 - Can't call method "fetchrow_array" on an undefined value at /usr/share/perl5/centreon/script/centreontrapd.pm line 1234.
2024-05-22 14:29:22 - INFO - 472530 - Main process exit.
As a temporary workaround, I modified /usr/share/perl5/centreon/script/centreontrapd.pm at line 1232:
# Dirty!!! Need to know the poller (not Dirty if you use SQLite database) my ($status, $sth) = $self->{cdb}->query("SELECT `command_file` FROM `cfg_nagios` WHERE `nagios_activate` = '1' LIMIT 1"); my @conf = $sth->fetchrow_array(); $self->{cmdFile} = $conf[0];
by:
# Dirty!!! Need to know the poller (not Dirty if you use SQLite database) if ($self->{centreontrapd_config}->{mode} == 0) { my ($status, $sth) = $self->{cdb}->query("SELECT `command_file` FROM `cfg_nagios` WHERE `nagios_activate` = '1' LIMIT 1"); my @conf = $sth->fetchrow_array(); $self->{cmdFile} = $conf[0]; } elsif ($self->{centreontrapd_config}->{mode} == 1) { $self->{cmdFile} = '/var/lib/centreon-engine/rw/centengine.cmd'; }
→ If DB mode is set to 1 (Poller), then cmdFile directly takes the value /var/lib/centreon-engine/rw/centengine.cmd without making the SQL query. So, I can start the service.
It's just waiting for a fix or the solution, I don't think it's a viable solution over time.
Hi, if you start centreontrapd on a poller, you need a sqlite database generated from “Configuration > SNMP Traps > Generate” menu.
@rachidkh@Nyxtorm it was a fresh installation of Centreon on Debian 12?
@rachidkh@Nyxtorm this has been fixed with 24.04.1, sorry for the inconvenience.
Hi @Laurent,
Central => Upgraded from previous Centreon major release
Poller => Fresh installation
Unfortunately, Configuration > SNMP Traps > Generate is only available on Central and does not offer other pollers in the drop-down list.
Also, the status when attempting the manipulation on the Central in spite of everything :
Database generation Poller (id:1): Sqlite database successfully created
Centcore commands Poller (id:1): SYNCTRAP sent to centcore.cmd Poller (id:1): RESTARTCENTREONTRAPD sent to centcore.cmd
“sent to centcore.cmd” => but this file no longer exists
On my poller, /etc/centreon/centreontrapd.pm is already set to mode 1 (Poller) and my SQLite databases exist, but /usr/share/perl5/centreon/script/centreontrapd.pm on poller still tries to launch the SQL query despite mode 1. (It’s trying to connect to localhost:3306 but it shouldn’t if it’s a poller only, or I haven't quite understood what it needs.
On your central, mode = 0 in /etc/centreon/centreontrapd.pm file?
Did you restarted centreontrapd process?
It is normal that centcore.cmd doesn’t exist, this file is deleted each time Gorgoned read it.
@Laurent,
On your central, mode = 0 in /etc/centreon/centreontrapd.pm file?
Yes, mode is set to 0 here, there’s no problem with centreontrapd service on my Central, only on fresh install for new poller.
Did you restarted centreontrapd process?
On poller, yes, several times, it’s able run only since I have edited /usr/share/perl5/centreon/script/centreontrapd.pm.
It is normal that centcore.cmd doesn’t exist, this file is deleted each time Gorgoned read it.
Thank your for the explanation about this file.
Hello,
After the last update (24.04.2), Centreon has overwritten my /usr/share/perl5/centreon/script/centreontrapd.pm file on my poller.
This reblocked the startup of centreontrapd.service. I had to reapply my modification mentioned above to be able to relaunch the service.
Hello,
i get the same error
how did you fix it ?
i’m on 24.04
is by doing update to 24.04.2 ?
Hi @jamal ,
My temporary workaround is available in this post here:
Hi @rachidkh,
Please don't forget to click on the “Best Answer” button for the solution that helped you resolve your issue. Alternatively, you can share how you were able to solve the problem.
Your input will greatly help others facing similar challenges in finding solutions.
Thank you,
thank you
pb fixed but i still get another error related to sqllite DB: i will create a new post
Hello,
I had the same issue. I Solved it by setting the correct permissions on /etc/snmp/centreon_traps/centreontrapd.sdb
was : centreon:centreon -rw-r--r--
now : centreon-gorgone:centreon-gorgone -rw-r--r--
When I generate the database, the file changes. Before it didn’t.
Hello Guys, If you have same error in /var/log/centreon/centreontrapd.log showing ERROR - 930 - MySQL error: no such table: cfg_nagios (caller: centreon::script::centreontrapd:/usr/share/perl5/vendor_perl/centreon/script/centreontrapd.pm:1233) Query: SELECT `command_file` FROM `cfg_nagios` WHERE `nagios_activate` = '1' LIMIT 1
follow these steps 1) check owner of file /etc/snmp/centreon_traps/centreontrapd.sdb it should be centreon-gorgeon:centreon-gorgone
2) In centreon Configuration > SNMP Traps > Generate generate trap 3) check centreontrapd is started