line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Zabbix2::API::Trigger; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
939
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
70
|
|
4
|
2
|
|
|
2
|
|
6
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
56
|
|
5
|
2
|
|
|
2
|
|
41
|
use 5.010; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
48
|
|
6
|
2
|
|
|
2
|
|
7
|
use Carp; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
117
|
|
7
|
2
|
|
|
2
|
|
708
|
use autodie; |
|
2
|
|
|
|
|
15554
|
|
|
2
|
|
|
|
|
11
|
|
8
|
2
|
|
|
2
|
|
9863
|
use utf8; |
|
2
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
13
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
57
|
use Moo; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
14
|
|
11
|
|
|
|
|
|
|
extends qw/Exporter Zabbix2::API::CRUDE/; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use constant { |
14
|
2
|
|
|
|
|
771
|
TRIGGER_PRIORITY_NOT_CLASSIFIED => 0, |
15
|
|
|
|
|
|
|
TRIGGER_PRIORITY_INFO => 1, |
16
|
|
|
|
|
|
|
TRIGGER_PRIORITY_WARN => 2, |
17
|
|
|
|
|
|
|
TRIGGER_PRIORITY_AVG => 3, |
18
|
|
|
|
|
|
|
TRIGGER_PRIORITY_HIGH => 4, |
19
|
|
|
|
|
|
|
TRIGGER_PRIORITY_DISASTER => 5, |
20
|
|
|
|
|
|
|
TRIGGER_STATUS_ACTIVE => 0, |
21
|
|
|
|
|
|
|
TRIGGER_STATUS_DISABLED => 1, |
22
|
|
|
|
|
|
|
TRIGGER_VALUE_OK => 0, |
23
|
|
|
|
|
|
|
TRIGGER_VALUE_PROBLEM => 1, |
24
|
|
|
|
|
|
|
TRIGGER_VALUE_UNKNOWN => 2, |
25
|
|
|
|
|
|
|
TRIGGER_TYPE_NORMAL => 0, |
26
|
|
|
|
|
|
|
TRIGGER_TYPE_MULTIPLE => 1, |
27
|
2
|
|
|
2
|
|
815
|
}; |
|
2
|
|
|
|
|
4
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
our @EXPORT_OK = qw/ |
30
|
|
|
|
|
|
|
TRIGGER_PRIORITY_NOT_CLASSIFIED |
31
|
|
|
|
|
|
|
TRIGGER_PRIORITY_INFO |
32
|
|
|
|
|
|
|
TRIGGER_PRIORITY_WARN |
33
|
|
|
|
|
|
|
TRIGGER_PRIORITY_AVG |
34
|
|
|
|
|
|
|
TRIGGER_PRIORITY_HIGH |
35
|
|
|
|
|
|
|
TRIGGER_PRIORITY_DISASTER |
36
|
|
|
|
|
|
|
TRIGGER_STATUS_ACTIVE |
37
|
|
|
|
|
|
|
TRIGGER_STATUS_DISABLED |
38
|
|
|
|
|
|
|
TRIGGER_VALUE_OK |
39
|
|
|
|
|
|
|
TRIGGER_VALUE_PROBLEM |
40
|
|
|
|
|
|
|
TRIGGER_VALUE_UNKNOWN |
41
|
|
|
|
|
|
|
TRIGGER_TYPE_NORMAL |
42
|
|
|
|
|
|
|
TRIGGER_TYPE_MULTIPLE/; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
45
|
|
|
|
|
|
|
trigger_types => [ |
46
|
|
|
|
|
|
|
qw/TRIGGER_TYPE_NORMAL |
47
|
|
|
|
|
|
|
TRIGGER_TYPE_MULTIPLE/ |
48
|
|
|
|
|
|
|
], |
49
|
|
|
|
|
|
|
priority_types => [ |
50
|
|
|
|
|
|
|
qw/TRIGGER_PRIORITY_NOT_CLASSIFIED |
51
|
|
|
|
|
|
|
TRIGGER_PRIORITY_INFO |
52
|
|
|
|
|
|
|
TRIGGER_PRIORITY_WARN |
53
|
|
|
|
|
|
|
TRIGGER_PRIORITY_AVG |
54
|
|
|
|
|
|
|
TRIGGER_PRIORITY_HIGH |
55
|
|
|
|
|
|
|
TRIGGER_PRIORITY_DISASTER/ |
56
|
|
|
|
|
|
|
], |
57
|
|
|
|
|
|
|
value_types => [ |
58
|
|
|
|
|
|
|
qw/TRIGGER_VALUE_OK |
59
|
|
|
|
|
|
|
TRIGGER_VALUE_PROBLEM |
60
|
|
|
|
|
|
|
TRIGGER_VALUE_UNKNOWN/ |
61
|
|
|
|
|
|
|
], |
62
|
|
|
|
|
|
|
status_types => [ |
63
|
|
|
|
|
|
|
qw/TRIGGER_STATUS_ACTIVE |
64
|
|
|
|
|
|
|
TRIGGER_STATUS_DISABLED/ |
65
|
|
|
|
|
|
|
] |
66
|
|
|
|
|
|
|
); |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub _readonly_properties { |
69
|
|
|
|
|
|
|
return { |
70
|
0
|
|
|
0
|
|
|
triggerid => 1, |
71
|
|
|
|
|
|
|
error => 1, |
72
|
|
|
|
|
|
|
flags => 1, |
73
|
|
|
|
|
|
|
lastchange => 1, |
74
|
|
|
|
|
|
|
state => 1, |
75
|
|
|
|
|
|
|
templateid => 1, |
76
|
|
|
|
|
|
|
value => 1, |
77
|
|
|
|
|
|
|
}; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub id { |
81
|
|
|
|
|
|
|
## mutator for id |
82
|
0
|
|
|
0
|
1
|
|
my ($self, $value) = @_; |
83
|
0
|
0
|
|
|
|
|
if (defined $value) { |
84
|
0
|
|
|
|
|
|
$self->data->{triggerid} = $value; |
85
|
0
|
|
|
|
|
|
return $self->data->{triggerid}; |
86
|
|
|
|
|
|
|
} else { |
87
|
0
|
|
|
|
|
|
return $self->data->{triggerid}; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub _prefix { |
92
|
0
|
|
|
0
|
|
|
my (undef, $suffix) = @_; |
93
|
0
|
0
|
|
|
|
|
if ($suffix) { |
94
|
0
|
|
|
|
|
|
return 'trigger'.$suffix; |
95
|
|
|
|
|
|
|
} else { |
96
|
0
|
|
|
|
|
|
return 'trigger'; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub _extension { |
101
|
0
|
|
|
0
|
|
|
return (output => 'extend', |
102
|
|
|
|
|
|
|
selectHosts => ['hostid'], |
103
|
|
|
|
|
|
|
selectItems => ['itemid'], |
104
|
|
|
|
|
|
|
selectFunctions => 'extend', |
105
|
|
|
|
|
|
|
selectDependencies => ['triggerid']); |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub name { |
109
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
110
|
|
|
|
|
|
|
# can't think of a good name for triggers -- descriptions are too long |
111
|
0
|
|
|
|
|
|
return $self->data->{description}; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
1; |
115
|
|
|
|
|
|
|
__END__ |