Spine poller not working on remote pollers

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
smcline06
Posts: 27
Joined: Mon Apr 22, 2013 1:30 pm

Spine poller not working on remote pollers

Post by smcline06 »

Greetings! First off I wanted to say thank you so much for the hard work and improvements on Cacti 1.0+

I have been messing with getting Cacti and remote pollers working, though am having some issues with the process. This is on the following systems:

Centos 7
PHP Version 5.4
MySQL Version 5.7

Standalone (Master Instance):
Works fine with CMD or Spine poller. No issues when adding devices and using Boost.

Code: Select all

2017-02-27 11:11:03 - SYSTEM STATS: Time:2.3084 Method:spine Processes:1 Threads:4 Hosts:3 HostsPerProcess:3 DataSources:20 RRDsProcessed:0
2017-02-27 11:10:04 - SYSTEM STATS: Time:2.2906 Method:spine Processes:1 Threads:4 Hosts:3 HostsPerProcess:3 DataSources:24 RRDsProcessed:0
2017-02-27 11:09:03 - SYSTEM STATS: Time:2.3311 Method:spine Processes:1 Threads:4 Hosts:3 HostsPerProcess:3 DataSources:23 RRDsProcessed:0
2017-02-27 11:08:04 - SYSTEM STATS: Time:2.3171 Method:spine Processes:1 Threads:4 Hosts:4 HostsPerProcess:4 DataSources:42 RRDsProcessed:0
2017-02-27 11:07:04 - SYSTEM STATS: Time:2.2863 Method:spine Processes:1 Threads:4 Hosts:4 HostsPerProcess:4 DataSources:42 RRDsProcessed:0
When enabling a remote poller, it shows up correctly and syncs without any issues. The moment I move a device to that poller however spine does not appear to complete a run.

Code: Select all

2017-02-27 11:11:00 - SYSTEM STATS: Time:59.3897 Method:spine Processes:1 Threads:4 Hosts:1 HostsPerProcess:1 DataSources:22 RRDsProcessed:0
2017-02-27 11:11:00 - POLLER: Poller[2] Maximum runtime of 58 seconds exceeded. Exiting.
2017-02-27 11:10:01 - SYSTEM STATS: Time:59.4283 Method:spine Processes:1 Threads:4 Hosts:1 HostsPerProcess:1 DataSources:22 RRDsProcessed:0
2017-02-27 11:10:01 - POLLER: Poller[2] Maximum runtime of 58 seconds exceeded. Exiting.
2017-02-27 11:08:01 - SYSTEM STATS: Time:0.0714 Method:spine Processes:1 Threads:4 Hosts:0 HostsPerProcess:0 DataSources:0 RRDsProcessed:0
2017-02-27 11:07:02 - SYSTEM STATS: Time:0.0991 Method:spine Processes:1 Threads:4 Hosts:0 HostsPerProcess:0 DataSources:0 RRDsProcessed:0
2017-02-27 11:06:01 - SYSTEM STATS: Time:0.0768 Method:spine Processes:1 Threads:4 Hosts:0 HostsPerProcess:0 DataSources:0 RRDsProcessed:0
Enabling debugging does not show any other errors or issues, graphs on master no longer update (poller has correct credentials and access to master mysql server/table). When changing the poller to CMD things appear to work and finish correctly. This was off Cacti 1.0.3 and 1.0.4

This is all being tested under docker containers (will be releasing on docker hub for others to use once I can get the remote polling working correctly). The example above is 1min cron, 1min polling cycle. The same occurs when using 5minute cron/poller.

I would like to know if this is a known issue or if there are some additional troubleshooting commands I can run to get more information on the errors.
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: Spine poller not working on remote pollers

Post by cigamit »

I would run the remote spine manually to see what is causing the hang up. I was playing around with my remote poller last night and ran into a similar issue since I just copied a newly compiled spine binary from the master to the remote instead of recompiling it locally.
smcline06
Posts: 27
Joined: Mon Apr 22, 2013 1:30 pm

Re: Spine poller not working on remote pollers

Post by smcline06 »

Thanks for the reply, I am wondering if I am not understanding the spine configuration correctly.

My setup is as follows (hope this is clear).
Screen Shot 2017-02-27 at 11.54.12 AM.png
Screen Shot 2017-02-27 at 11.54.12 AM.png (60.09 KiB) Viewed 3921 times

On the master instance spine config is the following (expecting RDB variables to not be in-use)

Code: Select all

DB_Host                 db-master
DB_Database             cacti_master
DB_User                 cactiuser
DB_Pass                 cactipassword
DB_Port                 3306

RDB_Host                localhost
RDB_Database            cacti
RDB_User                cactiuser
RDB_Pass                cactipassword
RDB_Port                3306
Spine dry-run with two attached devices

Code: Select all

 [root@4d4e5cef6512 /]# /spine/bin/spine -R -V 3 -C /spine/etc/spine.conf 
SPINE: Using spine config file [/spine/etc/spine.conf]
SPINE: Version 1.0.3 starting
2017-02-27 11:56:37 - SPINE: Poller[1] NOTE: Spine will support multithread device polling.
2017-02-27 11:56:37 - SPINE: Poller[1] Device[1] TH[1] NOTE: There are '1' Polling Items for this Device
2017-02-27 11:56:37 - SPINE: Poller[1] Device[1] TH[1] DS[1] SCRIPT: perl /cacti/scripts/unix_processes.pl, output: 22
2017-02-27 11:56:37 - SPINE: Poller[1] Device[1] TH[1] Total Time: 0.036 Seconds
2017-02-27 11:56:37 - SPINE: Poller[1] Updating Full System Information Table
2017-02-27 11:56:37 - SPINE: Poller[1] Device[3] TH[1] Recache DataQuery[1] OID: .1.3.6.1.2.1.1.3.0, output: 1354395176
2017-02-27 11:56:37 - SPINE: Poller[1] Device[3] TH[1] Recache DataQuery[8] OID: .1.3.6.1.2.1.1.3.0, output: 1354395176
2017-02-27 11:56:37 - SPINE: Poller[1] Device[3] TH[1] NOTE: There are '22' Polling Items for this Device
2017-02-27 11:56:37 - SPINE: Poller[1] Device[3] TH[1] DS[63] SS[0] SERVER: /cacti/scripts/ss_host_disk.php ss_host_disk 10.20.2.214 3 2:161:500:1:10:b55r4nt5s0:::::: get used '1', output: 125540352
2017-02-27 11:56:37 - SPINE: Poller[1] Device[3] TH[1] DS[63] SS[1] SERVER: /cacti/scripts/ss_host_disk.php ss_host_disk 10.20.2.214 3 2:161:500:1:10:b55r4nt5s0:::::: get total '1', output: 193046528
2017-02-27 11:56:37 - SPINE: Poller[1] Device[3] TH[1] DS[68] SS[0] SERVER: /cacti/scripts/ss_host_disk.php ss_host_disk 10.20.2.214 3 2:161:500:1:10:b55r4nt5s0:::::: get used '6', output: 37007360
2017-02-27 11:56:37 - SPINE: Poller[1] Device[3] TH[1] DS[68] SS[1] SERVER: /cacti/scripts/ss_host_disk.php ss_host_disk 10.20.2.214 3 2:161:500:1:10:b55r4nt5s0:::::: get total '6', output: 37007360
2017-02-27 11:56:37 - SPINE: Poller[1] Device[3] TH[1] DS[73] SS[0] SERVER: /cacti/scripts/ss_host_disk.php ss_host_disk 10.20.2.214 3 2:161:500:1:10:b55r4nt5s0:::::: get used '11', output: 47820800
2017-02-27 11:56:38 - SPINE: Poller[1] Device[3] TH[1] DS[73] SS[1] SERVER: /cacti/scripts/ss_host_disk.php ss_host_disk 10.20.2.214 3 2:161:500:1:10:b55r4nt5s0:::::: get total '11', output: 47820800
2017-02-27 11:56:38 - SPINE: Poller[1] Device[3] TH[1] DS[78] SS[0] SERVER: /cacti/scripts/ss_host_disk.php ss_host_disk 10.20.2.214 3 2:161:500:1:10:b55r4nt5s0:::::: get used '16', output: 4096
2017-02-27 11:56:38 - SPINE: Poller[1] Device[3] TH[1] DS[78] SS[1] SERVER: /cacti/scripts/ss_host_disk.php ss_host_disk 10.20.2.214 3 2:161:500:1:10:b55r4nt5s0:::::: get total '16', output: 4096
2017-02-27 11:56:38 - SPINE: Poller[1] Device[3] TH[1] DS[83] SS[0] SERVER: /cacti/scripts/ss_host_disk.php ss_host_disk 10.20.2.214 3 2:161:500:1:10:b55r4nt5s0:::::: get used '21', output: 1024
2017-02-27 11:56:38 - SPINE: Poller[1] Device[3] TH[1] DS[83] SS[1] SERVER: /cacti/scripts/ss_host_disk.php ss_host_disk 10.20.2.214 3 2:161:500:1:10:b55r4nt5s0:::::: get total '21', output: 1024
2017-02-27 11:56:38 - SPINE: Poller[1] Device[3] TH[1] DS[88] SNMP: v2: 10.20.2.214, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.8, value: 0
2017-02-27 11:56:38 - SPINE: Poller[1] Device[3] TH[1] DS[88] SNMP: v2: 10.20.2.214, dsname: traffic_out, oid: .1.3.6.1.2.1.2.2.1.16.8, value: 0
2017-02-27 11:56:38 - SPINE: Poller[1] Device[3] TH[1] DS[93] SNMP: v2: 10.20.2.214, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.33, value: 3466039117
2017-02-27 11:56:38 - SPINE: Poller[1] Device[3] TH[1] DS[93] SNMP: v2: 10.20.2.214, dsname: traffic_out, oid: .1.3.6.1.2.1.2.2.1.16.33, value: 2946938689
2017-02-27 11:56:38 - SPINE: Poller[1] Device[3] TH[1] DS[98] SNMP: v2: 10.20.2.214, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.39, value: 316603
2017-02-27 11:56:38 - SPINE: Poller[1] Device[3] TH[1] DS[98] SNMP: v2: 10.20.2.214, dsname: traffic_out, oid: .1.3.6.1.2.1.2.2.1.16.39, value: 9481
2017-02-27 11:56:38 - SPINE: Poller[1] Device[3] TH[1] DS[102] SNMP: v2: 10.20.2.214, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.51, value: 0
2017-02-27 11:56:38 - SPINE: Poller[1] Device[3] TH[1] DS[102] SNMP: v2: 10.20.2.214, dsname: traffic_out, oid: .1.3.6.1.2.1.2.2.1.16.51, value: 0
2017-02-27 11:56:38 - SPINE: Poller[1] Device[3] TH[1] DS[107] SNMP: v2: 10.20.2.214, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.504, value: 1671576070
2017-02-27 11:56:38 - SPINE: Poller[1] Device[3] TH[1] DS[107] SNMP: v2: 10.20.2.214, dsname: traffic_out, oid: .1.3.6.1.2.1.2.2.1.16.504, value: 1543831270
2017-02-27 11:56:38 - SPINE: Poller[1] Device[3] TH[1] DS[112] SNMP: v2: 10.20.2.214, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.509, value: 988591624
2017-02-27 11:56:38 - SPINE: Poller[1] Device[3] TH[1] DS[112] SNMP: v2: 10.20.2.214, dsname: traffic_out, oid: .1.3.6.1.2.1.2.2.1.16.509, value: 2193924844
2017-02-27 11:56:38 - SPINE: Poller[1] Device[3] TH[1] Total Time:   1.5 Seconds
2017-02-27 11:56:38 - SPINE: Poller[1] Time: 1.7333 s, Threads: 4, Devices: 2
Remote poller Spine settings:

