forked from infra/ansible
Copr: Add build-checks template to Zabbix
Signed-off-by: Greg Sutcliffe <fedora@emeraldreverie.org>
This commit is contained in:
parent
d4825ebfb2
commit
c52f7a9416
3 changed files with 191 additions and 5 deletions
|
|
@ -17,3 +17,5 @@ zabbix_macros:
|
|||
'COPR.STARTUP.MAX:"copr_ic_s390x_br_sao_1_dev"': 300
|
||||
'COPR.STARTUP.MAX:"copr_ic_s390x_eu_es_1_dev"': 300
|
||||
'COPR.STARTUP.MAX:"copr_ic_s390x_br_sao_2_dev"': 300
|
||||
'COPR.STARTUP.MAX:"copr_ic_s390x_br_sao_2_dev"': 300
|
||||
'COPR.STATS.HOST': copr-be-dev.cloud.fedoraproject.org
|
||||
|
|
|
|||
176
roles/copr/backend/files/zabbix/template-copr-builds.yml
Normal file
176
roles/copr/backend/files/zabbix/template-copr-builds.yml
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
zabbix_export:
|
||||
version: '7.0'
|
||||
template_groups:
|
||||
- uuid: a333cbd6a3ad44baaa4eee4b0c0b1bec
|
||||
name: Fedora
|
||||
templates:
|
||||
- uuid: 3ed7e6fe050847ea93a764a967ff5b6e
|
||||
template: 'COPR Build metrics'
|
||||
name: 'COPR Build metrics'
|
||||
groups:
|
||||
- name: Fedora
|
||||
items:
|
||||
- uuid: ad7184dda6f0453e9d63b587fc074cfb
|
||||
name: 'Raw build metrics'
|
||||
type: HTTP_AGENT
|
||||
key: copr.builds.metrics
|
||||
delay: 5m
|
||||
history: 1h
|
||||
value_type: TEXT
|
||||
trends: '0'
|
||||
url: 'https://{$COPR.STATS.HOST}/resalloc/api/stats'
|
||||
tags:
|
||||
- tag: source
|
||||
value: raw
|
||||
discovery_rules:
|
||||
- uuid: 06250193c36d483994587fcc888f2e13
|
||||
name: 'Discover pools'
|
||||
type: DEPENDENT
|
||||
key: copr.builds.pools
|
||||
delay: '0'
|
||||
description: 'Parse JSON from COPR build system for pool names'
|
||||
item_prototypes:
|
||||
- uuid: edfa8fa7ee694a4782fcdfe411545d0a
|
||||
name: '{#POOL} - Average startup time'
|
||||
type: DEPENDENT
|
||||
key: 'copr.builds.avg_time[{#POOL}]'
|
||||
delay: '0'
|
||||
value_type: FLOAT
|
||||
units: s
|
||||
preprocessing:
|
||||
- type: JSONPATH
|
||||
parameters:
|
||||
- '$.["{#POOL}"].startup_time_avg'
|
||||
master_item:
|
||||
key: copr.builds.metrics
|
||||
tags:
|
||||
- tag: copr-pool
|
||||
value: '{#POOL}'
|
||||
trigger_prototypes:
|
||||
- uuid: 5ef177b6793041e79442412d0fd19479
|
||||
expression: 'last(/COPR Build metrics/copr.builds.avg_time[{#POOL}]) > {$COPR.STARTUP.MAX:"{#POOL}"}'
|
||||
name: 'Pool {#POOL}: startup time over {$COPR.STARTUP.MAX:"{#POOL}"}'
|
||||
priority: WARNING
|
||||
tags:
|
||||
- tag: scope
|
||||
value: builds
|
||||
- uuid: 813ae4441c4b4a0d8ff9a0231661bc42
|
||||
name: '{#POOL} - Last attempt'
|
||||
type: DEPENDENT
|
||||
key: 'copr.builds.last_attempt[{#POOL}]'
|
||||
delay: '0'
|
||||
history: 7d
|
||||
trends: '0'
|
||||
units: unixtime
|
||||
preprocessing:
|
||||
- type: JSONPATH
|
||||
parameters:
|
||||
- '$.["{#POOL}"].last_attempt_to_start'
|
||||
master_item:
|
||||
key: copr.builds.metrics
|
||||
tags:
|
||||
- tag: copr-pool
|
||||
value: '{#POOL}'
|
||||
- uuid: c2d15e23ebf44c8a81be03c9dc87ce2b
|
||||
name: '{#POOL} - Last success'
|
||||
type: DEPENDENT
|
||||
key: 'copr.builds.last_success[{#POOL}]'
|
||||
delay: '0'
|
||||
history: 7d
|
||||
trends: '0'
|
||||
units: unixtime
|
||||
preprocessing:
|
||||
- type: JSONPATH
|
||||
parameters:
|
||||
- '$.["{#POOL}"].last_successful_start'
|
||||
- type: STR_REPLACE
|
||||
parameters:
|
||||
- 'null'
|
||||
- '0'
|
||||
master_item:
|
||||
key: copr.builds.metrics
|
||||
tags:
|
||||
- tag: copr-pool
|
||||
value: '{#POOL}'
|
||||
trigger_prototypes:
|
||||
- uuid: 79ef1fe9b2c34229bfbe567da1ac525b
|
||||
expression: 'last(/COPR Build metrics/copr.builds.last_success[{#POOL}])=0'
|
||||
name: 'Pool {#POOL}: is not parseable'
|
||||
priority: WARNING
|
||||
tags:
|
||||
- tag: scope
|
||||
value: pools
|
||||
- uuid: c5bc30b2923649e18e97220627a0ada5
|
||||
name: '{#POOL} - Success rate'
|
||||
type: DEPENDENT
|
||||
key: 'copr.builds.success_rate[{#POOL}]'
|
||||
delay: '0'
|
||||
value_type: FLOAT
|
||||
units: '%'
|
||||
preprocessing:
|
||||
- type: JSONPATH
|
||||
parameters:
|
||||
- '$.["{#POOL}"].startup_success_rate'
|
||||
- type: MULTIPLIER
|
||||
parameters:
|
||||
- '100'
|
||||
master_item:
|
||||
key: copr.builds.metrics
|
||||
tags:
|
||||
- tag: copr-pool
|
||||
value: '{#POOL}'
|
||||
trigger_prototypes:
|
||||
- uuid: e28b894fcebc4b7b9ce13a83edd90a85
|
||||
expression: 'last(/COPR Build metrics/copr.builds.success_rate[{#POOL}])<60'
|
||||
name: 'Pool {#POOL}: success rate below 60%'
|
||||
priority: WARNING
|
||||
tags:
|
||||
- tag: scope
|
||||
value: builds
|
||||
trigger_prototypes:
|
||||
- uuid: 29fe2b0ea017407ea687196b47f21483
|
||||
expression: |
|
||||
(
|
||||
last(/COPR Build metrics/copr.builds.last_attempt[{#POOL}]) - last(/COPR Build metrics/copr.builds.last_success[{#POOL}])
|
||||
) > 3600
|
||||
and
|
||||
(
|
||||
last(/COPR Build metrics/copr.builds.last_attempt[{#POOL}],#1:now-6m) - last(/COPR Build metrics/copr.builds.last_success[{#POOL}],#1:now-6m)
|
||||
) > 3600
|
||||
name: 'Pool {#POOL}: last successful build is more than 1h older than last attempted build'
|
||||
priority: WARNING
|
||||
tags:
|
||||
- tag: scope
|
||||
value: builds
|
||||
master_item:
|
||||
key: copr.builds.metrics
|
||||
preprocessing:
|
||||
- type: JAVASCRIPT
|
||||
parameters:
|
||||
- |
|
||||
var metrics = JSON.parse(value);
|
||||
var result = [];
|
||||
|
||||
Object.keys(metrics).forEach(function(pool) {
|
||||
var metric = metrics[pool];
|
||||
result.push({
|
||||
"{#POOL}": pool,
|
||||
"{#LAST_ATTEMPT}": metric.last_attempt_to_start,
|
||||
"{#LAST_SUCCESS}": metric.last_successful_start,
|
||||
"{#SUCCESS_RATE}": metric.startup_success_rate,
|
||||
"{#STARTUP_AVG}": metric.startup_time_avg
|
||||
});
|
||||
});
|
||||
|
||||
return JSON.stringify(result);
|
||||
tags:
|
||||
- tag: not-infra
|
||||
value: 'true'
|
||||
- tag: team
|
||||
value: copr
|
||||
macros:
|
||||
- macro: '{$COPR.STARTUP.MAX}'
|
||||
value: '200'
|
||||
description: 'seconds for startup time on a COPR pool'
|
||||
- macro: '{$COPR.STATS.HOST}'
|
||||
value: copr-be.cloud.fedoraproject.org
|
||||
|
|
@ -23,12 +23,6 @@
|
|||
tags:
|
||||
- zabbix_api
|
||||
block:
|
||||
- name: Import COPR BE template file
|
||||
community.zabbix.zabbix_template:
|
||||
template_yaml: "{{ lookup('file', 'zabbix/template-copr-be.yml') }}"
|
||||
state: present
|
||||
run_once: true
|
||||
|
||||
- name: Ensure COPR Zabbix hostgroup is present
|
||||
community.zabbix.zabbix_group:
|
||||
host_groups:
|
||||
|
|
@ -36,9 +30,23 @@
|
|||
state: present
|
||||
run_once: true
|
||||
|
||||
- name: Import COPR BE template file
|
||||
community.zabbix.zabbix_template:
|
||||
template_yaml: "{{ lookup('file', 'zabbix/template-copr-be.yml') }}"
|
||||
state: present
|
||||
run_once: true
|
||||
|
||||
- name: Import COPR build checks template file
|
||||
community.zabbix.zabbix_template:
|
||||
template_yaml: "{{ lookup('file', 'zabbix/template-copr-builds.yml') }}"
|
||||
state: present
|
||||
run_once: true
|
||||
|
||||
- name: Add self to COPR BE template in Zabbix
|
||||
community.zabbix.zabbix_host:
|
||||
host_name: "{{ inventory_hostname }}"
|
||||
host_groups: Copr Hosts
|
||||
link_templates: Copr BE checks
|
||||
link_templates:
|
||||
- Copr BE checks
|
||||
- COPR Build metrics
|
||||
force: false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue