From f740f8dc7041ba50356a79122f9871d841e93070 Mon Sep 17 00:00:00 2001 From: Spencer Krum Date: Wed, 24 Feb 2016 15:28:30 -0800 Subject: [PATCH] Run cacti's node generation from cron Change-Id: Id1220d83f78b5e60cb93c2343e59ca84ce3521e0 --- manifests/site.pp | 2 +- modules/openstack_project/manifests/cacti.pp | 17 ++++++++++++++++- .../openstack_project/manifests/cacti_device.pp | 9 --------- 3 files changed, 17 insertions(+), 11 deletions(-) delete mode 100644 modules/openstack_project/manifests/cacti_device.pp diff --git a/manifests/site.pp b/manifests/site.pp index 0f93705e08..8ae5747d74 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -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'), } } diff --git a/modules/openstack_project/manifests/cacti.pp b/modules/openstack_project/manifests/cacti.pp index 17fbf0e6fc..2c6a69eca1 100644 --- a/modules/openstack_project/manifests/cacti.pp +++ b/modules/openstack_project/manifests/cacti.pp @@ -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', + } + + } diff --git a/modules/openstack_project/manifests/cacti_device.pp b/modules/openstack_project/manifests/cacti_device.pp deleted file mode 100644 index 9bc980cf73..0000000000 --- a/modules/openstack_project/manifests/cacti_device.pp +++ /dev/null @@ -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'] - } -}