]>
Commit | Line | Data |
---|---|---|
886f2a9e ER |
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.4 | |
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 | # This is officially registered: http://www.oid-info.com/get/1.3.6.1.4.1.16606 | |
24 | %define snmpoid .1.3.6.1.4.1.16606.2 | |
25 | ||
26 | %description | |
27 | Postifix monitoring with Cacti. | |
28 | ||
29 | %package -n net-snmp-agent-cacti_postfix | |
30 | Summary: SNMPd agent to provide Postfix stats | |
31 | Group: Networking/Daemons | |
32 | Requires: net-snmp | |
33 | ||
34 | %description -n net-snmp-agent-cacti_postfix | |
35 | SNMPd agent to provide Postfix stats for cacti. | |
36 | ||
37 | %prep | |
38 | %setup -qc | |
39 | ||
40 | %install | |
41 | rm -rf $RPM_BUILD_ROOT | |
42 | install -d $RPM_BUILD_ROOT{%{resourcedir},%{scriptsdir},%{snmpdconfdir},%{_libdir}} | |
43 | cp -a *.xml $RPM_BUILD_ROOT%{resourcedir} | |
44 | install -p fetch_mail_statistics.pl $RPM_BUILD_ROOT%{_libdir}/snmpd-agent-cacti_postfix | |
45 | ||
46 | %clean | |
47 | rm -rf $RPM_BUILD_ROOT | |
48 | ||
49 | %post | |
50 | %cacti_import_template %{resourcedir}/cacti_host_template_postfix_mailserver.xml | |
51 | ||
52 | %post -n net-snmp-agent-cacti_postfix | |
53 | if ! grep -qF %{snmpoid} %{snmpdconfdir}/snmpd.local.conf; then | |
54 | echo "extend %{snmpoid} cacti_postfix %{_libdir}/snmpd-agent-cacti_postfix /var/log/maillog /var/log/mailstats.db %{snmpoid}" >> %{snmpdconfdir}/snmpd.local.conf | |
55 | %service -q snmpd reload | |
56 | fi | |
57 | ||
58 | %preun -n net-snmp-agent-cacti_postfix | |
59 | if [ "$1" = 0 ]; then | |
60 | if [ -f %{snmpdconfdir}/snmpd.local.conf ]; then | |
61 | %{__sed} -i -e "/extend %(echo %{snmpoid} | sed -e 's,\.,\\.,g')/d" %{snmpdconfdir}/snmpd.local.conf | |
62 | %service -q snmpd reload | |
63 | fi | |
64 | fi | |
65 | ||
66 | %files | |
67 | %defattr(644,root,root,755) | |
68 | %{resourcedir}/*.xml | |
69 | ||
70 | %files -n net-snmp-agent-cacti_postfix | |
71 | %defattr(644,root,root,755) | |
72 | %attr(755,root,root) %{_libdir}/snmpd-agent-cacti_postfix |