Code: Select all


DB_Host                 db-poller
DB_Database             cacti_poller
DB_User                 cactiuser
DB_Pass                 cactipassword
DB_Port                 3306

RDB_Host                db-master
RDB_Database            cacti_master
RDB_User                cactiuser
RDB_Pass                cactipassword
RDB_Port                3306
Dryrun of spine with poller ID of 2

Code: Select all

MYSQL: Connection Failed: Error:'1044', Message:'Access denied for user 'cactiuser'@'%' to database 'cacti_poller''
MYSQL: Connection Failed: Error:'1044', Message:'Access denied for user 'cactiuser'@'%' to database 'cacti_poller''
MYSQL: Connection Failed: Error:'1044', Message:'Access denied for user 'cactiuser'@'%' to database 'cacti_poller''
MYSQL: Connection Failed: Error:'1044', Message:'Access denied for user 'cactiuser'@'%' to database 'cacti_poller''
MYSQL: Connection Failed: Error:'1044', Message:'Access denied for user 'cactiuser'@'%' to database 'cacti_poller''
MYSQL: Connection Failed: Error:'1044', Message:'Access denied for user 'cactiuser'@'%' to database 'cacti_poller''
MYSQL: Connection Failed: Error:'1044', Message:'Access denied for user 'cactiuser'@'%' to database 'cacti_poller''
MYSQL: Connection Failed: Error:'1044', Message:'Access denied for user 'cactiuser'@'%' to database 'cacti_poller''
MYSQL: Connection Failed: Error:'1044', Message:'Access denied for user 'cactiuser'@'%' to database 'cacti_poller''
MYSQL: Connection Failed: Error:'1044', Message:'Access denied for user 'cactiuser'@'%' to database 'cacti_poller''
2017-02-27 11:58:17 - SPINE: Poller[2] FATAL: Connection Failed, Error:'1044', Message:'Access denied for user 'cactiuser'@'%' to database 'cacti_poller'' (Spine init)
Mysql connection test:

Code: Select all

[root@038956b2bdf4 /]# mysql -u cactiuser -pcactipassword cacti_poller -h db-poller
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 1526
Server version: 5.7.17 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [cacti_poller]> show tables;
+-------------------------------------+
| Tables_in_cacti_poller              |
+-------------------------------------+
| aggregate_graph_templates           |
| aggregate_graph_templates_graph     |
| aggregate_graph_templates_item      |
| aggregate_graphs                    |
| aggregate_graphs_graph_item         |
| aggregate_graphs_items              |
| automation_devices                  |
| automation_graph_rule_items         |
| automation_graph_rules              |
| automation_ips                      |
| automation_match_rule_items         |
| automation_networks                 |
| automation_processes                |
| automation_snmp                     |
| automation_snmp_items               |
| automation_templates                |
| automation_tree_rule_items          |
| automation_tree_rules               |
| cdef                                |
| cdef_items                          |
| color_template_items                |
| color_templates                     |
| colors                              |
| data_input                          |
| data_input_data                     |
| data_input_fields                   |
| data_local                          |
| data_source_profiles                |
| data_source_profiles_cf             |
| data_source_profiles_rra            |
| data_source_purge_action            |
| data_source_purge_temp              |
| data_source_stats_daily             |
| data_source_stats_hourly            |
| data_source_stats_hourly_cache      |
| data_source_stats_hourly_last       |
| data_source_stats_monthly           |
| data_source_stats_weekly            |
| data_source_stats_yearly            |
| data_template                       |
| data_template_data                  |
| data_template_rrd                   |
| external_links                      |
| graph_local                         |
| graph_template_input                |
| graph_template_input_defs           |
| graph_templates                     |
| graph_templates_gprint              |
| graph_templates_graph               |
| graph_templates_item                |
| graph_tree                          |
| graph_tree_items                    |
| host                                |
| host_graph                          |
| host_snmp_cache                     |
| host_snmp_query                     |
| host_template                       |
| host_template_graph                 |
| host_template_snmp_query            |
| plugin_config                       |
| plugin_db_changes                   |
| plugin_hooks                        |
| plugin_realms                       |
| poller                              |
| poller_command                      |
| poller_data_template_field_mappings |
| poller_item                         |
| poller_output                       |
| poller_output_boost                 |
| poller_output_boost_processes       |
| poller_output_realtime              |
| poller_reindex                      |
| poller_resource_cache               |
| poller_time                         |
| reports                             |
| reports_items                       |
| sessions                            |
| settings                            |
| settings_tree                       |
| settings_user                       |
| settings_user_group                 |
| sites                               |
| snmp_query                          |
| snmp_query_graph                    |
| snmp_query_graph_rrd                |
| snmp_query_graph_rrd_sv             |
| snmp_query_graph_sv                 |
| snmpagent_cache                     |
| snmpagent_cache_notifications       |
| snmpagent_cache_textual_conventions |
| snmpagent_managers                  |
| snmpagent_managers_notifications    |
| snmpagent_mibs                      |
| snmpagent_notifications_log         |
| user_auth                           |
| user_auth_cache                     |
| user_auth_group                     |
| user_auth_group_members             |
| user_auth_group_perms               |
| user_auth_group_realm               |
| user_auth_perms                     |
| user_auth_realm                     |
| user_domains                        |
| user_domains_ldap                   |
| user_log                            |
| vdef                                |
| vdef_items                          |
| version                             |
+-------------------------------------+
108 rows in set (0.00 sec)
Remote MySQL test

Code: Select all

[root@038956b2bdf4 /]# mysql -u cactiuser -pcactipassword cacti_master -h db-master      
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 3199
Server version: 5.7.17 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [cacti_master]> 
Does or is spine trying to write what should be its local "poller" database to the remote host?
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: Spine poller not working on remote pollers

