Skip to content

Commit 8e4264b

Browse files
committed
Fixing issue with poller replication
1 parent 6f0a559 commit 8e4264b

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ Got any ideas or complaints, please log an issue on GitHub.
5151

5252
## Changelog
5353

54+
--- develop ---
55+
56+
* issue: Fix issue with replication full sync errors
57+
5458
--- 1.1 ---
5559

5660
* feature#3: When changing UPS snmp and other settings on the UPS edit page, transfer those changes to the Cacti device

setup.php

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,15 +314,28 @@ function apcupsd_config_settings () {
314314
}
315315

316316
function apcupsd_replicate_out($data) {
317+
global $config;
318+
317319
include_once($config['base_path'] . '/lib/poller.php');
318320

319-
$data = db_fetch_assoc('SELECT * FROM apcupsd_ups');
321+
$pollers = db_fetch_assoc_prepared('SELECT id
322+
FROM poller
323+
WHERE id > 1
324+
AND disabled = ""
325+
AND status NOT IN (?, ?)',
326+
array(POLLER_STATUS_DOWN, POLLER_STATUS_HEARTBEAT));
320327

321-
replicate_out_table($data['rcnn_id'], $data, 'apcupsd_ups', $data['remote_poller_id']);
328+
$ups = db_fetch_assoc('SELECT * FROM apcupsd_ups');
329+
$ups_stats = db_fetch_assoc('SELECT * FROM apcupsd_ups_stats');
322330

323-
$data = db_fetch_assoc('SELECT * FROM apcupsd_ups_stats');
331+
if (cacti_sizeof($pollers)) {
332+
foreach($pollers as $poller) {
333+
$rcnn_id = poller_connect_to_remote($poller['id']);
324334

325-
replicate_out_table($data['rcnn_id'], $data, 'apcupsd_ups_stats', $data['remote_poller_id']);
335+
replicate_out_table($rcnn_id, $ups, 'apcupsd_ups', $poller['id']);
336+
replicate_out_table($rcnn_id, $ups_stats, 'apcupsd_ups', $poller['id']);
337+
}
338+
}
326339

327340
return $data;
328341
}

0 commit comments

Comments
 (0)