zabbix check cert: add files
This commit is contained in:
22
files/lld_certlist.py
Executable file
22
files/lld_certlist.py
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
data=[]
|
||||||
|
filelist = os.listdir( '/etc/letsencrypt/live/' )
|
||||||
|
cert=[]
|
||||||
|
r=re.compile("(README|.*-[0-9]{4}$)")
|
||||||
|
certs = list(filter(r.match, filelist ))
|
||||||
|
for line in filelist:
|
||||||
|
if line == "README": continue
|
||||||
|
if re.search( ".*ORIG$", line) : continue
|
||||||
|
if re.search( ".*-[0-9]{4}$", line) : continue
|
||||||
|
cert.append( line )
|
||||||
|
|
||||||
|
data = [{"{#CERT}": line.strip()} for line in set(cert)]
|
||||||
|
print(json.dumps({"data": data}, indent=4))
|
||||||
|
|
||||||
1
files/user_parameter_certificate_discovery.conf
Normal file
1
files/user_parameter_certificate_discovery.conf
Normal file
@@ -0,0 +1 @@
|
|||||||
|
UserParameter=certificate.discovery,/etc/zabbix/scripts/lld_certlist.py
|
||||||
Reference in New Issue
Block a user