add redis to proper node types. grafana dahsboard changes. change zeek_restart to not use telegraf socket but read from file instead

This commit is contained in:
m0duspwnens
2020-09-01 14:38:10 -04:00
parent ada1c81ab7
commit b6d66bddfc
6 changed files with 288 additions and 132 deletions

View File

@@ -2,6 +2,8 @@
import logging
import sys
from time import time
from os.path import getsize
allowed_functions = ['is_enabled', 'zeek']
states_to_apply = []
@@ -85,7 +87,19 @@ def zeek():
else:
zeek_restart = 0
__salt__['telegraf.send']('healthcheck zeek_restart=%i' % zeek_restart)
#__salt__['telegraf.send']('healthcheck zeek_restart=%i' % zeek_restart)
# write out to file in /nsm/zeek/logs/ for telegraf to read for zeek restart
try:
if getsize("/nsm/zeek/logs/zeek_restart.log") >= 1000000:
openmethod = "w"
else:
openmethod = "a"
except FileNotFoundError:
openmethod = "a"
with open("/nsm/zeek/logs/zeek_restart.log", openmethod) as f:
f.write('healthcheck zeek_restart=%i' % zeek_restart int(time() * 1000000000))
if calling_func == 'execute' and zeek_restart:
apply_states()