def live(self): import livestatus live = livestatus.LocalConnection() live.set_timeout(2) return live
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()
def get_local_ec_status(): response = livestatus.LocalConnection().query("GET eventconsolestatus") return dict(zip(response[0], response[1]))
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()
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]))