Link to home
Create AccountLog in
Avatar of Tigloo Sein
Tigloo SeinFlag for Spain

asked on

Nagios-Centreon - Visualization problems. non-admin users

Hi all!!

First of all, sorry for my english.

I'm having a problem with non-admin users visualization. We have Centreon 2.6.1 with Nagios core 3.4.1

We have three admin users to manage Centreon and several non-admin users to check alerts.

If we generate new hosts/services, those non-admin users can't see them, I know that there is a delay between the engine starts and when de users can see the new host/services. The problema appers here, because the non-admin users can't see those new items, in some cases, if we wait some hours (from 7 min to 48 hours) the new services appears, but therre are some new services that never appears...

If we add admin privileges to those users, the can see the new hosts/services, so it's seems to be an ACL problem. We've analised the logs, cron jobs, etc... we've cleaned ACLs, I've created new ones, but nothing...

We've tried to recover from an old snapshot, but the problem persists.

We've realized that non-admin users can't see admin comments.

We detected some corrupted tables and tried to repair them with myisamchk -r -v -f

centACL.log:

No log handling enabled - turning on stderr logging
Bad operator (INTEGER): At line 73 in /usr/share/mibs/ietf/SNMPv2-PDU
Undefined OBJECT-GROUP (diffServMIBMultiFieldClfrGroup): At line 2195 in /usr/share/mibs/ietf/IPSEC-SPD-MIB
Undefined OBJECT-GROUP (diffServMultiFieldClfrNextFree): At line 2157 in /usr/share/mibs/ietf/IPSEC-SPD-MIB
Undefined OBJECT-GROUP (diffServMIBMultiFieldClfrGroup): At line 2062 in /usr/share/mibs/ietf/IPSEC-SPD-MIB
Unlinked OID in IPATM-IPMC-MIB: marsMIB ::= { mib-2 57 }
Undefined identifier: mib-2 near line 18 of /usr/share/mibs/ietf/IPATM-IPMC-MIB
Expected "::=" (RFC5644): At line 493 in /usr/share/mibs/iana/IANA-IPPM-METRICS-REGISTRY-MIB
Expected "{" (EOF): At line 651 in /usr/share/mibs/iana/IANA-IPPM-METRICS-REGISTRY-MIB
Bad object identifier: At line 651 in /usr/share/mibs/iana/IANA-IPPM-METRICS-REGISTRY-MIB
Bad parse of OBJECT-IDENTITY: At line 651 in /usr/share/mibs/iana/IANA-IPPM-METRICS-REGISTRY-MIB
PHP Fatal error: Call to undefined method DB_Error::fetchRow() in /usr/share/centreon/cron/centAcl.php on line 429
No log handling enabled - turning on stderr logging
Bad operator (INTEGER): At line 73 in /usr/share/mibs/ietf/SNMPv2-PDU
Undefined OBJECT-GROUP (diffServMIBMultiFieldClfrGroup): At line 2195 in /usr/share/mibs/ietf/IPSEC-SPD-MIB
Undefined OBJECT-GROUP (diffServMultiFieldClfrNextFree): At line 2157 in /usr/share/mibs/ietf/IPSEC-SPD-MIB
Undefined OBJECT-GROUP (diffServMIBMultiFieldClfrGroup): At line 2062 in /usr/share/mibs/ietf/IPSEC-SPD-MIB
Unlinked OID in IPATM-IPMC-MIB: marsMIB ::= { mib-2 57 }
Undefined identifier: mib-2 near line 18 of /usr/share/mibs/ietf/IPATM-IPMC-MIB
Expected "::=" (RFC5644): At line 493 in /usr/share/mibs/iana/IANA-IPPM-METRICS-REGISTRY-MIB
Expected "{" (EOF): At line 651 in /usr/share/mibs/iana/IANA-IPPM-METRICS-REGISTRY-MIB
Bad object identifier: At line 651 in /usr/share/mibs/iana/IANA-IPPM-METRICS-REGISTRY-MIB
Bad parse of OBJECT-IDENTITY: At line 651 in /usr/share/mibs/iana/IANA-IPPM-METRICS-REGISTRY-MIB
[2016-04-06 13:12:02] According to DB another instance of centAcl.php is already running and I found 0 process...
Executing query: UPDATE cron_operation SET running = 0 WHERE id = '2'

