Skip to content

Commit 23f6239

Browse files
committed
QA: Add instrumentation and fix one bug
* It appears that the join type was wrong.
1 parent feef911 commit 23f6239

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

poller_apcupsd.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@
8787
}
8888
}
8989

90+
print 'NOTE: APCUPSD Poller Process Starting.' . PHP_EOL;
91+
9092
$host_template_id = db_fetch_cell_prepared('SELECT id FROM host_template WHERE hash = ?', array($hash));
9193
$add_devices = true;
9294

@@ -98,7 +100,7 @@
98100
/* apcupsd upses first UPS */
99101
$upses = db_fetch_assoc_prepared('SELECT ups.*
100102
FROM apcupsd_ups AS ups
101-
INNER JOIN apcupsd_ups_stats AS stats
103+
LEFT JOIN apcupsd_ups_stats AS stats
102104
ON ups.id = stats.ups_id
103105
WHERE type_id = 1
104106
AND enabled = "on"
@@ -108,6 +110,8 @@
108110
$apcupsd = cacti_sizeof($upses);
109111

110112
if ($apcupsd > 0) {
113+
printf('NOTE: Found %s apcaccess enabled UPS\'s' . PHP_EOL, $apcupsd);
114+
111115
foreach($upses as $ups) {
112116
debug(sprintf('Collecting UPS Information for %s', $ups['name']));
113117

@@ -125,9 +129,10 @@
125129
add_ups_device($ups, $host_template_id);
126130
}
127131
}
132+
} else {
133+
printf('NOTE: Did not find any apcaccess enabled UPS\'s' . PHP_EOL);
128134
}
129135

130-
131136
/* apcupsd upses first UPS */
132137
$upses = db_fetch_assoc('SELECT *
133138
FROM apcupsd_ups
@@ -137,6 +142,8 @@
137142
$snmpupses = cacti_sizeof($upses);
138143

139144
if ($snmpupses > 0) {
145+
printf('NOTE: Found %s snmp enabled UPS\'s' . PHP_EOL, $apcupsd);
146+
140147
foreach($upses as $ups) {
141148
debug(sprintf('Collecting UPS Information for %s', $ups['name']));
142149

@@ -154,6 +161,8 @@
154161
add_ups_device($ups, $host_template_id, true);
155162
}
156163
}
164+
} else {
165+
printf('NOTE: Did not find any snmp enabled UPS\'s' . PHP_EOL);
157166
}
158167

159168
$end = microtime(true);

0 commit comments

Comments
 (0)