BotaxWebshell
Server IP : 68.178.172.28  /  Your IP : 216.73.216.26
Web Server : Apache
System : Linux 28.172.178.68.host.secureserver.net 4.18.0-553.89.1.el8_10.x86_64 #1 SMP Mon Dec 8 03:53:08 EST 2025 x86_64
User : kiskarnal ( 1003)
PHP Version : 8.0.30
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : ON |  Sudo : ON |  Pkexec : ON
Directory :  /usr/lib/fm-agent/library/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /usr/lib/fm-agent/library/threshold.py
import logging
import operator
import sys
import time


class Threshold(object):
    def __init__(self, **kwargs):
        self.log = logging.getLogger(self.__class__.__name__)
        self.id = kwargs.get("id")
        # I renamed 'delay' to 'duration' to indicate that we're not delaying
        # reporting an exceeded threshold, but instead we're checking if it is
        # being exceded for a duration of time.
        self.duration = kwargs.get("delay", 0)
        # I renamed 'value' to 'limit' to distinguish it from the check value.
        self.limit = kwargs.get("value", 0)
        self.operator = kwargs.get("operator", None)
        self.reported = False

    # The logging library interferes with cPickle, so we must remove the logger
    # instance then reset it when we serialize/unserialize.
    def __getstate__(self):
        state = dict(self.__dict__)
        del state["log"]
        return state

    def __setstate__(self, state):
        self.__dict__.update(state)
        self.log = logging.getLogger(self.__class__.__name__)

    def limit_exceeded(self, value):
        if self.operator is None:
            self.log.debug("Threshold %s is a null threshold", self.id)
            return None

        operation = getattr(operator, self.operator)
        self.log.debug(
            "Testing if value (%.2f) is %s threshold %s's limit (%.2f)",
            value,
            self.operator,
            self.id,
            self.limit,
        )

        return operation(value, self.limit)

Youez - 2016 - github.com/yon3zu
LinuXploit