Open in new window


There is something I thing is rare, when I check cron_operations:

mysql> select * from cron_operation;
+----+--------------------+---------+-------------+-------------------+--------+--------+---------+-------+--------
| id | name | command | time_launch | last_modification | system | module | running | pid | last_ex
+----+--------------------+---------+-------------+-------------------+--------+--------+---------+-------+--------
| 2 | centAcl.php | NULL | 1459940283 | 0 | 1 | NULL | 1 | NULL |
| 3 | nagiosPerfTrace | NULL | 1459940101 | 0 | 1 | NULL | 1 | 23132 |
| 4 | logAnalyser | NULL | 1459940341 | 0 | 1 | NULL | 1 | 24184 |
| 5 | dashboardBuilder | NULL | 1459915202 | 0 | 1 | NULL | 1 | 16155 |
| 6 | eventReportBuilder | NULL | 1459904401 | 0 | 1 | NULL | 1 | 17493 |
| 7 | logAnalyzer | NULL | 1440685105 | 0 | 1 | NULL | 0 | NULL |
| 8 | centstorage_purge | NULL | 1459900801 | 0 | 1 | NULL | 1 | 29205 |
+----+--------------------+---------+-------------+-------------------+--------+--------+---------+-------+--------
7 rows in set (0.00 sec)

mysql> select * from cron_operation;
+----+--------------------+---------+-------------+-------------------+--------+--------+---------+-------+--------
| id | name | command | time_launch | last_modification | system | module | running | pid | last_ex
+----+--------------------+---------+-------------+-------------------+--------+--------+---------+-------+--------
| 2 | centAcl.php | NULL | 1459940283 | 0 | 1 | NULL | 0 | NULL |
| 3 | nagiosPerfTrace | NULL | 1459940401 | 0 | 1 | NULL | 1 | 24531 |
| 4 | logAnalyser | NULL | 1459940401 | 0 | 1 | NULL | 1 | 24529 |
| 5 | dashboardBuilder | NULL | 1459915202 | 0 | 1 | NULL | 1 | 16155 |
| 6 | eventReportBuilder | NULL | 1459904401 | 0 | 1 | NULL | 1 | 17493 |
| 7 | logAnalyzer | NULL | 1440685105 | 0 | 1 | NULL | 0 | NULL |
| 8 | centstorage_purge | NULL | 1459900801 | 0 | 1 | NULL | 1 | 29205 |
+----+--------------------+---------+-------------+-------------------+--------+--------+---------+-------+--------
7 rows in set (0.00 sec)

Open in new window


I can't understand if centACL.php is running why it doesn't have a PID associated.

centstorage.log:

2016-04-06 12:53:17 - Unknown timestamp format or in future: [SERVICEPERFDATA]
2016-04-06 12:53:17 - Unknown timestamp format or in future: [SERVICEPERFDATA]
2016-04-06 12:53:17 - Unknown timestamp format or in future: [SERVICEPERFDATA]
2016-04-06 12:54:17 - Unknown timestamp format or in future: [SERVICEPERFDATA]
2016-04-06 12:55:17 - Unknown timestamp format or in future: [SERVICEPERFDATA]
2016-04-06 12:55:17 - Unknown timestamp format or in future: [SERVICEPERFDATA]
2016-04-06 12:56:07 - Cannot open /usr/local/nagios/var/service-perfdata_read file : Permission denied
2016-04-06 12:58:17 - Unknown timestamp format or in future: [SERVICEPERFDATA]
2016-04-06 12:58:17 - Unknown timestamp format or in future: [SERVICEPERFDATA]
2016-04-06 12:59:17 - MySQL error: Duplicate entry '32-100' for key 'host_service_unique_id' (caller: centreon::centstorage::CentstoragePool:/usr/share/perl5/centreon/centstorage/CentstoragePool.pm:503)
Query: INSERT INTO `index_data` (`host_name`, `service_description`, `host_id`, `service_id`, `special`, `storage_type`) VALUES ('_Module_Meta', 'meta_1', 32, 100, '1', '2')

