Exemplo n.º 1
0
 def live(self):
     import livestatus
     live = livestatus.LocalConnection()
     live.set_timeout(2)
     return live
Exemplo n.º 2
0
def test_livestatus_local_connection_no_socket(sock_path):
    live = livestatus.LocalConnection()
    with pytest.raises(livestatus.MKLivestatusSocketError,
                       match="Cannot connect to 'unix:%s'" % sock_path):
        live.connect()
Exemplo n.º 3
0
def get_local_ec_status():
    response = livestatus.LocalConnection().query("GET eventconsolestatus")
    return dict(zip(response[0], response[1]))
Exemplo n.º 4
0
def test_livestatus_local_connection_omd_root_not_set(monkeypatch, tmp_path):
    with pytest.raises(livestatus.MKLivestatusConfigError, match="OMD_ROOT is not set"):
        livestatus.LocalConnection()
Exemplo n.º 5
0
def get_local_ec_status():
    response = livestatus.LocalConnection().query("GET eventconsolestatus")
    if len(response) == 1:
        return None  # In case the EC is not running, there may be some
    return dict(zip(response[0], response[1]))