2 # - cacti: package other templates:
3 # http://www.percona.com/doc/percona-monitoring-plugins/1.1/#templates-for-cacti
9 # - graceful migrate from cacti-template-mysql (use different paths so old pkg could be kept aside?)
10 %define template mysql
11 Summary: MySQL cacti templates
12 Name: percona-monitoring-plugins
16 Group: Applications/WWW
17 Source0: http://www.percona.com/redir/downloads/percona-monitoring-plugins/LATEST/%{name}-%{version}.tar.gz
18 # Source0-md5: ef344e93adaeb1dd23be722daced9261
20 Source2: ssh_config.php
23 URL: http://www.percona.com/software/percona-monitoring-plugins
24 BuildRequires: rpmbuild(macros) >= 1.630
25 BuildRequires: sed >= 4.0
26 Requires: cacti >= 0.8.7g-6
27 Conflicts: cacti-spine < 0.8.7e-3
29 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
31 %define _sysconfdir /etc/webapps/cacti
32 %define cactidir /usr/share/cacti
33 %define resourcedir %{cactidir}/resource
34 %define scriptsdir %{cactidir}/scripts
35 %define cachedir /var/cache/cacti/mysql_stats
38 This is a set of templates for monitoring MySQL servers with Cacti.
40 %package -n cacti-template-apache
42 Group: Applications/WWW
43 Requires: %{name} = %{version}-%{release}
45 # mark obsoletes so ftp admin knows to remove old src.rpm once this package lands
46 Obsoletes: cacti-template-apache < 1.1
48 %description -n cacti-template-apache
49 Apache Stats for Cacti (PHP Script Server Version).
51 %package -n cacti-template-memcached
52 Summary: Memcached Cacti Template
53 Group: Applications/WWW
54 Requires: %{name} = %{version}-%{release}
56 # mark obsoletes so ftp admin knows to remove old src.rpm once this package lands
57 Obsoletes: cacti-template-memcached < 1.1
59 %description -n cacti-template-memcached
60 This template provides a host template and associated graphs for
61 graphing the output of the memcached stats command on individual
62 memcached installations.
64 Graphs are provided for Bytes Used with total capacity, Cache Hits and
65 Misses per second, Current Connections, Items Cached, Inbound and
66 Outbound Network Traffic (bits per second), and Requests per Second
67 for both the get and set commands.
69 %package -n cacti-template-mysql
70 Summary: Cacti templates for graphing MySQL
72 Group: Applications/WWW
73 Requires: %{name} = %{version}-%{release}
76 %description -n cacti-template-mysql
77 This is a set of templates for monitoring MySQL servers with Cacti.
79 %package -n cacti-template-redis
80 Summary: Cacti templates for graphing Redis
82 Group: Applications/WWW
83 Requires: %{name} = %{version}-%{release}
84 # redis template uses nc
87 %description -n cacti-template-redis
88 This is a set of templates for monitoring Redis servers with Cacti.
96 # rename to include fixed names
97 for xml in templates/cacti_host_template_*.xml; do
98 normalized=${xml%_0.8.*-sver%{version}.xml}.xml
102 %{__sed} -i -e '1i#!/usr/bin/php' scripts/*.php
105 # regenerate to make port per source
106 # http://www.percona.com/doc/percona-monitoring-plugins/1.1/cacti/customizing-templates.html
108 bin/pmp-cacti-template \
109 --script scripts/ss_get_mysql_stats.php definitions/mysql.def \
110 --mpds port > ./templates/cacti_host_template_percona_mysql_server_ht.xml
113 rm -rf $RPM_BUILD_ROOT
114 install -d $RPM_BUILD_ROOT{%{_bindir},%{_sysconfdir},%{resourcedir},%{scriptsdir},%{cachedir}}
117 # tools for modifying templates
118 # http://www.percona.com/doc/percona-monitoring-plugins/1.1/cacti/customizing-templates.html
119 cp -p bin/pmp-* $RPM_BUILD_ROOT%{_bindir}
120 cp -a definitions $RPM_BUILD_ROOT%{resourcedir}
122 # this is what is needed for mysql templates
123 install -p scripts/ss_get_mysql_stats.php $RPM_BUILD_ROOT%{scriptsdir}
124 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/ss_get_mysql_stats.php
126 cp -p templates/cacti_host_template_percona_mysql_server_ht.xml \
127 $RPM_BUILD_ROOT%{resourcedir}
129 # these are additional ssh-based templates (not really using ssh, just the
130 # interface behaves like ssh)
131 install -p scripts/ss_get_by_ssh.php $RPM_BUILD_ROOT%{scriptsdir}
132 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/ss_get_by_ssh.php
135 cp -p templates/cacti_host_template_percona_redis_server_ht.xml \
136 $RPM_BUILD_ROOT%{resourcedir}
139 cp -p templates/cacti_host_template_percona_memcached_server_ht.xml \
140 $RPM_BUILD_ROOT%{resourcedir}
143 cp -p templates/cacti_host_template_percona_apache_server_ht.xml \
144 $RPM_BUILD_ROOT%{resourcedir}
146 %post -n cacti-template-apache
147 %cacti_import_template %{resourcedir}/cacti_host_template_percona_apache_server_ht.xml
149 %post -n cacti-template-memcached
150 %cacti_import_template %{resourcedir}/cacti_host_template_percona_memcached_server_ht.xml
152 %post -n cacti-template-mysql
153 %cacti_import_template %{resourcedir}/cacti_host_template_percona_mysql_server_ht.xml
155 %preun -n cacti-template-mysql
156 if [ "$1" = 0 ]; then
157 echo %{cachedir}/* | xargs rm -f
160 %post -n cacti-template-redis
161 %cacti_import_template %{resourcedir}/cacti_host_template_percona_redis_server_ht.xml
164 rm -rf $RPM_BUILD_ROOT
167 %defattr(644,root,root,755)
169 %attr(755,root,root) %{_bindir}/pmp-cacti-extract-template
170 %attr(755,root,root) %{_bindir}/pmp-cacti-graph-defs
171 %attr(755,root,root) %{_bindir}/pmp-cacti-make-hashes
172 %attr(755,root,root) %{_bindir}/pmp-cacti-template
173 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ss_get_by_ssh.php
174 %attr(755,root,root) %{scriptsdir}/ss_get_by_ssh.php
175 %dir %{resourcedir}/definitions
176 %{resourcedir}/definitions/apache.def
177 %{resourcedir}/definitions/galera.def
178 %{resourcedir}/definitions/gnu_linux.def
179 %{resourcedir}/definitions/jmx.def
180 %{resourcedir}/definitions/memcached.def
181 %{resourcedir}/definitions/mongodb.def
182 %{resourcedir}/definitions/mysql.def
183 %{resourcedir}/definitions/nginx.def
184 %{resourcedir}/definitions/openvz.def
185 %{resourcedir}/definitions/rds.def
186 %{resourcedir}/definitions/redis.def
188 %files -n cacti-template-apache
189 %defattr(644,root,root,755)
190 %{resourcedir}/cacti_host_template_percona_apache_server_ht.xml
192 %files -n cacti-template-memcached
193 %defattr(644,root,root,755)
194 %{resourcedir}/cacti_host_template_percona_memcached_server_ht.xml
196 %files -n cacti-template-mysql
197 %defattr(644,root,root,755)
198 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ss_get_mysql_stats.php
199 %attr(755,root,root) %{scriptsdir}/ss_get_mysql_stats.php
200 %{resourcedir}/cacti_host_template_percona_mysql_server_ht.xml
201 %attr(770,root,http) %dir %{cachedir}
203 %files -n cacti-template-redis
204 %defattr(644,root,root,755)
205 %{resourcedir}/cacti_host_template_percona_redis_server_ht.xml