LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File nagvis.spec of Package nagvis (Project home:jdbungart:monitoring)

# spec file for package nagvis

Name:           nagvis
Version:        1.5.8
Release:        1
License:        GPLv2 only
Summary:        Visualization addon for Nagios
Url:            http://www.nagvis.org/
Group:          Productivity/Networking/Web/Utilities
Source:         %name-%version.tar.bz2
Source1:        nagvis-rpmlintrc
Source2:        nagvis-include.conf
BuildArch:      noarch
PreReq:         %insserv_prereq
BuildRequires:  apache2-devel
%if 0%{?suse_version} > 1020
BuildRequires:  fdupes
Requires:       graphviz
Requires:       php5-ZendFramework
Requires:       php-gd
Requires:       php-gettext
Requires:       php-mbstring
Requires:       php-mysql
Requires:       php-session
Requires:       php-sockets
Requires:       php5-pear-xml_parser
Recommends:     nagios-www
Recommends:     ndoutils
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%define         wwwusr wwwrun
%define         wwwgrp www
%define         apache2_sysconfdir %(/usr/sbin/apxs2 -q SYSCONFDIR)/conf.d
%define         installdir %{_datadir}/%{name}

NagVis can be used to visualize Nagios Data, e.g. to display IT
processes like a mail system or a network infrastructure.

Key features are:
    * Display of single Hosts and Services
    * Visualize a complete Host- oder Servicegroup with one icon
    * Display the state of a Host dependent on the state of
      its services (“recognize services”)
    * Display only the real problems (“only_hard_states”)
    * Define Sub-Map icons wich represent a complete NagVis
      Map of Hosts/Services/Groups in one icon (drill down)
    * Visualization/Documentation of complete IT Processes
      and Infrastructures using self drawn graphics

    Andreas Husch,
    Lars Michelsen

%setup -q
find -name ".gitignore" | xargs rm
sed -i "s|\r||g" LICENCE
chmod -x share/server/core/ext/php-gettext*/*.php


mkdir -p %{buildroot}%{installdir}
cp -r share %{buildroot}%{installdir}
cp -r docs %{buildroot}%{installdir}/share/

# configurations belong to /etc (FHS)
install -d -m 755 %{buildroot}%{_sysconfdir}/%{name}
cp -r etc/maps %{buildroot}%{_sysconfdir}/%{name}
cp -r etc/automaps %{buildroot}%{_sysconfdir}/%{name}
cp -r etc/geomap %{buildroot}%{_sysconfdir}/%{name}
install -m 644 etc/nagvis.ini.php-sample \
pushd %{buildroot}%{installdir}
ln -s ../../..%{_sysconfdir}/%{name} etc

# install directories needed during runtime
install -d -m 755 %{buildroot}%{_sysconfdir}/%{name}/{maps,automaps,geomaps}
install -d -m 755 %{buildroot}%{_var}/cache/%{name}
install -d -m 755 %{buildroot}%{_var}/cache/%{name}/tmpl
install -d -m 755 %{buildroot}%{_var}/cache/%{name}/tmpl/cache
install -d -m 755 %{buildroot}%{_var}/cache/%{name}/tmpl/compile
pushd %{buildroot}%{installdir}
ln -s ../../..%{_var}/cache/%{name} var

# fix nagvis config
sed "s|;base=.*|base=\"%{installdir}/\"|; \
     s|;htmlbase=.*|htmlbase=\"/%{name}/\"|; \
	 s|var=.*|var=\"%{_var}/cache/nagvis/\"|; \
	 s|mapcfg=.*|mapcfg=\"%{_sysconfdir}/%{name}/maps/\"|; \
	 s|cfg=.*|cfg=\"%{_sysconfdir}/%{name}/\"|;" \
	%{buildroot}%{_sysconfdir}/%{name}/nagvis.ini.php > %{buildroot}%{_sysconfdir}/%{name}/nagvis.ini.php.new
mv %{buildroot}%{_sysconfdir}/%{name}/nagvis.ini.php.new %{buildroot}%{_sysconfdir}/%{name}/nagvis.ini.php

# install apache config
install -Dm644 %{SOURCE2} %{buildroot}%{apache2_sysconfdir}/%{name}.conf

%if 0%{?suse_version} > 1020
# save some space - relink
%fdupes %{buildroot}

rm -rf %{buildroot}

if [ ${1:-0} -lt 1 ]; then
	if [ %{_sbindir}/a2enmod ]; then
		%{_sbindir}/a2enmod php5 >/dev/null
%restart_on_update apache2

%restart_on_update apache2

%config(noreplace) %{apache2_sysconfdir}/%{name}.conf
%dir %{installdir}
%dir %{_sysconfdir}/%{name}
%dir %{_sysconfdir}/%{name}/maps
%dir %{_sysconfdir}/%{name}/automaps
%dir %{_sysconfdir}/%{name}/geomap
%dir %{_var}/cache/%{name}
%dir %{_var}/cache/%{name}/tmpl
%dir %{_var}/cache/%{name}/tmpl/cache
%dir %{_var}/cache/%{name}/tmpl/compile
%config(noreplace) %{_sysconfdir}/nagvis/nagvis.ini.php
%config(noreplace) %{_sysconfdir}/nagvis/maps/*.cfg
%config(noreplace) %{_sysconfdir}/nagvis/automaps/*.cfg
%config(noreplace) %{_sysconfdir}/nagvis/geomap/*.xml