Post by cigamit »

You have the DB Info swapped in your spine config. On the Remote Poller, your local DB goes in the regular settings, and the Master goes in the remote settings. I should probably note that somewhere.
smcline06
Posts: 27
Joined: Mon Apr 22, 2013 1:30 pm

Re: Spine poller not working on remote pollers

Post by smcline06 »

Hrmm, that is how I have the remote poller settings are though.

Remote poller's local database name is cacti_poller on host db-poller.
Master instance local database name is cacti_master on host db-master.

The remote poller has the following spine config under this setup

Code: Select all

DB_Host                 db-poller
DB_Database             cacti_poller
DB_User                 cactiuser
DB_Pass                 cactipassword
DB_Port                 3306

RDB_Host                db-master
RDB_Database            cacti_master
RDB_User                cactiuser
RDB_Pass                cactipassword
RDB_Port                3306
smcline06
Posts: 27
Joined: Mon Apr 22, 2013 1:30 pm

Re: Spine poller not working on remote pollers

Post by smcline06 »

What is somewhat interesting is when performing a dry run of spine as poller-id of 2. Getting mysql access errors:

Code: Select all

[root@c7bc5dacad06 /]# /spine/bin/spine -C /spine/etc/spine.conf -V 4 -p 2 -R -S
SPINE: Using spine config file [/spine/etc/spine.conf]
MYSQL: Connection Failed: Error:'1044', Message:'Access denied for user 'cactiuser'@'%' to database 'cacti_poller''
MYSQL: Connection Failed: Error:'1044', Message:'Access denied for user 'cactiuser'@'%' to database 'cacti_poller''
MYSQL: Connection Failed: Error:'1044', Message:'Access denied for user 'cactiuser'@'%' to database 'cacti_poller''
MYSQL: Connection Failed: Error:'1044', Message:'Access denied for user 'cactiuser'@'%' to database 'cacti_poller''
MYSQL: Connection Failed: Error:'1044', Message:'Access denied for user 'cactiuser'@'%' to database 'cacti_poller''
MYSQL: Connection Failed: Error:'1044', Message:'Access denied for user 'cactiuser'@'%' to database 'cacti_poller''
MYSQL: Connection Failed: Error:'1044', Message:'Access denied for user 'cactiuser'@'%' to database 'cacti_poller''
MYSQL: Connection Failed: Error:'1044', Message:'Access denied for user 'cactiuser'@'%' to database 'cacti_poller''
MYSQL: Connection Failed: Error:'1044', Message:'Access denied for user 'cactiuser'@'%' to database 'cacti_poller''
MYSQL: Connection Failed: Error:'1044', Message:'Access denied for user 'cactiuser'@'%' to database 'cacti_poller''
2017-02-27 15:36:48 - SPINE: Poller[2] FATAL: Connection Failed, Error:'1044', Message:'Access denied for user 'cactiuser'@'%' to database 'cacti_poller'' (Spine init)
Though a mysql command works just fine from the os, any hints if this is possibly the issue at hand?

Code: Select all

[root@c7bc5dacad06 /]# mysql -u cactiuser -pcactipassword -h db-poller cacti_poller
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 50
Server version: 5.7.17 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Its almost as if spine has a bug on which database to hit, if I change the target to the remote master database host using what should be the local database I do get an appropriate error (since cacti_poller database does not exist on the remote master host).

Code: Select all

[root@c7bc5dacad06 /]# mysql -u cactiuser -pcactipassword -h db-master cacti_poller
ERROR 1044 (42000): Access denied for user 'cactiuser'@'%' to database 'cacti_poller'
smcline06
Posts: 27
Joined: Mon Apr 22, 2013 1:30 pm

Re: Spine poller not working on remote pollers

Post by smcline06 »

Ok, next update - I have gotten the remote poller dryrun to work but I had to place both databases on the same host and have the master and remote poller use the same login credentials
Screen Shot 2017-02-27 at 5.03.39 PM.png
Screen Shot 2017-02-27 at 5.03.39 PM.png (52.08 KiB) Viewed 3884 times
Unless this is part of the requirements (I hope its not since having the poller DB closer to the poller should have faster times) I believe there is a but in spine's placement of RDB variables. I skimmed through the code but never messed with C to really debug much. Going to open an issue on the spine github repo in any event :)

