line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Monitis::CustomMonitors; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
5
|
|
|
|
|
|
|
require Carp; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
4
|
use base 'Monitis'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
642
|
|
8
|
|
|
|
|
|
|
|
9
|
0
|
|
|
0
|
1
|
|
sub api_url {'http://www.monitis.com/customMonitorApi'} |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub add { |
12
|
0
|
|
|
0
|
1
|
|
my ($self, @params) = @_; |
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
|
|
|
my @mandatory = qw/name tag resultParams/; |
15
|
0
|
|
|
|
|
|
my @optional = qw/monitorParams/; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
my $params = $self->prepare_params(\@params, \@mandatory, \@optional); |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
return $self->api_post('addMonitor' => $params); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub edit { |
23
|
0
|
|
|
0
|
1
|
|
my ($self, @params) = @_; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
my @mandatory = qw/monitorId name tag/; |
26
|
0
|
|
|
|
|
|
my @optional = qw/monitorParams/; |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my $params = $self->prepare_params(\@params, \@mandatory, \@optional); |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
return $self->api_post('editMonitor' => $params); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub get { |
34
|
0
|
|
|
0
|
1
|
|
my ($self, @params) = @_; |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
my @mandatory = qw//; |
37
|
0
|
|
|
|
|
|
my @optional = qw/tag/; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
my $params = $self->prepare_params(\@params, \@mandatory, \@optional); |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
return $self->api_get('getMonitors' => $params); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub get_info { |
45
|
0
|
|
|
0
|
1
|
|
my ($self, @params) = @_; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my @mandatory = qw/monitorId/; |
48
|
0
|
|
|
|
|
|
my @optional = qw/excludeHidden/; |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
my $params = $self->prepare_params(\@params, \@mandatory, \@optional); |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
return $self->api_get('getMonitorInfo' => $params); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub add_results { |
56
|
0
|
|
|
0
|
1
|
|
my ($self, @params) = @_; |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
my @mandatory = qw/monitorId checktime results/; |
59
|
0
|
|
|
|
|
|
my @optional = (); |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
my $params = $self->prepare_params(\@params, \@mandatory, \@optional); |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
return $self->api_post('addResult' => $params); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub get_results { |
67
|
0
|
|
|
0
|
1
|
|
my ($self, @params) = @_; |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
my @mandatory = qw/monitorId day month year/; |
70
|
0
|
|
|
|
|
|
my @optional = qw/timezone/; |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
my $params = $self->prepare_params(\@params, \@mandatory, \@optional); |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
return $self->api_get('getMonitorResults' => $params); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub delete { |
78
|
0
|
|
|
0
|
1
|
|
my ($self, @params) = @_; |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
my @mandatory = qw/monitorId/; |
81
|
0
|
|
|
|
|
|
my @optional = qw//; |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
my $params = $self->prepare_params(\@params, \@mandatory, \@optional); |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
return $self->api_post('deleteMonitor' => $params); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
__END__ |