diff options
author | Ramesh Nachimuthu <rnachimu@redhat.com> | 2014-07-11 15:45:32 +0530 |
---|---|---|
committer | Sahina Bose <sabose@redhat.com> | 2014-10-29 23:41:16 -0700 |
commit | 11f96adbb1f8bff8cf7b385da10200a5627d980a (patch) | |
tree | 1bb003f820d477769d80292e3416f25579640cdf | |
parent | 0ef0715b35850a69cb43805844fc6b9fe4c10b1f (diff) |
packaging: install temp_node1.cfg only for the first time
Installing temp_node1.cfg conditionally during first installation
only. It won't be re-installed during upgrade.
Change-Id: I26cc945d5b8b650d8457b7232d9dc0f3c5eac105
Bug-Url: https://bugzilla.redhat.com/1115387
Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com>
Reviewed-on: http://review.gluster.org/8303
Reviewed-by: Sahina Bose <sabose@redhat.com>
Tested-by: Sahina Bose <sabose@redhat.com>
-rw-r--r-- | config/Makefile.am | 1 | ||||
-rw-r--r-- | config/temp_node1.cfg | 20 | ||||
-rw-r--r-- | nagios-server-addons.spec.in | 27 |
3 files changed, 27 insertions, 21 deletions
diff --git a/config/Makefile.am b/config/Makefile.am index 9de557b..5c34e56 100644 --- a/config/Makefile.am +++ b/config/Makefile.am @@ -12,7 +12,6 @@ glusternagiosconf_DATA = \ glusternagiosdefaultconfdir = $(sysconfdir)/nagios/gluster/default glusternagiosdefaultconf_DATA = \ glustercluster.cfg.sample \ - temp_node1.cfg \ $(NULL) glusternagiosmibsdir = /usr/share/snmp/mibs diff --git a/config/temp_node1.cfg b/config/temp_node1.cfg deleted file mode 100644 index e049885..0000000 --- a/config/temp_node1.cfg +++ /dev/null @@ -1,20 +0,0 @@ -##################################################################### -# Configuration for dummy host temp_node1 with service check_ping # -# This dummy host is added to avoid nagios from erroring out before # -# auto-discovery script is run, This file will be renamed by auto- # -# discovery script to remove this configuration. # -##################################################################### - -define host{ - use linux-server - host_name temp_node1 - alias localhost - address 127.0.0.1 -} - -define service{ - use local-service - host_name temp_node1 - service_description PING - check_command check_ping!100.0,20%!500.0,60% -} diff --git a/nagios-server-addons.spec.in b/nagios-server-addons.spec.in index 23149d3..9a51759 100644 --- a/nagios-server-addons.spec.in +++ b/nagios-server-addons.spec.in @@ -126,6 +126,33 @@ rm -rf %{buildroot} NagiosCFGFile="/etc/nagios/nagios.cfg" sed -i '/etc\/nagios\/objects\/localhost.cfg/d' $NagiosCFGFile + +if [ "$1" -eq 1 ]; then +LocalhostCfgFile="%{_sysconfdir}/nagios/gluster/default/temp_node1.cfg" +cat > $LocalhostCfgFile << EOF +##################################################################### +# Configuration for dummy host temp_node1 with service check_ping # +# This dummy host is added to avoid nagios from erroring out before # +# auto-discovery script is run, This file will be renamed by auto- # +# discovery script to remove this configuration. # +##################################################################### + +define host{ + use linux-server + host_name temp_node1 + alias localhost + address 127.0.0.1 +} + +define service{ + use local-service + host_name temp_node1 + service_description PING + check_command check_ping!100.0,20%!500.0,60% +} +EOF +fi + if grep -q "#process_performance_data=0" $NagiosCFGFile; then sed -i -e 's/#process_performance_data=0/process_performance_data=1/g' $NagiosCFGFile elif grep -q "process_performance_data=0" $NagiosCFGFile ; then |