Open in new window


How can it be possible, there is no database selected?

sql-error.log:

2016-04-06 12:55|0|0|DB Error: no database selected QUERY : SELECT id, user_id FROM session WHERE session_id LIKE '_session_id_XXXXX_'
2016-04-06 12:55|0|0|DB Error: no database selected QUERY : SELECT user_id FROM session WHERE session_id = '_session_id_XXXXX_'
2016-04-06 12:58|0|0|DB Error: no database selected QUERY : SELECT acl_res_id, hg_id FROM hostgroup, acl_resources_hg_relations
WHERE acl_resources_hg_relations.hg_hg_id = hostgroup.hg_id
2016-04-06 13:02|0|0|DB Error: no database selected QUERY : SELECT acl_res_id, hg_id FROM hostgroup, acl_resources_hg_relations
WHERE acl_resources_hg_relations.hg_hg_id = hostgroup.hg_id
2016-04-06 13:06|0|0|DB Error: no database selected QUERY : SELECT acl_res_id, hg_id FROM hostgroup, acl_resources_hg_relations
WHERE acl_resources_hg_relations.hg_hg_id = hostgroup.hg_id
2016-04-06 13:10|0|0|DB Error: no database selected QUERY : SELECT acl_res_id, hg_id FROM hostgroup, acl_resources_hg_relations
WHERE acl_resources_hg_relations.hg_hg_id = hostgroup.hg_id
2016-04-06 13:14|0|0|DB Error: no database selected QUERY : SELECT acl_res_id, hg_id FROM hostgroup, acl_resources_hg_relations
WHERE acl_resources_hg_relations.hg_hg_id = hostgroup.hg_id

Open in new window


centcore.log:

2016-04-06 13:14:44 - MySQL error: MySQL server has gone away (caller: centreon:cript::centcore:/usr/share/perl5/centreon/script/centcore.pm:313)
Query: SELECT * FROM `nagios_server` WHERE `id` = '1' AND `ns_activate` = '1' LIMIT 1

2016-04-06 13:14:44 - Error when getting server properties
2016-04-06 13:14:44 - Ip address not defined for poller 1
2016-04-06 13:15:56 - MySQL error: MySQL server has gone away (caller: centreon:cript::centcore:/usr/share/perl5/centreon/script/centcore.pm:1022)
Query: SELECT * FROM options WHERE `key` IN ('enable_perfdata_sync', 'enable_logs_sync', 'centcore_cmd_timeout', 'enable_broker_stats')

2016-04-06 13:16:56 - MySQL error: MySQL server has gone away (caller: centreon:cript::centcore:/usr/share/perl5/centreon/script/centcore.pm:1022)
Query: SELECT * FROM options WHERE `key` IN ('enable_perfdata_sync', 'enable_logs_sync', 'centcore_cmd_timeout', 'enable_broker_stats')

2016-04-06 13:17:56 - MySQL error: MySQL server has gone away (caller: centreon:: script::centcore:/usr/share/perl5/centreon/script/centcore.pm:1022)
Query: SELECT * FROM options WHERE `key` IN ('enable_perfdata_sync', 'enable_logs_sync', 'centcore_cmd_timeout', 'enable_broker_stats')

2016-04-06 13:18:56 - MySQL error: MySQL server has gone away (caller: centreon:: script::centcore:/usr/share/perl5/centreon/script/centcore.pm:1022)
Query: SELECT * FROM options WHERE `key` IN ('enable_perfdata_sync', 'enable_logs_sync', 'centcore_cmd_timeout', 'enable_broker_stats')

2016-04-06 13:19:56 - MySQL error: MySQL server has gone away (caller: centreon:: script::centcore:/usr/share/perl5/centreon/script/centcore.pm:1022)
Query: SELECT * FROM options WHERE `key` IN ('enable_perfdata_sync', 'enable_logs_sync', 'centcore_cmd_timeout', 'enable_broker_stats')

