2 # Example program for accessing status of event console
6 # Create Unix socket and connect to status socket
7 path
= os
.getenv("OMD_ROOT") + "/tmp/run/mkeventd/status"
8 sock
= socket
.socket(socket
.AF_UNIX
, socket
.SOCK_STREAM
)
12 sock
.send("GET events\nFilter: event_phase = open")
14 # Read response and convert Python source to Python object
17 chunk
= sock
.recv(8192)
18 response_text
+= chunk
21 response
= eval(response_text
)
23 # The name of the column headers are the first item of the result list
27 for row
in response
[1:]:
28 with_headers
= zip(headers
, row
)
31 for key
, value
in with_headers
:
32 print "%-20s: %s" % (key
, value
)