A simple replacement for i3status that is both extensible and customizable.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
700 B

import os
import subprocess
import random
import plugins
'hosts': tuple(), 'title': 'PING', 'timeout': 150
class PluginThread(plugins.PluginThreadCommon):
def __init__(self, config):
super(PluginThread, self).__init__(config, PING_DEFAULTS)
self.ping_cmd = ('fping', '-c1', '-qt' + str(self.conf['timeout']))
def main(self):
host = random.choice(self.conf['hosts'])
fping = subprocess.run(
(*self.ping_cmd, host),
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
if fping.returncode == 0:
self.format_status('down', True)