2016-04-06 13:20:56 - MySQL error: MySQL server has gone away (caller: centreon:: script::centcore:/usr/share/perl5/centreon/script/centcore.pm:1022)
Query: SELECT * FROM options WHERE `key` IN ('enable_perfdata_sync', 'enable_logs_sync', 'centcore_cmd_timeout', 'enable_broker_stats')

Open in new window


I had search the web, but I didn't find nothing that solve the problem.

If we change a host/service name that non-admin users could see, then they stop seeing it.

Any clue? any comment? any help?

Thanks in advance

Regards,
Juanma.
ASKER CERTIFIED SOLUTION
Avatar of Tigloo Sein
Tigloo Sein
Flag of Spain image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Tigloo Sein

ASKER

It seems to work correctly.
Hi all.

The bad new is that system performance is not the reason of that problem, because the consumption of resources is low and the problem has appeared again.

# uptime
  09:55:22 up 2 days, 19:36,  1 user,  load average: 1.51, 0.99, 0.73

Open in new window


# free -m
             total       used       free     shared    buffers     cached
Mem:          7450       2542       4907          0        204       1317
-/+ buffers/cache:       1020       6429
Swap:            0          0          0

Open in new window


The good new is that the problem is about database insertion, because those new services aren't added to centreon_acl table, so no user has permissions to read them. centACL.php

The real problem is that i don't know how to solve it, because the code seems to be OK, isn't it?

PHP Fatal error:  Call to undefined method DB_Error::fetchRow() in /usr/share/centreon/cron/centAcl.php on line 430

        $query = "SELECT acl_res_id, hg_id FROM hostgroup, acl_resources_hg_relations
    			  WHERE acl_resources_hg_relations.hg_hg_id = hostgroup.hg_id";
        $res = $pearDB->query($query);
        $hgResCache = array();
        while ($row = $res->fetchRow()) {
            if (!isset($hgResCache[$row['acl_res_id']])) {
                $hgResCache[$row['acl_res_id']] = array();
            }
            $hgResCache[$row['acl_res_id']][] = $row['hg_id'];
        }

Open in new window


Any help?

Regards,
Juanma.
Hi all

As a little workaround, we've disconnected the server from internet for about 5 minuts, by this way the centACL could update the database, the problem is that is not a solution for the problem.

If anybody has some clue, or a definitely solution, it could be great!!


Regards,
Juanma.
Hi all.

The problem still remains, the workaround don't work anymore.

I've been searching more clues and the problem seems to be obvious, a connection database problem, but I don't know how to solve it, can anybody help me :


/var/log/centreon/centAcl.log:

    nbProc 1 [2016-07-20 09:12:02] More than one centAcl.php process currently running. Going to exit...
    PHP Fatal error:  Call to undefined method DB_Error::fetchRow() in /usr/share/centreon/cron/centAcl.php on line 429
    nbProc 0 [2016-07-20 09:14:01] According to DB another instance of centAcl.php is already running and I found 0 pr$
    Executing query: UPDATE cron_operation SET running = 0 WHERE id =  '2'
    nbProc 0 nbProc 1 [2016-07-20 09:16:01] More than one centAcl.php process currently running. Going to exit...
    PHP Fatal error:  Call to undefined method DB_Error::fetchRow() in /usr/share/centreon/cron/centAcl.php on line 429
    nbProc 0 [2016-07-20 09:17:24] According to DB another instance of centAcl.php is already running and I found 0  process...
    Executing query: UPDATE cron_operation SET running = 0 WHERE id =  '2'
    nbProc 0 PHP Fatal error:  Call to undefined method DB_Error::fetchRow() in /usr/share/centreon/cron/centAcl.php on line 429
    nbProc 0 PHP Fatal error:  Call to undefined method DB_Error::fetchRow() in /usr/share/centreon/cron/centAcl.php on line 429
    nbProc 0 [2016-07-20 09:20:01] According to DB another instance of centAcl.php is already running and I found 0  process...
    Executing query: UPDATE cron_operation SET running = 0 WHERE id =  '2'
    nbProc 0 PHP Fatal error:  Call to undefined method DB_Error::fetchRow() in /usr/share/centreon/cron/centAcl.php on line 429
    nbProc 0 [2016-07-20 09:24:01] According to DB another instance of centAcl.php is already running and I found 0  process...
    Executing query: UPDATE cron_operation SET running = 0 WHERE id =  '2'
    nbProc 0 PHP Fatal error:  Call to undefined method DB_Error::fetchRow() in /usr/share/centreon/cron/centAcl.php on line 429
    nbProc 0 [2016-07-20 09:28:01] According to DB another instance of centAcl.php is already running and I found 0  process...
    Executing query: UPDATE cron_operation SET running = 0 WHERE id =  '2'

