]> git.pld-linux.org Git - packages/cacti-template-mail_statistics.git/blob - cacti-template-mail_statistics.spec
ee28a3be611eda63c9bf68fc89dfb3519e2cdd76
[packages/cacti-template-mail_statistics.git] / cacti-template-mail_statistics.spec
1 %define         template        postfix
2 %include        /usr/lib/rpm/macros.perl
3 Summary:        Postifix monitoring with Cacti
4 Name:           cacti-template-%{template}
5 Version:        0.1
6 Release:        0.5
7 License:        GPL v2
8 Group:          Applications/WWW
9 Source0:        http://forums.cacti.net/download/file.php?id=4091#/postfix_mailserver.tar.gz
10 # Source0-md5:  3cd539df3669c72b0679f18cbf74f164
11 URL:            http://forums.cacti.net/about6657.html
12 BuildRequires:  rpm-perlprov >= 4.1-13
13 BuildRequires:  rpmbuild(macros) >= 1.554
14 Requires:       cacti
15 BuildArch:      noarch
16 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
17
18 %define         cactidir                /usr/share/cacti
19 %define         resourcedir             %{cactidir}/resource
20 %define         scriptsdir              %{cactidir}/scripts
21 %define         snmpdconfdir    /etc/snmp
22 %define         _libdir                 %{_prefix}/lib
23 %define         dbfile                  /var/spool/postfix/mailstats.db
24 %define         agentscript             %{_libdir}/snmpd-agent-cacti_postfix
25 # This is officially registered: http://www.oid-info.com/get/1.3.6.1.4.1.16606
26 %define         snmpoid                 .1.3.6.1.4.1.16606.2
27
28 %description
29 Postifix monitoring with Cacti.
30
31 %package -n net-snmp-agent-cacti_postfix
32 Summary:        SNMPd agent to provide Postfix stats
33 Group:          Networking/Daemons
34 Requires:       net-snmp
35
36 %description -n net-snmp-agent-cacti_postfix
37 SNMPd agent to provide Postfix stats for cacti.
38
39 %prep
40 %setup -qc
41
42 %install
43 rm -rf $RPM_BUILD_ROOT
44 install -d $RPM_BUILD_ROOT{%{resourcedir},%{scriptsdir},%{snmpdconfdir},%{_libdir}}
45 cp -a *.xml $RPM_BUILD_ROOT%{resourcedir}
46 install -p fetch_mail_statistics.pl $RPM_BUILD_ROOT%{agentscript}
47 # ghost the dbfile
48 install -d $RPM_BUILD_ROOT$(dirname %{dbfile})
49 touch $RPM_BUILD_ROOT%{dbfile}
50
51 %clean
52 rm -rf $RPM_BUILD_ROOT
53
54 %post
55 %cacti_import_template %{resourcedir}/cacti_host_template_postfix_mailserver.xml
56
57 %post -n net-snmp-agent-cacti_postfix
58 if ! grep -qF %{snmpoid} %{snmpdconfdir}/snmpd.local.conf; then
59         echo "extend %{snmpoid} cacti_postfix %{agentscript} /var/log/maillog %{dbfile} %{snmpoid}" >> %{snmpdconfdir}/snmpd.local.conf
60         %service -q snmpd reload
61 fi
62
63 %preun -n net-snmp-agent-cacti_postfix
64 if [ "$1" = 0 ]; then
65         if [ -f %{snmpdconfdir}/snmpd.local.conf ]; then
66                 %{__sed} -i -e "/extend %(echo %{snmpoid} | sed -e 's,\.,\\.,g')/d" %{snmpdconfdir}/snmpd.local.conf
67                 %service -q snmpd reload
68         fi
69 fi
70
71 %files
72 %defattr(644,root,root,755)
73 %{resourcedir}/*.xml
74
75 %files -n net-snmp-agent-cacti_postfix
76 %defattr(644,root,root,755)
77 %attr(755,root,root) %{agentscript}
78 %ghost %attr(700,root,root) %{dbfile}
This page took 0.072569 seconds and 2 git commands to generate.