]> git.pld-linux.org Git - packages/percona-monitoring-plugins.git/blob - percona-monitoring-plugins.spec
make mysql port per source by default
[packages/percona-monitoring-plugins.git] / percona-monitoring-plugins.spec
1 # TODO
2 # - cacti: package other templates:
3 #   http://www.percona.com/doc/percona-monitoring-plugins/1.1/#templates-for-cacti
4 # - JMX
5 # - MongoDB
6 # - Nginx
7 # - OpenVZ
8 # - Unix
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
13 Version:        1.1.3
14 Release:        0.11
15 License:        GPL v2
16 Group:          Applications/WWW
17 Source0:        http://www.percona.com/redir/downloads/percona-monitoring-plugins/LATEST/%{name}-%{version}.tar.gz
18 # Source0-md5:  ef344e93adaeb1dd23be722daced9261
19 Source1:        config.php
20 Source2:        ssh_config.php
21 Patch0:         config.patch
22 Patch1:         paths.patch
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
28 BuildArch:      noarch
29 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
30
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
36
37 %description
38 This is a set of templates for monitoring MySQL servers with Cacti.
39
40 %package -n cacti-template-apache
41 Summary:        Apache Stats
42 Group:          Applications/WWW
43 Requires:       %{name} = %{version}-%{release}
44 Requires:       nc
45 # mark obsoletes so ftp admin knows to remove old src.rpm once this package lands
46 Obsoletes:      cacti-template-apache < 1.1
47
48 %description -n cacti-template-apache
49 Apache Stats for Cacti (PHP Script Server Version).
50
51 %package -n cacti-template-memcached
52 Summary:        Memcached Cacti Template
53 Group:          Applications/WWW
54 Requires:       %{name} = %{version}-%{release}
55 Requires:       nc
56 # mark obsoletes so ftp admin knows to remove old src.rpm once this package lands
57 Obsoletes:      cacti-template-memcached < 1.1
58
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.
63
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.
68
69 %package -n cacti-template-mysql
70 Summary:        Cacti templates for graphing MySQL
71 Epoch:          1
72 Group:          Applications/WWW
73 Requires:       %{name} = %{version}-%{release}
74 Requires:       php(mysqli)
75
76 %description -n cacti-template-mysql
77 This is a set of templates for monitoring MySQL servers with Cacti.
78
79 %package -n cacti-template-redis
80 Summary:        Cacti templates for graphing Redis
81 Epoch:          1
82 Group:          Applications/WWW
83 Requires:       %{name} = %{version}-%{release}
84 # redis template uses nc
85 Requires:       nc
86
87 %description -n cacti-template-redis
88 This is a set of templates for monitoring Redis servers with Cacti.
89
90 %prep
91 %setup -q
92 %patch0 -p1
93 %patch1 -p1
94
95 cd 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
99         mv $xml $normalized
100 done
101
102 %{__sed} -i -e '1i#!/usr/bin/php' scripts/*.php
103
104 %build
105 # regenerate to make port per source
106 # http://www.percona.com/doc/percona-monitoring-plugins/1.1/cacti/customizing-templates.html
107 cd cacti
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
111
112 %install
113 rm -rf $RPM_BUILD_ROOT
114 install -d $RPM_BUILD_ROOT{%{_bindir},%{_sysconfdir},%{resourcedir},%{scriptsdir},%{cachedir}}
115
116 cd cacti
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}
121
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
125
126 cp -p templates/cacti_host_template_percona_mysql_server_ht.xml \
127         $RPM_BUILD_ROOT%{resourcedir}
128
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
133
134 # redis template
135 cp -p templates/cacti_host_template_percona_redis_server_ht.xml \
136         $RPM_BUILD_ROOT%{resourcedir}
137
138 # memcached template
139 cp -p templates/cacti_host_template_percona_memcached_server_ht.xml \
140         $RPM_BUILD_ROOT%{resourcedir}
141
142 # apache template
143 cp -p templates/cacti_host_template_percona_apache_server_ht.xml \
144         $RPM_BUILD_ROOT%{resourcedir}
145
146 %post -n cacti-template-apache
147 %cacti_import_template %{resourcedir}/cacti_host_template_percona_apache_server_ht.xml
148
149 %post -n cacti-template-memcached
150 %cacti_import_template %{resourcedir}/cacti_host_template_percona_memcached_server_ht.xml
151
152 %post -n cacti-template-mysql
153 %cacti_import_template %{resourcedir}/cacti_host_template_percona_mysql_server_ht.xml
154
155 %preun -n cacti-template-mysql
156 if [ "$1" = 0 ]; then
157         echo %{cachedir}/* | xargs rm -f
158 fi
159
160 %post -n cacti-template-redis
161 %cacti_import_template %{resourcedir}/cacti_host_template_percona_redis_server_ht.xml
162
163 %clean
164 rm -rf $RPM_BUILD_ROOT
165
166 %files
167 %defattr(644,root,root,755)
168 %doc Changelog
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
187
188 %files -n cacti-template-apache
189 %defattr(644,root,root,755)
190 %{resourcedir}/cacti_host_template_percona_apache_server_ht.xml
191
192 %files -n cacti-template-memcached
193 %defattr(644,root,root,755)
194 %{resourcedir}/cacti_host_template_percona_memcached_server_ht.xml
195
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}
202
203 %files -n cacti-template-redis
204 %defattr(644,root,root,755)
205 %{resourcedir}/cacti_host_template_percona_redis_server_ht.xml
This page took 0.10808 seconds and 3 git commands to generate.