In :
https://zmeventnotification.readthedocs ... opers.html I am trying to get this JSON to work:
{"event":"control","data":{"type":"filter","monlist":"1,2,4,5,6", "intlist":"0,0,3600,60,0"}}
I only have one monitor up and running now. By mousing over it on the console, the number 4 comes up. So my code reflects that:
Code: Select all
import json
from websocket import create_connection
ws = create_connection("ws://127.0.0.1:9000")
ws.send(json.dumps({"event":"auth","data":{"user":"admin","password":"admin"}}))
result = ws.recv()
print (result)
ws.send(json.dumps({"event":"control","data":{"type":"version"}}))
result = ws.recv()
print (result)
ws.send(json.dumps({"event":"control","data":{"type":"filter","monlist":"4","intlist":"0"}}))
#ws.send(json.dumps({"event":"control","data":{"type":"filter","monlist":"1,2,4,5,6", "intlist":"0,0,3600,60,0">
result = ws.recv()
print (result)
ws.close()
When I run the above code it gets stuck at the 3rd send.
Output:
{"reason":"","status":"Success","version":"6.1.27","type":"","event":"auth"}
{"status":"Success","reason":"","event":"control","type":"version","version":"6.1.27"}
ES running in debug mode:
Code: Select all
DBG-2:2021-12-01,15:52:59 PARENT: ----------> Tick START (active forks:0, total forks:2, active hooks: 0 running for:24 min)<--------------
DBG-2:2021-12-01,15:52:59 PARENT: After tick: TOTAL: 1, ES_CONTROL: 1, FCM+WEB: 0, FCM: 0, WEB: 1, MQTT:0, invalid WEB: 0, PENDING: 0
DBG-2:2021-12-01,15:52:59 PARENT: There are 0 active child forks & 0 zm_detect processes running...
DBG-2:2021-12-01,15:52:59 PARENT: checkEvents() new events found=0
DBG-2:2021-12-01,15:52:59 PARENT: There are 0 new Events to process
DBG-2:2021-12-01,15:52:59 PARENT: ---------->Tick END (active forks:0, total forks:2, active hooks: 0)<--------------
When I hit ctrl C, I get the following errors:
Code: Select all
^CTraceback (most recent call last):
File "soxz.py", line 12, in <module>
result = ws.recv()
File "/usr/local/lib/python3.8/dist-packages/websocket/_core.py", line 354, in recv
opcode, data = self.recv_data()
File "/usr/local/lib/python3.8/dist-packages/websocket/_core.py", line 377, in recv_data
opcode, frame = self.recv_data_frame(control_frame)
File "/usr/local/lib/python3.8/dist-packages/websocket/_core.py", line 396, in recv_data_frame
frame = self.recv_frame()
File "/usr/local/lib/python3.8/dist-packages/websocket/_core.py", line 435, in recv_frame
return self.frame_buffer.recv_frame()
File "/usr/local/lib/python3.8/dist-packages/websocket/_abnf.py", line 337, in recv_frame
self.recv_header()
File "/usr/local/lib/python3.8/dist-packages/websocket/_abnf.py", line 293, in recv_header
header = self.recv_strict(2)
File "/usr/local/lib/python3.8/dist-packages/websocket/_abnf.py", line 372, in recv_strict
bytes_ = self.recv(min(16384, shortage))
File "/usr/local/lib/python3.8/dist-packages/websocket/_core.py", line 519, in _recv
return recv(self.sock, bufsize)
File "/usr/local/lib/python3.8/dist-packages/websocket/_socket.py", line 113, in recv
bytes_ = _recv()
File "/usr/local/lib/python3.8/dist-packages/websocket/_socket.py", line 90, in _recv
return sock.recv(bufsize)
KeyboardInterrupt
Thank you!