Ejemplo n.º 1
0
    def from_configparser(
            cls, section: ConfigParserSection,
            daemon_cli_config: DaemonCLIConfig) -> "DaemonConfig":
        pidfile = first_not_none(
            daemon_cli_config.pidfile,
            section.get("pidfile", fallback=DEFAULT_PIDFILE))
        if pidfile is not None and not pidfile.strip():
            pidfile = None

        logfile = first_not_none(daemon_cli_config.logfile,
                                 section.get("logfile", fallback=None))

        interval = section.getint("interval", fallback=5)

        exporter_listen_host = first_not_none(
            daemon_cli_config.exporter_listen_host,
            section.get("exporter_listen_host", fallback=None),
        )

        return cls(
            pidfile=pidfile,
            logfile=logfile,
            interval=interval,
            exporter_listen_host=exporter_listen_host,
        )
Ejemplo n.º 2
0
    def from_configparser(cls, section: ConfigParserSection) -> "Actions":
        panic = AlertCommands(
            enter_cmd=section.get("panic_enter_cmd", fallback=None),
            leave_cmd=section.get("panic_leave_cmd", fallback=None),
        )

        threshold = AlertCommands(
            enter_cmd=section.get("threshold_enter_cmd", fallback=None),
            leave_cmd=section.get("threshold_leave_cmd", fallback=None),
        )

        return cls(panic=panic, threshold=threshold)
Ejemplo n.º 3
0
 def from_configparser(cls, section: ConfigParserSection,
                       programs: Programs) -> BaseFanSpeed:
     return cls(
         section["name"],
         ipmi_sensors_bin=programs.ipmi_sensors,
         ipmi_sensors_extra_args=section.get("ipmi_sensors_extra_args",
                                             fallback=""),
     )
Ejemplo n.º 4
0
 def from_configparser(cls, section: ConfigParserSection) -> "Programs":
     return cls(
         hddtemp=section.get("hddtemp", fallback="hddtemp"),
         ipmi_sensors=section.get("ipmi_sensors", fallback="ipmi-sensors"),
     )