Added apache plugin

This commit is contained in:
Antonio de la Rosa 2021-08-31 16:19:39 +02:00
parent d9cb621811
commit b4f05f7578
2 changed files with 32 additions and 0 deletions

View file

@ -190,6 +190,8 @@ def start():
#Wait seconds to #Wait seconds to
print('Syncing time collection...')
while True: while True:
sleep(2) sleep(2)

View file

@ -0,0 +1,30 @@
import requests
def stat(obj_stats):
#new_obj_stats['apache_data']={'status': 1}
url='http://127.0.0.1/server-status?auto'
try:
r=requests.get(url)
data=r.text.split("\n")
final_data={v.split(':')[0].strip():v.split(':')[1].strip() for v in data if v.find(':')!=-1}
final_data['status']=1
obj_stats['apache_data']=final_data
except:
obj_stats['apache_data']['status']=0
return obj_stats
if __name__=='__main__':
print(stat({}))