def test_acknowledgeProblem_host(self): """acknowledgeProblem: generate commands to acknowledge host problem""" nagctl.conf["host"] = "database" commands = nagctl.acknowledgeProblem(["acknowledge", "problem", "comment"], "host") expected = ["ACKNOWLEDGE_HOST_PROBLEM;database;1;0;0;nagctl;comment"] self.assertEqual(commands, expected)
def test_acknowledgeProblem_none(self): """acknowledgeProblem: do not generate any commands""" nagctl.conf["host"] = "worker0" nagctl.conf["service"] = "queue1" commands = nagctl.acknowledgeProblem(["acknowledge", "problem", "comment"], "all") expected = [] self.assertEqual(commands, expected)
def test_acknowledgeProblem_host(self): """acknowledgeProblem: generate commands to acknowledge host problem""" nagctl.conf["host"] = "database" commands = nagctl.acknowledgeProblem( ["acknowledge", "problem", "comment"], "host") expected = ["ACKNOWLEDGE_HOST_PROBLEM;database;1;0;0;nagctl;comment"] self.assertEqual(commands, expected)
def test_acknowledgeProblem_service(self): """acknowledgeProblem: generate commands to acknowledge service problem""" import re nagctl.conf["service"] = "load" commands = nagctl.acknowledgeProblem(["acknowledge", "problem", "comment"], "service") expected = ["ACKNOWLEDGE_SVC_PROBLEM;worker0;load;1;0;0;nagctl;comment", "ACKNOWLEDGE_SVC_PROBLEM;worker1;load;1;0;0;nagctl;comment", "ACKNOWLEDGE_SVC_PROBLEM;database;load;1;0;0;nagctl;comment"] self.assertEqual(commands, expected)
def test_acknowledgeProblem_none(self): """acknowledgeProblem: do not generate any commands""" nagctl.conf["host"] = "worker0" nagctl.conf["service"] = "queue1" commands = nagctl.acknowledgeProblem( ["acknowledge", "problem", "comment"], "all") expected = [] self.assertEqual(commands, expected)
def test_acknowledgeProblem_all(self): """acknowledgeProblem: generate commands to acknowledge host and service problem""" import re nagctl.conf["host"] = "database" nagctl.conf["service"] = "load" commands = nagctl.acknowledgeProblem(["acknowledge", "problem", "comment"], "all") expected = ["ACKNOWLEDGE_HOST_PROBLEM;database;1;0;0;nagctl;comment", "ACKNOWLEDGE_SVC_PROBLEM;database;load;1;0;0;nagctl;comment"] self.assertEqual(commands, expected)
def test_acknowledgeProblem_all(self): """acknowledgeProblem: generate commands to acknowledge host and service problem""" import re nagctl.conf["host"] = "database" nagctl.conf["service"] = "load" commands = nagctl.acknowledgeProblem( ["acknowledge", "problem", "comment"], "all") expected = [ "ACKNOWLEDGE_HOST_PROBLEM;database;1;0;0;nagctl;comment", "ACKNOWLEDGE_SVC_PROBLEM;database;load;1;0;0;nagctl;comment" ] self.assertEqual(commands, expected)
def test_acknowledgeProblem_service(self): """acknowledgeProblem: generate commands to acknowledge service problem""" import re nagctl.conf["service"] = "load" commands = nagctl.acknowledgeProblem( ["acknowledge", "problem", "comment"], "service") expected = [ "ACKNOWLEDGE_SVC_PROBLEM;worker0;load;1;0;0;nagctl;comment", "ACKNOWLEDGE_SVC_PROBLEM;worker1;load;1;0;0;nagctl;comment", "ACKNOWLEDGE_SVC_PROBLEM;database;load;1;0;0;nagctl;comment" ] self.assertEqual(commands, expected)