Source
257
257
$is_template = false;
258
258
}
259
259
260
260
if (!$db_host) {
261
261
return null;
262
262
}
263
263
264
264
$db_host = reset($db_host);
265
265
266
266
if (!$is_template) {
267
-
$items_count = getEnabledItemTypeCountByHostId(ITEM_TYPE_ZABBIX_ACTIVE, [$hostid]);
268
-
269
267
$interface_enabled_items_count = getEnabledItemsCountByInterfaceIds(
270
268
array_column($db_host['interfaces'], 'interfaceid')
271
269
);
272
270
273
271
foreach ($db_host['interfaces'] as &$interface) {
274
272
$interfaceid = $interface['interfaceid'];
275
273
276
274
$interface['has_enabled_items'] = array_key_exists($interfaceid, $interface_enabled_items_count)
277
275
&& $interface_enabled_items_count[$interfaceid] > 0;
278
276
}
279
277
unset($interface);
280
278
281
-
if ($items_count) {
279
+
if (getEnabledItemTypeCountByHostId(ITEM_TYPE_ZABBIX_ACTIVE, [$hostid])) {
282
280
// Add active checks interface if host have items with type ITEM_TYPE_ZABBIX_ACTIVE (7).
283
281
$db_host['interfaces'][] = [
284
282
'type' => INTERFACE_TYPE_AGENT_ACTIVE,
285
283
'available' => $db_host['active_available'],
286
284
'has_enabled_items' => true,
287
285
'error' => ''
288
286
];
289
287
unset($db_host['active_available']);
290
288
}
291
289
}