fix expiration items bugs

This commit is contained in:
Pavel Muhortov 2023-07-27 17:35:14 +03:00
parent 2e770b0067
commit 269f38e7ed
2 changed files with 33 additions and 9 deletions

View File

@ -1,6 +1,6 @@
zabbix_export:
version: '6.0'
date: '2023-07-27T10:47:37Z'
date: '2023-07-27T14:32:21Z'
groups:
-
uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6
@ -32,10 +32,18 @@ zabbix_export:
-
uuid: 877b2f94cd4645fcaae13543f42d79be
name: 'OpenVPN clients limit'
type: DEPENDENT
key: ovpn.clients.limit
delay: 1h
delay: '0'
history: 14d
units: client
preprocessing:
-
type: JSONPATH
parameters:
- $.clients_limit
master_item:
key: discovery.ovpn
tags:
-
tag: Application
@ -46,10 +54,18 @@ zabbix_export:
-
uuid: 00c5526a838e4f7791b4edafc20bb094
name: 'OpenVPN expiration ca'
type: DEPENDENT
key: ovpn.expiration.ca
delay: 1h
delay: '0'
history: 14d
units: s
preprocessing:
-
type: JSONPATH
parameters:
- $.ca_expiration
master_item:
key: discovery.ovpn
tags:
-
tag: Application
@ -109,10 +125,18 @@ zabbix_export:
-
uuid: 591d03b0553645788c5b178670cb8bc9
name: 'OpenVPN expiration cert'
type: DEPENDENT
key: ovpn.expiration.cert
delay: 1h
delay: '0'
history: 14d
units: s
preprocessing:
-
type: JSONPATH
parameters:
- $.ce_expiration
master_item:
key: discovery.ovpn
tags:
-
tag: Application
@ -171,7 +195,7 @@ zabbix_export:
value: expiration
-
uuid: 5ba0b1d455444ec8851c4cdda408ed24
name: 'Clients count'
name: 'OpenVPN clients count'
type: DEPENDENT
key: ovpn.stats.clients_count
delay: '0'
@ -193,7 +217,7 @@ zabbix_export:
value: 'clients count'
-
uuid: 731f61d192f944769aaf82c2fb05676b
name: 'Clients found'
name: 'OpenVPN clients found'
type: DEPENDENT
key: ovpn.stats.clients_found
delay: '0'
@ -215,7 +239,7 @@ zabbix_export:
value: 'clients found'
-
uuid: f38e82ba64f14385bd60a1397eda278c
name: 'Stats updated'
name: 'OpenVPN stats updated'
type: DEPENDENT
key: ovpn.stats.updated
delay: '0'

View File

@ -218,11 +218,11 @@ if __name__ == "__main__":
ca_file_conf = re.search(r'ca\s+\S*', conf_data, re.MULTILINE).group(0)
ca_file_path = re.sub(r'ca\s+', '', ca_file_conf)
json_data['ca_expiration'] = ce_exp(cert_path=ca_file_path)
json_data['ca_expiration'] = ce_exp(cert_path=ca_file_path) - int(time.time())
ce_file_conf = re.search(r'cert\s+\S*', conf_data, re.MULTILINE).group(0)
ce_file_path = re.sub(r'cert\s+', '', ce_file_conf)
json_data['ce_expiration'] = ce_exp(cert_path=ce_file_path)
json_data['ce_expiration'] = ce_exp(cert_path=ce_file_path) - int(time.time())
network_conf = re.search(r'server\s+\S*\s+\S*', conf_data, re.MULTILINE).group(0)
network_pool = re.sub(r'server\s+', '', network_conf)