-
Notifications
You must be signed in to change notification settings - Fork 74
/
stub_hosttags.php
48 lines (43 loc) · 1.47 KB
/
stub_hosttags.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
// This file exists to make static analysis understand what NagVis includes at runtime. This file is
// created by Checkmk in real environments to hand over tag group information to NagVis.
global $mk_hosttags, $mk_auxtags;
$mk_hosttags = array();
$mk_auxtags = array();
function taggroup_title($group_id) {
global $mk_hosttags;
if (isset($mk_hosttags[$group_id]))
return $mk_hosttags[$group_id][0];
else
return $group_id;
}
function taggroup_choice($group_id, $object_tags) {
global $mk_hosttags;
if (!isset($mk_hosttags[$group_id]))
return false;
foreach ($object_tags AS $tag) {
if (isset($mk_hosttags[$group_id][2][$tag])) {
// Found a match of the objects tags with the taggroup
// now return an array of the matched tag and its alias
return array($tag, $mk_hosttags[$group_id][2][$tag][0]);
}
}
// no match found. Test whether or not a "None" choice is allowed
if (isset($mk_hosttags[$group_id][2][null]))
return array(null, $mk_hosttags[$group_id][2][null][0]);
else
return null; // no match found
}
function all_taggroup_choices($object_tags) {
global $mk_hosttags;
$choices = array();
foreach ($mk_hosttags AS $group_id => $group) {
$choices[$group_id] = array(
'topic' => $group[0],
'title' => $group[1],
'value' => taggroup_choice($group_id, $object_tags),
);
}
return $choices;
}
?>