-
Notifications
You must be signed in to change notification settings - Fork 0
/
zabbix_tubearchivist.yaml
285 lines (283 loc) · 10.3 KB
/
zabbix_tubearchivist.yaml
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
zabbix_export:
version: '6.4'
template_groups:
- uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6
name: Templates/Applications
templates:
- uuid: 96324d642ee741a780d593d7985cccf2
template: 'Tubearchivist by API'
name: 'Tubearchivist by API'
groups:
- name: Templates/Applications
items:
- uuid: 2c9e5e241cf0432b8d0ffaa6e553b338
name: 'Tubearchivist download statistics by HTTP'
type: HTTP_AGENT
key: tubearchivist.api.raw.download
history: '0'
trends: '0'
value_type: TEXT
timeout: 15s
url: '{$TA_URL}/api/download/?format=json&filter=pending'
headers:
- name: Authorization
value: 'Token {$TA_TOKEN}'
tags:
- tag: component
value: raw
- uuid: 95605a716d2f426fab99c1af18233ee8
name: 'Tubearchivist download status by HTTP'
type: HTTP_AGENT
key: tubearchivist.api.raw.notification.downloads
history: '0'
trends: '0'
value_type: TEXT
timeout: 15s
url: '{$TA_URL}/api/notification/'
headers:
- name: Authorization
value: 'Token {$TA_TOKEN}'
tags:
- tag: component
value: raw
- uuid: 49f7159dac4141b4b9d321a3882f7f70
name: 'Tubearchivist video statistics by HTTP'
type: HTTP_AGENT
key: tubearchivist.api.raw.stats.video
delay: 15m
history: '0'
trends: '0'
value_type: TEXT
timeout: 15s
url: '{$TA_URL}/api/stats/video/'
headers:
- name: Authorization
value: 'Token {$TA_TOKEN}'
tags:
- tag: component
value: raw
- uuid: e540da8aa4d449a38e0ea077cab63ce9
name: 'Number of failed downloads'
type: DEPENDENT
key: tubearchivist.api.stat.download.number_of_failed_downloads
delay: '0'
preprocessing:
- type: JSONPATH
parameters:
- '$.data.[?(@.message)].youtube_id.length()'
master_item:
key: tubearchivist.api.raw.download
- uuid: bbb88e1dd8334aa6a8c31b5ff9af8ae4
name: 'Number of downloads running'
type: DEPENDENT
key: tubearchivist.api.stat.download.number_of_running_downloads
delay: '0'
preprocessing:
- type: JSONPATH
parameters:
- '$.[?(@.group==''download:run'')].length()'
master_item:
key: tubearchivist.api.raw.notification.downloads
- uuid: 72d8ab89cb8245fcad5bfb48b4ac8d3e
name: 'Total number of items in download queue'
type: DEPENDENT
key: tubearchivist.api.stat.download.queue_length
delay: '0'
preprocessing:
- type: JSONPATH
parameters:
- $.paginate.total_hits
master_item:
key: tubearchivist.api.raw.download
triggers:
- uuid: 69d4f40b5b24430db7a950b173efda56
expression: 'changecount(/Tubearchivist by API/tubearchivist.api.stat.download.queue_length,{$TA_NO_DOWNLOAD_WARN_DURATION_SECS})=0'
name: 'No downloads were performed within {$TA_NO_DOWNLOAD_WARN_DURATION}'
priority: WARNING
manual_close: 'YES'
- uuid: 5a86595289aa4c7bbd0409fb7a6abfe7
name: 'Download speed'
type: DEPENDENT
key: tubearchivist.api.stat.download.speed
delay: '0'
value_type: FLOAT
units: bit/s
preprocessing:
- type: JSONPATH
parameters:
- '$.[?(@.group==''download:run'')].messages[1]'
error_handler: DISCARD_VALUE
- type: REGEX
parameters:
- '.*at[ ]*([\d\.]*)(.*\/s).*'
- '\1 \2'
error_handler: DISCARD_VALUE
- type: JAVASCRIPT
parameters:
- |
const spl = value.split(' ')
const unit = spl[1]
const val = spl[0]
if (unit.endsWith('MiB/s')) {
return val * 1024 * 1024 * 8
} else if (unit.endsWith('KiB/s')) {
return val * 1024 * 8
} else {
return val * 8
}
master_item:
key: tubearchivist.api.raw.notification.downloads
triggers:
- uuid: 6e936fe545e34e61bc1f340438dafc63
expression: 'avg(/Tubearchivist by API/tubearchivist.api.stat.download.speed,#10)<{$TA_THROTTLED_RATE_BITS}'
name: 'Tubearchivist - download speed throttled'
priority: WARNING
manual_close: 'YES'
- uuid: 9a744c5e147943a4b4e17523d3fc84eb
name: 'Tubearchivist - total duration'
type: DEPENDENT
key: 'tubearchivist.api.stat.total_duration["all"]'
delay: '0'
units: s
preprocessing:
- type: JSONPATH
parameters:
- $.duration
master_item:
key: tubearchivist.api.raw.stats.video
- uuid: 96a8189a6de3498fae9f1197ebe9cf49
name: 'Tubearchivist - shorts duration'
type: DEPENDENT
key: 'tubearchivist.api.stat.total_duration["shorts"]'
delay: '0'
units: s
preprocessing:
- type: JSONPATH
parameters:
- $.type_shorts.duration
master_item:
key: tubearchivist.api.raw.stats.video
- uuid: 450bbd83d2894b998591eb657c45df4d
name: 'Tubearchivist - streams duration'
type: DEPENDENT
key: 'tubearchivist.api.stat.total_duration["streams"]'
delay: '0'
units: s
preprocessing:
- type: JSONPATH
parameters:
- $.type_streams.duration
master_item:
key: tubearchivist.api.raw.stats.video
- uuid: e9f5639c68b24ea58044696cd8995bee
name: 'Tubearchivist - video duration'
type: DEPENDENT
key: 'tubearchivist.api.stat.total_duration["video"]'
delay: '0'
units: s
preprocessing:
- type: JSONPATH
parameters:
- $.type_videos.duration
master_item:
key: tubearchivist.api.raw.stats.video
- uuid: 5abe1504e86149c5a10e463fd5bf749d
name: 'Tubearchivist - total number of shorts'
type: DEPENDENT
key: 'tubearchivist.api.stat.total_entries["shorts"]'
delay: '0'
preprocessing:
- type: JSONPATH
parameters:
- $.type_shorts.doc_count
master_item:
key: tubearchivist.api.raw.stats.video
- uuid: 64bf48efb66646a68dc0bc7722a91566
name: 'Tubearchivist - total number of streams'
type: DEPENDENT
key: 'tubearchivist.api.stat.total_entries["streams"]'
delay: '0'
preprocessing:
- type: JSONPATH
parameters:
- $.type_streams.doc_count
master_item:
key: tubearchivist.api.raw.stats.video
- uuid: 318dd59f6c4542cbb293f402158c2637
name: 'Tubearchivist - total number of videos'
type: DEPENDENT
key: 'tubearchivist.api.stat.total_entries["videos"]'
delay: '0'
preprocessing:
- type: JSONPATH
parameters:
- $.doc_count
master_item:
key: tubearchivist.api.raw.stats.video
- uuid: fcf68a021a32408fa4c4fa172c84cdb2
name: 'Tubearchivist - total size'
type: DEPENDENT
key: 'tubearchivist.api.stat.total_size["all"]'
delay: '0'
units: Byte
preprocessing:
- type: JSONPATH
parameters:
- $.media_size
master_item:
key: tubearchivist.api.raw.stats.video
- uuid: f1f56f2bf8fa49178bb92928fc7d97e0
name: 'Tubearchivist - shorts size'
type: DEPENDENT
key: 'tubearchivist.api.stat.total_size["shorts"]'
delay: '0'
units: Byte
preprocessing:
- type: JSONPATH
parameters:
- $.type_shorts.media_size
master_item:
key: tubearchivist.api.raw.stats.video
- uuid: 62ad5ce0e0b54aa9979ccef4829af11a
name: 'Tubearchivist - streams size'
type: DEPENDENT
key: 'tubearchivist.api.stat.total_size["streams"]'
delay: '0'
units: Byte
preprocessing:
- type: JSONPATH
parameters:
- $.type_streams.media_size
master_item:
key: tubearchivist.api.raw.stats.video
- uuid: f049a56898c64ffca6149e520dcad01f
name: 'Tubearchivist - video size'
type: DEPENDENT
key: 'tubearchivist.api.stat.total_size["video"]'
delay: '0'
units: Byte
preprocessing:
- type: JSONPATH
parameters:
- $.type_videos.media_size
master_item:
key: tubearchivist.api.raw.stats.video
macros:
- macro: '{$TA_API_TOKEN}'
description: 'API token'
- macro: '{$TA_NO_DOWNLOAD_WARN_DURATION}'
value: 1w
description: 'Time until the ''no downloads were performed'' Trigger fires'
- macro: '{$TA_THROTTLED_RATE_BITS}'
value: '4000000'
description: 'Average download bitrate after which Tubearchivist is considered throttled'
- macro: '{$TA_URL}'
description: 'Tubearchivist URL'
triggers:
- uuid: fb34c7d687ea4b228aaec4667363de4c
expression: |
last(/Tubearchivist by API/tubearchivist.api.stat.download.number_of_running_downloads) = 0 and
(last(/Tubearchivist by API/tubearchivist.api.stat.download.queue_length) - last(/Tubearchivist by API/tubearchivist.api.stat.download.number_of_failed_downloads)) > 0
name: 'No videos are downloading but download queue is not empty'
priority: AVERAGE
manual_close: 'YES'