Example #1
0
 def proc(trigger):
     description = find_description(trigger["triggerid"])
     lastchange = trigger["lastchange"]
     time = hapcommon.translate_unix_time_to_hatohol_time(lastchange)
     triggers.append({"triggerId": trigger["triggerid"],
                      "status": TRIGGER_STATUS[trigger["value"]],
                      "severity": TRIGGER_SEVERITY[trigger["priority"]],
                      "lastChangeTime": time,
                      "hostId": trigger["hosts"][0]["hostid"],
                      "hostName": trigger["hosts"][0]["name"],
                      "brief": trigger["description"],
                      "extendedInfo": description})
Example #2
0
 def proc(trigger):
     description = find_description(trigger["triggerid"])
     lastchange = trigger["lastchange"]
     time = hapcommon.translate_unix_time_to_hatohol_time(lastchange)
     triggers.append({
         "triggerId": trigger["triggerid"],
         "status": TRIGGER_STATUS[trigger["value"]],
         "severity": TRIGGER_SEVERITY[trigger["priority"]],
         "lastChangeTime": time,
         "hostId": trigger["hosts"][0]["hostid"],
         "hostName": trigger["hosts"][0]["name"],
         "brief": trigger["description"],
         "extendedInfo": description
     })
Example #3
0
        def proc(item):
            if item["lastclock"] == "0":
                return
            self.expand_item_brief(item)

            time = \
                hapcommon.translate_unix_time_to_hatohol_time(item["lastclock"],
                                                              item["lastns"])
            items.append({"itemId": item["itemid"],
                          "hostId": item["hostid"],
                          "brief": item["name"],
                          "lastValueTime": time,
                          "lastValue": item["lastvalue"],
                          "itemGroupName": get_item_groups(item["applications"]),
                          "unit": item["units"]})
Example #4
0
 def proc(event):
     trigger = self.get_select_trigger(event["objectid"])
     time = \
         hapcommon.translate_unix_time_to_hatohol_time(event["clock"],
                                                       event["ns"])
     events.append({"eventId": event["eventid"],
                    "time": time,
                    "type": EVENT_TYPE[event["value"]],
                    "triggerId": trigger["triggerid"],
                    "status": TRIGGER_STATUS[trigger["value"]],
                    "severity": TRIGGER_SEVERITY[trigger["priority"]],
                    "hostId": trigger["hosts"][0]["hostid"],
                    "hostName": trigger["hosts"][0]["name"],
                    "brief": trigger["description"],
                    "extendedInfo": ""})
Example #5
0
 def proc(event):
     trigger = self.get_select_trigger(event["objectid"])
     time = \
         hapcommon.translate_unix_time_to_hatohol_time(event["clock"],
                                                       event["ns"])
     events.append({
         "eventId": event["eventid"],
         "time": time,
         "type": EVENT_TYPE[event["value"]],
         "triggerId": trigger["triggerid"],
         "status": TRIGGER_STATUS[event["value"]],
         "severity": TRIGGER_SEVERITY[trigger["priority"]],
         "hostId": trigger["hosts"][0]["hostid"],
         "hostName": trigger["hosts"][0]["name"],
         "brief": trigger["description"],
         "extendedInfo": ""
     })
Example #6
0
        def proc(item):
            if item["lastclock"] == "0":
                return
            if "$" in item["name"]:
                self.expand_item_brief(item)

            time = \
                hapcommon.translate_unix_time_to_hatohol_time(item["lastclock"],
                                                              item["lastns"])
            items.append({
                "itemId": item["itemid"],
                "hostId": item["hostid"],
                "brief": item["name"],
                "lastValueTime": time,
                "lastValue": item["lastvalue"],
                "itemGroupName": get_item_groups(item["applications"]),
                "unit": item["units"]
            })
Example #7
0
    def test_translate_unix_time_to_hatohol_time(self):
        result = hapcommon.translate_unix_time_to_hatohol_time(0)
        self.assertEquals(result, "19700101000000.000000000")
        result = hapcommon.translate_unix_time_to_hatohol_time("0")
        self.assertEquals(result, "19700101000000.000000000")
        result = hapcommon.translate_unix_time_to_hatohol_time(0, 123456789)
        self.assertEquals(result, "19700101000000.123456789")
        result = hapcommon.translate_unix_time_to_hatohol_time(0, 123456)
        self.assertEquals(result, "19700101000000.000123456")
        result = hapcommon.translate_unix_time_to_hatohol_time("0", "123456789")
        self.assertEquals(result, "19700101000000.123456789")

        result = hapcommon.translate_unix_time_to_hatohol_time("0", "999999999")
        self.assertEquals(result, "19700101000000.999999999")
Example #8
0
    def test_translate_unix_time_to_hatohol_time(self):
        result = hapcommon.translate_unix_time_to_hatohol_time(0)
        self.assertEquals(result, "19700101000000.000000000")
        result = hapcommon.translate_unix_time_to_hatohol_time("0")
        self.assertEquals(result, "19700101000000.000000000")
        result = hapcommon.translate_unix_time_to_hatohol_time(0, 123456789)
        self.assertEquals(result, "19700101000000.123456789")
        result = hapcommon.translate_unix_time_to_hatohol_time(0, 123456)
        self.assertEquals(result, "19700101000000.000123456")
        result = hapcommon.translate_unix_time_to_hatohol_time(
            "0", "123456789")
        self.assertEquals(result, "19700101000000.123456789")

        result = hapcommon.translate_unix_time_to_hatohol_time(
            "0", "999999999")
        self.assertEquals(result, "19700101000000.999999999")
Example #9
0
 def proc(history):
     time = \
         hapcommon.translate_unix_time_to_hatohol_time(history["clock"],
                                                       history["ns"])
     histories.append({"value": history["value"], "time": time})
Example #10
0
 def proc(history):
     time = \
         hapcommon.translate_unix_time_to_hatohol_time(history["clock"],
                                                       history["ns"])
     histories.append({"value": history["value"], "time": time})