-
-
Notifications
You must be signed in to change notification settings - Fork 244
Script to monitor for 0 digitalRecorders available
hayden-t edited this page Mar 7, 2022
·
6 revisions
Currently this script is written for trunk recorder inn docker. And will email you if it runs out of digitalRecorders, ie too many simultaneous calls at once to record.
#!/usr/bin/python3
# python script to check trunk recorder docker logs for error messages indicating it has run out of digitalRecorders
# could be modified to check native install with out docker
# set cron job to run this eg ever hour:
# 0 * * * * /usr/bin/python3 /root/radio/checkForNoRecorders.py
import subprocess
import os
timeSpan = '62m'#get logs back this far, set to how often cron called (maybe plus 1-2 minute)
containerName = 'trunk_recorder'
logCommand = 'docker logs --since '+timeSpan+' '+containerName
alertCommand = 'swaks --to email@address.com --from "email@address.com" --header "Subject: Trunk Recorder Error: 0 Recorders" --body "Trunk Recorder ran out of recorders" --server smtp.server.com:587 --auth LOGIN --auth-user "email@address.com" --auth-password "SMTPPASSWORD" -tls'
proc = subprocess.check_output(logCommand ,stderr=subprocess.STDOUT,shell=True)
noRecorders = 0
for line in proc.decode().splitlines():
#print(line)
if 'but only 0 recorders available' in line:#how often listed
noRecorders+=1
print("noRecorders = "+str(noRecorders))
if(noRecorders > 0):
os.system(alertCommand)
- What is Trunk-Recorder?
- Roadmap (TBD)
- Enhancements
- FAQ's
- Global FAQ's
- HackRF FAQ's
- RTLSDR FAQ's