Add install_collectd()
function
This commit is contained in:
parent
6c78d3c1d5
commit
bdd89db30d
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2022 Lance Edgar
|
# Copyright © 2010-2023 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -24,12 +24,44 @@
|
||||||
Fabric library for collectd
|
Fabric library for collectd
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from rattail_fabric2 import make_deploy
|
from rattail_fabric2 import apt, make_deploy, sed
|
||||||
|
|
||||||
|
|
||||||
deploy = make_deploy(__file__)
|
deploy = make_deploy(__file__)
|
||||||
|
|
||||||
|
|
||||||
|
def install_collectd(c, interval=None, rrdtool=None, restart_=False):
|
||||||
|
"""
|
||||||
|
Install the ``collectd`` service.
|
||||||
|
|
||||||
|
:param interval: Optional override for the collectd ``Interval``
|
||||||
|
setting.
|
||||||
|
"""
|
||||||
|
apt.install(c, 'collectd')
|
||||||
|
|
||||||
|
if interval:
|
||||||
|
sed(c, '/etc/collectd/collectd.conf',
|
||||||
|
r'^#? ?Interval\s+[0-9]+.*$',
|
||||||
|
'Interval {}'.format(interval),
|
||||||
|
use_sudo=True)
|
||||||
|
|
||||||
|
if rrdtool is not None:
|
||||||
|
sed(c, '/etc/collectd/collectd.conf',
|
||||||
|
r'^#? ?LoadPlugin rrdtool\s*$',
|
||||||
|
'{}LoadPlugin rrdtool'.format('' if rrdtool else '#'),
|
||||||
|
use_sudo=True)
|
||||||
|
|
||||||
|
if restart_:
|
||||||
|
restart(c)
|
||||||
|
|
||||||
|
|
||||||
|
def restart(c):
|
||||||
|
"""
|
||||||
|
Restart the collectd service.
|
||||||
|
"""
|
||||||
|
c.sudo('systemctl restart collectd')
|
||||||
|
|
||||||
|
|
||||||
def deploy_mountpoint_check_script(c, dest, **kwargs):
|
def deploy_mountpoint_check_script(c, dest, **kwargs):
|
||||||
"""
|
"""
|
||||||
Deploy generic mountpoint check script to specified destination.
|
Deploy generic mountpoint check script to specified destination.
|
||||||
|
|
Loading…
Reference in a new issue