The following does not work due to spine's understanding of remote DB variables (something is getting swapped around).
Screen Shot 2017-02-27 at 5.03.50 PM.png
Screen Shot 2017-02-27 at 5.03.50 PM.png (51.55 KiB) Viewed 3884 times
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: Spine poller not working on remote pollers

Post by cigamit »

The 2nd scenario does work (its what I am using), it just seems more like a permission issue on your side as the error suggests.

I have seen MySQL get real wacky when using '%' as the hostname ever since 5.6. Do your grant again on the local db "cacti_poller" with @'localhost'.
smcline06
Posts: 27
Joined: Mon Apr 22, 2013 1:30 pm

Re: Spine poller not working on remote pollers

Post by smcline06 »

Unfortunately it did not change anything :( , when using root credentials however the error message was more telling - stating db_poller database does not exist.

Unless I am mistaken when the poller is "online" it should use the remote (in this case everything db_master) settings to write off-box. I added some additional logging to util.c and sql.c and am getting the following

Code: Select all

[root@ae1d26ecdb7d test]# /spine/bin/spine -C /spine/etc/spine.conf -V 4 -p 2 -R -S
SPINE: Using spine config file [/spine/etc/spine.conf]

RDB_Host: db
RDB_Database: cacti_master
RDB_User: cactiuser
RDB_Pass: cactipassword

---ONLINE---
hostname: db
set.rdbuser: cactiuser
set.rdbpass: cactipassword
database: cacti_poller
MYSQL: Connection Failed: Error:'1044', Message:'Access denied for user 'cactiuser'@'%' to database 'cacti_poller''

The first blob of txt is reporting what variables spine is taking in from util.c while the second is what spine is using when the poller reports online.

Config file given:

Code: Select all


DB_Host                 db02
DB_Database             cacti_poller
DB_User                 cactiuser
DB_Pass                 cactipassword
DB_Port                 3306

RDB_Host                db
RDB_Database            cacti_master
RDB_User                cactiuser
RDB_Pass                cactipassword
RDB_Port                3306
It appears to be using DB_Database when the poller is online and host/credential settings for RDB. I am guessing the following code change is required to use the proper database name

Original sql.c - start line 276, end 284

Code: Select all

		if (set.poller_id > 1) {
			if (set.mode == REMOTE_OFFLINE || set.mode == REMOTE_RECOVERY) {
				connect_error = mysql_real_connect(mysql, hostname, set.dbuser, set.dbpass, database, set.dbport, socket, 0);
			}else{
				connect_error = mysql_real_connect(mysql, hostname, set.rdbuser, set.rdbpass, database, set.rdbport, socket, 0);
			}
		}else{
			connect_error = mysql_real_connect(mysql, hostname, set.dbuser, set.dbpass, database, set.dbport, socket, 0);
		}
Line 280 database variable I think should be set.rdbdb instead of database

sql.c line 280 (proposed fix)

Code: Select all

connect_error = mysql_real_connect(mysql, hostname, set.rdbuser, set.rdbpass, set.rdbdb, set.rdbport, socket, 0);
I assume in your setup you have your master and remote server database named the same, if so thats likely why you are not seeing the issue :D

edit - spelling
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: Spine poller not working on remote pollers

Post by cigamit »

Yep good catch. Can you do a pull request with that? Otherwise I will see if I can get to it later tonight.
qdcocke
Posts: 12
Joined: Wed Jul 22, 2015 3:55 am

Re: Spine poller not working on remote pollers

Post by qdcocke »

I have the same problem with you. and I think this should be spine bug, even if the correct modification of the spine.conf ,the spine also does not work.
There are two ways to solve this problem(any method can solve the problem):
1. create a cactiuser user(must be cactiuser,the password also must be cactiuser) in the MySQL database and empower it:
mysql> grant all privileges on cacti.* to 'cactiuser'@'localhost' identified by 'cactiuser';

2. before configure the cacti-spine-1.1.3 source package,modify the spine.h file in the source package root directory , which the default user name is cactiuser and default password is cactiuser,modified to your correct value, and then compile and install
vi spine.h ##modified 【DEFAULT_DB_USER:cactiuser,DEFAULT_DB_PASS :cactiuser】 to your correct value
then
./configure
make
make install
cp /usr/local/spine/etc/spine.conf.dist /etc/spine.conf
vi /etc/spine.conf ##modified 【DB_User:cactiuser,DB_Pass:cactiuser】 to your correct value

Finally, execute
/usr/bin/php /var/www/cacti/poller.php --force
spine should be able to work properly.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest