예제 #1
0
파일: sensors.py 프로젝트: xificurk/smt
    def __init__(self, temperatures):
        """
        Arguments:
            temperatures    --- List of temperature sensors to monitor.

        """
        Plugin.__init__(self)
        for sensor in temperatures:
            self.add_datasource("temp_{}".format(sensor), "GAUGE", title=sensor, description="Temperature of sensor {}.".format(sensor))
예제 #2
0
파일: hddtemp.py 프로젝트: xificurk/smt
    def __init__(self, drives):
        """
        Arguments:
            drives          --- List of drives to monitor, e.g. ("/dev/sda", "SATA:/dev/sdb").

        """
        Plugin.__init__(self)
        for drive in drives:
            drive_name = drive.split(":")[-1]
            self.add_datasource(drive, "GAUGE", title=drive_name, description="Temperature of drive {}.".format(drive_name))
예제 #3
0
파일: loadavg.py 프로젝트: xificurk/smt
    def __init__(self, intervals=("5min",)):
        """
        Keyworded arguments:
            intervals       --- Load average intervals to monitor (1min, 5min, 15min).

        """
        Plugin.__init__(self)
        for interval in intervals:
            if interval not in self._intervals:
                raise ValueError("Invalid load average interval {!r}.".format(interval))
            self.add_datasource(interval, "GAUGE", min_=0, title="{} load".format(interval), description="{} system load average.".format(interval))
예제 #4
0
파일: usage.py 프로젝트: xificurk/smt
 def __init__(self):
     Plugin.__init__(self)
     self.add_datasource(
         "uptime",
         "GAUGE",
         min_=0,
         max_=1,
         unknown=0,
         archives=[ArchiveGroup(cfs=("AVERAGE",))],
         title="Uptime",
         description="Uptime ratio.",
     )
예제 #5
0
파일: auth.py 프로젝트: xificurk/smt
    def __init__(self, methods=("su", "login", "sshd")):
        """
        Arguments:
            methods     --- Authentication methods to monitor, the rest goes to 'other'.

        """
        Plugin.__init__(self)
        conf = {"min_": 0, "unknown": 0, "archives": [ArchiveGroup(cfs=("AVERAGE",))]}
        for name in methods:
            description = "Authentication failures using {}.".format(name)
            self.add_datasource(name, "DERIVE", description=description, **conf)
        if len(methods) > 0:
            self.add_datasource("other", "DERIVE", description="Other authentication failures.", **conf)
        self.add_datasource("total", "DERIVE", description="Total authentication failures.", warning=self.warning, critical=self.critical, **conf)
예제 #6
0
파일: net.py 프로젝트: xificurk/smt
    def __init__(self, interfaces):
        """
        Arguments:
            interfaces  --- Names of interfaces to monitor.

        """
        Plugin.__init__(self)
        for interface in interfaces:
            name = "{}:in".format(interface)
            title = "{} in".format(interface)
            description = "Incoming traffic on interface {}.".format(interface)
            self.add_datasource(name, "COUNTER", title=title, description=description, min_=0, unknown=0)
            name = "{}:out".format(interface)
            title = "{} out".format(interface)
            description = "Outgoing traffic on interface {}.".format(interface)
            self.add_datasource(name, "COUNTER", title=title, description=description, min_=0, unknown=0)
예제 #7
0
파일: smart.py 프로젝트: xificurk/smt
    def __init__(self, drive, columns):
        """
        Arguments:
            drive       --- Name of the drive to monitor (e.g. sda).
            columns     --- Iterable with column names to monitor.

        """
        if re.match("^[a-z0-9]+$", drive, re.I) is None:
            raise ValueError("Invalid drive name {!r}.".format(drive))
        self._drive = "/dev/{}".format(drive)
        self.name = "smart_{}".format(drive)
        Plugin.__init__(self)
        conf = {"min_": 0, "heartbeat": 3*24*3600, "step": 1800, "archives": [ArchiveGroup(cfs=("AVERAGE",), templates=("week", "month", "year"))]}
        description = "{{}} S.M.A.R.T. value for drive {}.".format(drive)
        title = "{} {{}}".format(drive)
        for name in columns:
            if name not in self._columns:
                raise ValueError("Unknown column name {!r}.".format(column))
            column = name.replace("_", " ")
            self.add_datasource(name, "GAUGE", title=title.format(column), description=description.format(drive), **conf)
예제 #8
0
파일: cpu.py 프로젝트: xificurk/smt
 def __init__(self):
     Plugin.__init__(self)
     max_ = multiprocessing.cpu_count()*100
     for name, description in self._descriptions.items():
         self.add_datasource(name, "COUNTER", description=description, min_=0, max_=max_, archives=[ArchiveGroup(cfs=("AVERAGE",))])
예제 #9
0
파일: memory.py 프로젝트: xificurk/smt
 def __init__(self):
     Plugin.__init__(self)
     for name, description in self._descriptions.items():
         self.add_datasource(name, "GAUGE", description=description, min_=0, archives=[ArchiveGroup(cfs=("AVERAGE",))])
예제 #10
0
파일: users.py 프로젝트: xificurk/smt
 def __init__(self):
     Plugin.__init__(self)
     self.add_datasource("logins", "GAUGE", min_=0, title="Logins", description="Number of logged in users.")
     self.add_datasource("users", "GAUGE", min_=0, title="Users", description="Number of unique logged in users.")