Commit 005daf7d authored by MaksimSmile13's avatar MaksimSmile13

Add Alarm handler for Thresholds

parent e62426fe
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------
# Duplex Rules handlers
# ----------------------------------------------------------------------
# Copyright (C) 2007-2018 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# Python modules
import logging
# NOC modules
from import AlarmClass
from noc.inv.models.interface import Interface
logger = logging.getLogger(__name__)
def handler(mo, alarm):
iface = Interface.objects.get(name=alarm["vars"]["path"].split("|")[-1::][0].strip(),
managed_object=mo.object, oper_status=True, admin_status=True)
if iface:
alarm['vars']["interface"] = alarm["vars"]["path"].split("|")[-1::][0].strip()
alarm['vars']["description"] = iface.description
return alarm
except Exception:
logger.debug("Not interface %s" % alarm["vars"]["path"].split("|")[-1::][0].strip())
return None
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment