]> git.pld-linux.org Git - packages/cacti-template-mail_statistics.git/blame - cacti-template-mail_statistics.spec
- add dbfile to postfix dir, macor for agent script
[packages/cacti-template-mail_statistics.git] / cacti-template-mail_statistics.spec
CommitLineData
886f2a9e
ER
1%define template postfix
2%include /usr/lib/rpm/macros.perl
3Summary: Postifix monitoring with Cacti
4Name: cacti-template-%{template}
5Version: 0.1
b110e13e 6Release: 0.5
886f2a9e
ER
7License: GPL v2
8Group: Applications/WWW
9Source0: http://forums.cacti.net/download/file.php?id=4091#/postfix_mailserver.tar.gz
10# Source0-md5: 3cd539df3669c72b0679f18cbf74f164
11URL: http://forums.cacti.net/about6657.html
12BuildRequires: rpm-perlprov >= 4.1-13
13BuildRequires: rpmbuild(macros) >= 1.554
14Requires: cacti
15BuildArch: noarch
16BuildRoot: %{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
b110e13e
ER
23%define dbfile /var/spool/postfix/mailstats.db
24%define agentscript %{_libdir}/snmpd-agent-cacti_postfix
886f2a9e
ER
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
29Postifix monitoring with Cacti.
30
31%package -n net-snmp-agent-cacti_postfix
32Summary: SNMPd agent to provide Postfix stats
33Group: Networking/Daemons
34Requires: net-snmp
35
36%description -n net-snmp-agent-cacti_postfix
37SNMPd agent to provide Postfix stats for cacti.
38
39%prep
40%setup -qc
41
42%install
43rm -rf $RPM_BUILD_ROOT
44install -d $RPM_BUILD_ROOT{%{resourcedir},%{scriptsdir},%{snmpdconfdir},%{_libdir}}
45cp -a *.xml $RPM_BUILD_ROOT%{resourcedir}
b110e13e
ER
46install -p fetch_mail_statistics.pl $RPM_BUILD_ROOT%{agentscript}
47# ghost the dbfile
48install -d $RPM_BUILD_ROOT$(dirname %{dbfile})
49touch $RPM_BUILD_ROOT%{dbfile}
886f2a9e
ER
50
51%clean
52rm -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
58if ! grep -qF %{snmpoid} %{snmpdconfdir}/snmpd.local.conf; then
b110e13e 59 echo "extend %{snmpoid} cacti_postfix %{agentscript} /var/log/maillog %{dbfile} %{snmpoid}" >> %{snmpdconfdir}/snmpd.local.conf
886f2a9e
ER
60 %service -q snmpd reload
61fi
62
63%preun -n net-snmp-agent-cacti_postfix
64if [ "$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
69fi
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)
b110e13e
ER
77%attr(755,root,root) %{agentscript}
78%ghost %attr(700,root,root) %{dbfile}
This page took 0.078952 seconds and 4 git commands to generate.