From ac8412d34d31f121a893e8a493e5bec619e4cc78 Mon Sep 17 00:00:00 2001
From: Monty Taylor <mordred@inaugust.com>
Date: Sat, 5 Jul 2014 12:18:57 -0700
Subject: [PATCH] Fix the constant failure of puppet on cacti

First of all, the apache config file goes in a different direcetory.
Secondly, the graph creation is trying to make graphs for disks that
are hardcoded and don't exist for a given host.

Change-Id: Ie277f3959b7a01e71ed437582b0155e5fc5bef02
---
 .../files/cacti/create_graphs.sh                  | 15 ++++++---------
 modules/openstack_project/manifests/cacti.pp      |  2 +-
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/modules/openstack_project/files/cacti/create_graphs.sh b/modules/openstack_project/files/cacti/create_graphs.sh
index 8f15132ad1..3ca64245fc 100644
--- a/modules/openstack_project/files/cacti/create_graphs.sh
+++ b/modules/openstack_project/files/cacti/create_graphs.sh
@@ -72,12 +72,9 @@ add_ds_graph "Interface - Non-Unicast Packets" "In/Out Non-Unicast Packets" \
 SNMP_QUERY_ID=`php -q add_graphs.php --host-id=$HOST_ID --list-snmp-queries | \
   grep "ucd/net - Get IO Devices"|cut -f 1`
 
-add_ds_graph "ucd/net - Device IO - Operations" "IO Operations" \
-  "diskIODevice" "xvda"
-add_ds_graph "ucd/net - Device IO - Throughput" "IO Throughput" \
-  "diskIODevice" "xvda"
-
-add_ds_graph "ucd/net - Device IO - Operations" "IO Operations" \
-  "diskIODevice" "xvdc"
-add_ds_graph "ucd/net - Device IO - Throughput" "IO Throughput" \
-  "diskIODevice" "xvdc"
+for disk in $(php -q add_graphs.php --host-id=$HOST_ID --snmp-field=diskIODevice --list-snmp-values | grep xvd[a-z]$) ; do
+    add_ds_graph "ucd/net - Device IO - Operations" "IO Operations" \
+        "diskIODevice" "$disk"
+    add_ds_graph "ucd/net - Device IO - Throughput" "IO Throughput" \
+        "diskIODevice" "$disk"
+done
diff --git a/modules/openstack_project/manifests/cacti.pp b/modules/openstack_project/manifests/cacti.pp
index 3f6c6baae7..f364d6e3f1 100644
--- a/modules/openstack_project/manifests/cacti.pp
+++ b/modules/openstack_project/manifests/cacti.pp
@@ -19,7 +19,7 @@ class openstack_project::cacti (
     ensure => present,
   }
 
-  file { '/etc/apache2/conf-available/cacti.conf':
+  file { '/etc/apache2/conf.d/cacti.conf':
     ensure  => present,
     source  => 'puppet:///modules/openstack_project/cacti/apache.conf',
     mode    => '0644',