From d4c2eb5485fe6548381b8147144ef13f237ec55d Mon Sep 17 00:00:00 2001
From: Paul Belanger <pabelanger@redhat.com>
Date: Sun, 15 Oct 2017 10:52:35 -0400
Subject: [PATCH] Fix grep error when listing ifName values

Currently, Known values for ifName for host 99: (name) is outputed
when we search for ifName values.

  # php -q /usr/share/cacti/cli/add_graphs.php --host-id=99 --snmp-field=ifName --list-snmp-values
  Known values for ifName for host 99: (name)
  eth0
  eth1
  lo

This triggers about (2.9M) of errors emailed out to infra-root users
on each run. Use grep to hide "Known values" and hopefully make our
emails much smaller.

Change-Id: I76058a107960cbca95995646c83b6d714e41f732
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
---
 modules/openstack_project/files/cacti/create_graphs.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/openstack_project/files/cacti/create_graphs.sh b/modules/openstack_project/files/cacti/create_graphs.sh
index 2fa325ecef..6fc2d65c0c 100644
--- a/modules/openstack_project/files/cacti/create_graphs.sh
+++ b/modules/openstack_project/files/cacti/create_graphs.sh
@@ -67,7 +67,8 @@ add_ds_graph "Host MIB - Available Disk Space" "Available Disk Space" \
 SNMP_QUERY_ID=`php -q add_graphs.php --host-id=$HOST_ID --list-snmp-queries | \
     grep "SNMP - Interface Statistics"|cut -f 1`
 
-for iface in $(php -q /usr/share/cacti/cli/add_graphs.php --host-id=$HOST_ID --snmp-field=ifName --list-snmp-values | grep -v tap| grep -v brq) ; do
+for iface in $(php -q /usr/share/cacti/cli/add_graphs.php --host-id=$HOST_ID --snmp-field=ifName --list-snmp-values | \
+    grep -v -e "Known values" -e tap -e brq) ; do
 add_ds_graph "Interface - Traffic (bits/sec)" "In/Out Bits (64-bit Counters)" \
     "ifName" "$iface"
 add_ds_graph "Interface - Errors/Discards" "In/Out Errors/Discarded Packets" \