Open in new window


/var/log/centreon/centcore.log

    2016-07-20 09:34:22 - MySQL error: MySQL server has gone away (caller: centreon::script::centcore:/usr/share/perl5/centreon/script/centcore.pm:1022)
    Query: SELECT * FROM options WHERE `key` IN ('enable_perfdata_sync', 'enable_logs_sync', 'centcore_cmd_timeout', 'enable_broker_stats')

    2016-07-20 09:35:22 - MySQL error: MySQL server has gone away (caller: centreon::script::centcore:/usr/share/perl5/centreon/script/centcore.pm:1022)
    Query: SELECT * FROM options WHERE `key` IN ('enable_perfdata_sync', 'enable_logs_sync', 'centcore_cmd_timeout', 'enable_broker_stats')

Open in new window


/usr/share/perl5/centreon/script/centcore.pm:1022

############################################
## Check Centcore Configuration Profile
#
sub checkProfile() {
    my $self = shift;

    my $request = "SELECT * FROM options WHERE `key` IN ('enable_perfdata_sync', 'enable_logs_sync', 'centcore_cmd_timeout', 'enable_broker_stats')";
   my ($status, $sth) =  $self->{centreon_dbc}->query($request);
    return -1 if ($status == -1);
    while ((my $data = $sth->fetchrow_hashref())) {
        if (defined($data->{key}) && $data->{key} ne "" && defined($data->{value}) && $data->{value} ne "") {
            if ($data->{key} eq "enable_perfdata_sync") {
                $self->{perfdataSync} = $data->{value};
            }
            if ($data->{key} eq "enable_logs_sync") {
                $self->{logSync} = $data->{value};
            }
            if ($data->{key} eq "centcore_cmd_timeout") {
                $self->{cmd_timeout} = $data->{value};
            }
            if ($data->{key} eq "enable_broker_stats") {
                $self->{enable_broker_stats} = $data->{value};
            }
        }
    }
    return 0;
}

Open in new window


/var/log/centreon/sql-error.log:

    2016-07-20 09:48|0|0|DB Error: no database selected QUERY : SELECT acl_res_id, hg_id FROM hostgroup, acl_resources_hg_relations  WHERE acl_resources_hg_relations.hg_hg_id = hostgroup.hg_id
    2016-07-20 09:49|0|0|DB Error: no database selected QUERY : SELECT acl_res_id, hg_id FROM hostgroup, acl_resources_hg_relations  WHERE acl_resources_hg_relations.hg_hg_id = hostgroup.hg_id

Open in new window


Thank you in advance.

Regards,
Juanma.
One of the posible solutions:

/etc/mysql/my.conf

#wait_timeout = 30
wait_timeout = 300
#connect_timeout = 10
connect_timeout = 30

I hope this solve the problem.

Regards,
Juanma.
Avatar of Kooky Kooky
Kooky Kooky

Hi,

Thank you for the Blog.

I have problem with the ACL in Centreon.
I Use 2.6.3 version.

I have a user group, despite the fact I define the "Hosts Ressources", the users in the group can see all the hosts
While I put only 3 hosts (I have more than 20 hosts) in the selected object. It's like the "Hosts Ressources" has not been taken into account

Administration -->ACL--> Resources Access, then Hosts Resources.


An idea?