summaryrefslogtreecommitdiff
path: root/systemd.py
diff options
context:
space:
mode:
Diffstat (limited to 'systemd.py')
-rwxr-xr-xsystemd.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/systemd.py b/systemd.py
index 1f28195..18cdb77 100755
--- a/systemd.py
+++ b/systemd.py
@@ -34,19 +34,20 @@ def read():
dat = {
# These are the values of the
# basic/unit-name.h:UnitActiveStates enum.
- 'NActiveUnits': 0,
- 'NReloadingUnits': 0,
- 'NInactiveUnits': 0,
- 'NFailedUnits': 0,
- 'NActivatingUnits': 0,
- 'NDeactivatingUnits': 0
+ ('sd_units', 'active'): 0,
+ ('sd_units', 'reloading'): 0,
+ ('sd_units', 'inactive'): 0,
+ ('sd_units', 'failed'): 0,
+ ('sd_units', 'activating'): 0,
+ ('sd_units', 'deactivating'): 0,
}
for unit in system_manager.ListUnits():
- key = str('N%sUnits' % unit[3].capitalize())
+ key = ('sd_units', str(unit[3]))
dat[key] = dat[key] + 1
- for prop in ['NJobs', 'NInstalledJobs', 'NFailedJobs']:
- dat[prop] = int(get_property(system_manager, prop))
+ dat[('sd_jobs', 'queued')] = int(get_property(system_manager, 'NJobs'))
+ dat[('sd_jobs', 'installed')] = int(get_property(system_manager, 'NInstalledJobs'))
+ dat[('sd_jobs', 'failed')] = int(get_property(system_manager, 'NFailedJobs'))
return dat
@@ -62,8 +63,8 @@ else:
for (key, val) in iteritems(read()):
collectd.Values(
plugin='systemd',
- type='count',
- type_instance=key
+ type=key[0],
+ type_instance=key[1]
).dispatch(
values=[val]
)