zabbix check cert: add files

This commit is contained in:
2020-05-22 17:07:28 +02:00
parent 3b50190e7b
commit a239313ba1
2 changed files with 23 additions and 0 deletions

22
files/lld_certlist.py Executable file
View 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))

View File

@@ -0,0 +1 @@
UserParameter=certificate.discovery,/etc/zabbix/scripts/lld_certlist.py