arthru / python-mk-livestatus

Helps to query MK livestatus and get results
Other
20 stars 17 forks source link

Counts do not work #8

Open Hinnack opened 8 years ago

Hinnack commented 8 years ago

I try query 6 from http://mathias-kettner.de/checkmk_livestatus.html GET services Stats: state = 0 Stats: state = 1 Stats: state = 2 Stats: state = 3

like:

from mk_livestatus import Socket
s = Socket(('x.y.z.q', 50000))
q = s.services
q = q.filter('state = 1')
q = q.filter('state = 2')
q = q.filter('state = 3')
q.call()

result is empty array

ways commented 6 years ago

I think you have to write

from mk_livestatus import Socket
s = Socket(('x.y.z.q', 50000))
q = s.services.filter('state = 1').filter('state = 2').filter('state = 3')
q.call()
phatad commented 1 year ago

I think you have to write

from mk_livestatus import Socket
s = Socket(('x.y.z.q', 50000))
q = s.services.filter('state = 1').filter('state = 2').filter('state = 3')
q.call()

I can't use q.call() right now?

q.call() Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.8/dist-packages/mk_livestatus/livestatus.py", line 25, in call return self._conn.call(data) File "/usr/local/lib/python3.8/dist-packages/mk_livestatus/livestatus.py", line 61, in call s.connect(self.peer) FileNotFoundError: [Errno 2] No such file or directory

ways commented 1 year ago

I think you have to write

from mk_livestatus import Socket
s = Socket(('x.y.z.q', 50000))
q = s.services.filter('state = 1').filter('state = 2').filter('state = 3')
q.call()

I can't use q.call() right now?

q.call() Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.8/dist-packages/mk_livestatus/livestatus.py", line 25, in call return self._conn.call(data) File "/usr/local/lib/python3.8/dist-packages/mk_livestatus/livestatus.py", line 61, in call s.connect(self.peer) FileNotFoundError: [Errno 2] No such file or directory

Sorry, I no longer develop for checkmk and this is 5 years old, so I have no idea. Perhaps the change from 1.6 to 2.0 broke this? :shrug:

phatad commented 1 year ago

I think you have to write

from mk_livestatus import Socket
s = Socket(('x.y.z.q', 50000))
q = s.services.filter('state = 1').filter('state = 2').filter('state = 3')
q.call()

I can't use q.call() right now?

q.call() Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.8/dist-packages/mk_livestatus/livestatus.py", line 25, in call return self._conn.call(data) File "/usr/local/lib/python3.8/dist-packages/mk_livestatus/livestatus.py", line 61, in call s.connect(self.peer) FileNotFoundError: [Errno 2] No such file or directory

Sorry, I no longer develop for checkmk and this is 5 years old, so I have no idea. Perhaps the change from 1.6 to 2.0 broke this? 🤷

I installed CMK version 1.6.0p30