def init(self): self.sensor = Sensor.find('power') self.append(self.ui.inflate('power:widget')) self.find('ac').visible = self.sensor.value() == 'ac' self.find('battery').visible = self.sensor.value() == 'battery' charge = Sensor.find('battery').value() self.find('charge').value = charge[0] * 1.0 / charge[1]
def init(self): self.sensor = Sensor.find('power') self.append(self.ui.inflate('power:widget')) self.find('ac').visible = self.sensor.value() == 'ac' self.find('battery').visible = self.sensor.value() == 'battery' charge = Sensor.find('battery').value() self.find('charge').value = charge[0] * 1.0 / charge[1] self.powerctl = PowerController.get() caps = self.powerctl.capabilities() for cap in ('shutdown', 'suspend', 'hibernate', 'reboot'): self.find(cap).visible = cap in caps
def init(self): self.sensor = Sensor.find('power') self.append(self.ui.inflate('power:widget')) self.find('ac').visible = self.sensor.value() == 'ac' self.find('battery').visible = self.sensor.value() == 'battery' charge = Sensor.find('battery').value() self.find('charge').value = charge[0] * 1.0 / charge[1] try: subprocess.call(['which', 'pm-suspend']) except: self.find('suspend').visible = False try: subprocess.call(['which', 'pm-hibernate']) except: self.find('hibernate').visible = False
def worker(self): if not ENDPOINT: return while True: datapack = {'sensors': {}} for sensor in Sensor.get_all(): data = {} for variant in sensor.get_variants(): data[variant] = sensor.value(variant) datapack['sensors'][sensor.id] = data gevent.sleep(10) url = ENDPOINT % ajenti.config.tree.installation_id if not self.get_key(): continue try: requests.post(url, data={ 'data': json.dumps(datapack), 'key': self.get_key() }) self.last_report = datetime.now() self.last_error = None except Exception, e: self.last_error = e
def refresh(self): self.find('header').hostname = Sensor.find('hostname').value() self.dash.empty() for widget in self.classconfig['widgets']: for cls in DashboardWidget.get_classes(): if cls.classname == widget['class']: if not UserManager.get().has_permission(self.context, WidgetPermissions.name_for(cls)): continue try: instance = cls.new( self.ui, container=widget['container'], index=widget['index'], config=widget['config'], ) except Exception, e: traceback.print_exc() instance = CrashedWidget.new( self.ui, container=widget['container'], index=widget['index'], config=widget['config'], ) instance.classname = cls.classname instance.set(e) instance.on('save-config', self.on_widget_config, widget, instance) self.dash.append(instance)
def init(self): self.sensor = Sensor.find('uptime') self.append(self.ui.inflate('sensors:value-widget')) self.find('icon').text = 'off' self.find('name').text = 'Uptime' self.find('value').text = str_timedelta(self.sensor.value())
def worker(self): if not ENDPOINT: return while True: datapack = {'sensors': {}} for sensor in Sensor.get_all(): data = {} for variant in sensor.get_variants(): data[variant] = sensor.value(variant) datapack['sensors'][sensor.id] = data gevent.sleep(3) url = ENDPOINT % ajenti.config.tree.installation_id if not self.get_key(): continue try: requests.post(url, data={ 'data': json.dumps(datapack), 'key': self.get_key() }) self.last_report = datetime.now() self.last_error = None except Exception, e: self.last_error = e
def refresh(self): self.find('header').hostname = Sensor.find('hostname').value() self.dash.empty() for widget in self.classconfig['widgets']: for cls in DashboardWidget.get_classes(): if cls.classname == widget['class']: if not UserManager.get().has_permission( self.context, WidgetPermissions.name_for(cls)): continue try: instance = cls.new( self.ui, container=widget['container'], index=widget['index'], config=widget['config'], ) except Exception, e: traceback.print_exc() instance = CrashedWidget.new( self.ui, container=widget['container'], index=widget['index'], config=widget['config'], ) instance.classname = cls.classname instance.set(e) instance.on('save-config', self.on_widget_config, widget, instance) self.dash.append(instance)
def init(self): self.sensor = Sensor.find("uptime") self.append(self.ui.inflate("sensors:value-widget")) self.find("icon").text = "off" self.find("name").text = "Uptime" self.find("value").text = str_timedelta(self.sensor.value())
def send_init(self): data = { 'version': ajenti.version, 'platform': ajenti.platform, 'hostname': Sensor.find('hostname').value(), } self.emit('init', json.dumps(data))
def init( self ): self.sensor = Sensor.find( 'lvm' ) self.append(self.ui.inflate( 'lvm:lvm-widget' ) ) self.find( 'icon' ).icon = 'hdd' self.find( 'name' ).text = _( 'LVM status' ) lvm = self.sensor.value() for group in lvm.Groups: group_box = self.ui.inflate( 'lvm:lvm-widget-gline' ) group_box.find( 'group' ).text = group.name group_box.find( 'lines' ).append( line ) for volume in group.Volumes: line = self.ui.inflate( 'lvm:lvm-widget-vline' ) line.find( 'volume' ).text = volume.name progress = line.find( 'progress' ) progress.value = volume.Size status = line.find( 'status' ) status.text = device.stateText group_box.find( 'lines' ).append( line ) # next self.find( 'lines' ).append( group_box ) # next # end def # end class
def init(self): self.sensor = Sensor.find('load') self.append(self.ui.inflate('sensors:value-widget')) self.find('icon').icon = 'signal' self.find('name').text = _('Load average') self.find('value').text = ' / '.join( str(self.sensor.value(x)) for x in self.sensor.get_variants())
def init(self): self.sensor = Sensor.find("memory") self.append(self.ui.inflate("sensors:progressbar-widget")) self.find("icon").icon = "tasks" self.find("name").text = "Memory usage" value = self.sensor.value() self.find("value").text = str_fsize(value[0]) self.find("progress").value = 1.0 * value[0] / value[1]
def init(self): self.sensor = Sensor.find('memory') self.append(self.ui.inflate('sensors:progressbar-widget')) self.find('icon').icon = 'tasks' self.find('name').text = _('Memory usage') value = self.sensor.value() self.find('value').text = str_fsize(value[0]) self.find('progress').value = 1.0 * value[0] / value[1]
def send_init(self): data = { 'version': ajenti.version, 'platform': ajenti.platform, 'hostname': Sensor.find('hostname').value(), 'session': self.context.session.id, 'feedback': ajenti.config.tree.enable_feedback, 'edition': ajenti.edition, } self.emit('init', json.dumps(data))
def send_init(self): data = { "version": ajenti.version, "platform": ajenti.platform, "hostname": Sensor.find("hostname").value(), "session": self.context.session.id, "feedback": ajenti.config.tree.enable_feedback, "edition": ajenti.edition, } self.emit("init", json.dumps(data))
def init(self): self.sensor = Sensor.find('cpu') self.append(self.ui.inflate('sensors:cpu-widget')) self.find('icon').icon = 'signal' self.find('name').text = _('CPU usage') for value in self.sensor.value(): l = self.ui.inflate('sensors:cpu-line') l.find('progress').value = value l.find('value').text = '%i%%' % int(value * 100) self.find('lines').append(l)
def init(self): self.sensor = Sensor.find("cpu") self.append(self.ui.inflate("sensors:cpu-widget")) self.find("icon").icon = "signal" self.find("name").text = "CPU usage" for value in self.sensor.value(): l = self.ui.inflate("sensors:cpu-line") l.find("progress").value = value l.find("value").text = "%i%%" % int(value * 100) self.find("lines").append(l)
def init(self): self.sensor = Sensor.find("swap") self.append(self.ui.inflate("sensors:progressbar-widget")) self.find("icon").icon = "hdd" self.find("name").text = "Swap usage" value = self.sensor.value() self.find("value").text = str_fsize(value[0]) if value[1] > 0: frac = 1.0 * value[0] / value[1] else: frac = 0 self.find("progress").value = frac
def init(self): self.sensor = Sensor.find('swap') self.append(self.ui.inflate('sensors:progressbar-widget')) self.find('icon').icon = 'hdd' self.find('name').text = _('Swap usage') value = self.sensor.value() self.find('value').text = str_fsize(value[0]) if value[1] > 0: frac = 1.0 * value[0] / value[1] else: frac = 0 self.find('progress').value = frac
def refresh(self): self.find('header').hostname = Sensor.find('hostname').value() self.dash.empty() for widget in self.classconfig['widgets']: for cls in DashboardWidget.get_classes(): if cls.classname == widget['class']: instance = cls.new( self.ui, container=widget['container'], index=widget['index'], config=widget['config'], ) instance.on('save-config', self.on_widget_config, widget, instance) self.dash.append(instance)
def init(self): self.sensor = Sensor.find('mdadm') self.append(self.ui.inflate('mdadm:mdadm-widget')) self.find('icon').icon = 'hdd' self.find('name').text = _('MDADM status') mdadm = self.sensor.value() for device in mdadm.Devices: line = self.ui.inflate('mdadm:mdadm-widget-line') line.find('device').text = device.name status = line.find('status') progress = line.find('progress') progress.visible = ( device.showRecovery ) if progress.visible: log.debug("progress.value: '%s' = '%s'" % ( device.progress, device.progress / 100 )) progress.value = float(device.progress / 100) log.debug("progress.value: '%f'" % ( progress.value )) # end if status.text = device.stateText self.find('lines').append(line)
def refresh(self): self.find("header").hostname = Sensor.find("hostname").value() self.dash.empty() for widget in self.classconfig["widgets"]: for cls in DashboardWidget.get_classes(): if cls.classname == widget["class"]: if not UserManager.get().has_permission(WidgetPermissions.name_for(cls)): continue try: instance = cls.new( self.ui, container=widget["container"], index=widget["index"], config=widget["config"] ) except Exception, e: traceback.print_exc() instance = CrashedWidget.new( self.ui, container=widget["container"], index=widget["index"], config=widget["config"] ) instance.classname = cls.classname instance.set(e) instance.on("save-config", self.on_widget_config, widget, instance) self.dash.append(instance)
def init(self): self.sensor = Sensor.find("lvm") self.append(self.ui.inflate("lvm:lvm-widget")) self.find("icon").icon = "hdd" self.find("name").text = _("LVM status") lvm = self.sensor.value() for group in lvm.Groups: group_box = self.ui.inflate("lvm:lvm-widget-gline") group_box.find("group").text = group.name group_box.find("lines").append(line) for volume in group.Volumes: line = self.ui.inflate("lvm:lvm-widget-vline") line.find("volume").text = volume.name progress = line.find("progress") progress.value = volume.Size status = line.find("status") status.text = device.stateText group_box.find("lines").append(line) # next self.find("lines").append(group_box)
def on_prepare(self): self.sensor = Sensor.find('lm-sensors') self.append(self.ui.inflate('lm_sensors:widget'))
def on_prepare(self): self.sensor = Sensor.find('hdparm_state') self.append(self.ui.inflate('hdparm:widget'))
def on_prepare(self): self.sensor = Sensor.find('disk-usage') self.append(self.ui.inflate('fstab:free-widget'))
def on_prepare(self): self.sensor = Sensor.find("hdd-temp") self.append(self.ui.inflate("hddtemp:widget"))
def on_prepare(self): self.sensor = Sensor.find('smart') self.append(self.ui.inflate('smartctl:widget'))
def on_prepare(self): self.sensor_write = Sensor.find('immediate-write') self.sensor_read = Sensor.find('immediate-read') self.append(self.ui.inflate('fstab:iio-widget'))
def init(self): self.sensor = Sensor.find('load') self.append(self.ui.inflate('sensors:value-widget')) self.find('icon').icon = 'signal' self.find('name').text = _('Load average') self.find('value').text = ' / '.join(str(self.sensor.value(x)) for x in self.sensor.get_variants())
def on_prepare(self): self.sensor = Sensor.find('hdd-temp') self.append(self.ui.inflate('hddtemp:widget'))
def init(self): self.append(self.ui.inflate('mpd:widget')) Binder(Sensor.find('mpd').value(), self.find('mpd')).populate()
def on_prepare(self): self.sensor = Sensor.find('traffic') self.append(self.ui.inflate('network:widget'))
def on_prepare(self): self.sensor = Sensor.find('ipmi') self.append(self.ui.inflate('ipmi:widget'))
def on_prepare(self): self.sensor = Sensor.find('traffic') self.sensor_tx = Sensor.find('immediate-tx') self.sensor_rx = Sensor.find('immediate-rx') self.append(self.ui.inflate('network:widget'))
def init(self): self.sensor = Sensor.find('memcache') self.append(self.ui.inflate('memcache:widget')) value = self.sensor.value() self.find('value').text = str_fsize(value[0]) self.find('progress').value = 1.0 * value[0] / value[1]
def init(self): self.sensor = Sensor.find('ups') self.append(self.ui.inflate('apcups:widget')) value = self.sensor.value() self.find('charge').value = value[0] self.find('time').text = value[1]
def send_init(self): data = {"version": ajenti.version, "platform": ajenti.platform, "hostname": Sensor.find("hostname").value()} self.emit("init", json.dumps(data))