Run cacti's node generation from cron

Change-Id: Id1220d83f78b5e60cb93c2343e59ca84ce3521e0
This commit is contained in:
Spencer Krum 2016-02-24 15:28:30 -08:00
parent 744b62c6af
commit f740f8dc70
3 changed files with 17 additions and 11 deletions

View File

@ -211,7 +211,7 @@ node 'cacti.openstack.org' {
include openstack_project::ssl_cert_check
class { 'openstack_project::cacti':
sysadmins => hiera('sysadmins', []),
cacti_hosts => hiera('cacti_hosts'),
cacti_hosts => hiera_array('cacti_hosts'),
}
}

View File

@ -73,5 +73,20 @@ class openstack_project::cacti (
require => File['/var/lib/cacti/linux_host.xml'],
}
openstack_project::cacti_device { $cacti_hosts: }
file { '/var/lib/cacti/devices':
ensure => present,
content => join($cacti_hosts, " "),
mode => '0744',
owner => 'root',
group => 'root',
}
cron { 'add cacti hosts':
ensure => present,
user => root,
command => 'for host in $(cat /var/lib/cacti/devices); do /usr/local/bin/create_graphs.sh $host; done',
minute => '0',
}
}

View File

@ -1,9 +0,0 @@
# Define that adds a host to a cacti installation.
# Takes the fqdn of the host as the namevar for this define.
define openstack_project::cacti_device()
{
exec { "cacti_create_${name}":
command => "/usr/local/bin/create_graphs.sh ${name}",
require => Exec['cacti_import_xml']
}
}