Added apache plugin
This commit is contained in:
parent
d9cb621811
commit
b4f05f7578
2 changed files with 32 additions and 0 deletions
|
|
@ -190,6 +190,8 @@ def start():
|
||||||
|
|
||||||
#Wait seconds to
|
#Wait seconds to
|
||||||
|
|
||||||
|
print('Syncing time collection...')
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
||||||
sleep(2)
|
sleep(2)
|
||||||
|
|
|
||||||
30
pastafaristats/utils/apache.py
Normal file
30
pastafaristats/utils/apache.py
Normal 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({}))
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue