Changeset 1045
- Timestamp:
- 07/24/06 11:43:10 (6 years ago)
- Files:
-
- people/ilmari/modularisation-branch/Makefile (modified) (3 diffs)
- people/ilmari/modularisation-branch/RELEASE (modified) (1 diff)
- people/ilmari/modularisation-branch/dists/redhat/munin.cron.d (modified) (1 diff)
- people/ilmari/modularisation-branch/dists/redhat/munin.spec.in (modified) (12 diffs)
- people/ilmari/modularisation-branch/dists/redhat/sendmail_plugin_conf.d (added)
- people/ilmari/modularisation-branch/munin-doc-base.html (deleted)
- people/ilmari/modularisation-branch/munin-faq-base.html (deleted)
- people/ilmari/modularisation-branch/node/Muninnode.pm (added)
- people/ilmari/modularisation-branch/node/munin-node-simple.in (modified) (1 diff)
- people/ilmari/modularisation-branch/node/munin-node.in (modified) (9 diffs)
- people/ilmari/modularisation-branch/node/node.d.freebsd/vmstat.in (modified) (1 diff)
- people/ilmari/modularisation-branch/node/node.d.linux/cpu.in (modified) (12 diffs)
- people/ilmari/modularisation-branch/node/node.d.linux/cpuspeed.in (added)
- people/ilmari/modularisation-branch/node/node.d.linux/df.in (modified) (2 diffs)
- people/ilmari/modularisation-branch/node/node.d.linux/df_inode.in (modified) (2 diffs)
- people/ilmari/modularisation-branch/node/node.d.linux/fw_forwarded_local.in (modified) (2 diffs)
- people/ilmari/modularisation-branch/node/node.d.linux/nfs4_client.in (added)
- people/ilmari/modularisation-branch/node/node.d.linux/nfs_client.in (modified) (1 diff)
- people/ilmari/modularisation-branch/node/node.d.linux/nfsd.in (modified) (3 diffs)
- people/ilmari/modularisation-branch/node/node.d/apc_envunit_.in (modified) (1 diff)
- people/ilmari/modularisation-branch/node/node.d/bind9_rndc.in (modified) (1 diff)
- people/ilmari/modularisation-branch/node/node.d/cupsys_pages.in (modified) (8 diffs)
- people/ilmari/modularisation-branch/node/node.d/hddtemp_smartctl.in (modified) (1 diff)
- people/ilmari/modularisation-branch/node/node.d/mailscanner.in (modified) (2 diffs)
- people/ilmari/modularisation-branch/node/node.d/multips.in (modified) (1 diff)
- people/ilmari/modularisation-branch/node/node.d/mysql_queries.in (modified) (1 diff)
- people/ilmari/modularisation-branch/node/node.d/ps_.in (modified) (1 diff)
- people/ilmari/modularisation-branch/node/node.d/sendmail_mailqueue.in (modified) (2 diffs)
- people/ilmari/modularisation-branch/server/munin-update.in (modified) (3 diffs)
- people/ilmari/modularisation-branch/server/munin.conf.pod (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
people/ilmari/modularisation-branch/Makefile
r1044 r1045 217 217 218 218 rpm: rpm-pre 219 tar -C .. --dereference --exclude .svn -cvzf ../munin -$(RELEASE).tar.gz munin-$(VERSION)/220 (cd ..; rpmbuild -tb munin -$(RELEASE).tar.gz)219 tar -C .. --dereference --exclude .svn -cvzf ../munin_$(RELEASE).tar.gz munin-$(VERSION)/ 220 (cd ..; rpmbuild -tb munin_$(RELEASE).tar.gz) 221 221 222 222 rpm-src: rpm-pre … … 224 224 (cd ..; rpmbuild -ts munin-$(RELEASE).tar.gz) 225 225 226 +suse-pre:226 suse-pre: 227 227 @for file in `find dists/suse/ -type f -name '*.in'`; do \ 228 228 destname=`echo $$file | sed 's/.in$$//'`; \ … … 256 256 257 257 -rm -f dists/redhat/munin.spec 258 -rm -f dists/suse/munin.spec 258 259 259 260 source_dist: clean people/ilmari/modularisation-branch/RELEASE
r1012 r1045 1 1.3.2 1 snapshot people/ilmari/modularisation-branch/dists/redhat/munin.cron.d
r864 r1045 6 6 7 7 */5 * * * * munin test -x /usr/bin/munin-cron && /usr/bin/munin-cron 8 10 10 * * * munin test -x /usr/share/munin/munin-nagios && /usr/share/munin/munin-nagios --removeokpeople/ilmari/modularisation-branch/dists/redhat/munin.spec.in
r1012 r1045 1 # Macro 'dist' is needed for rhel3 and rhel4. fedora includes it. On fedora, 2 # just remove this line, or set it to fc5 or something suitable. 3 %define dist rhel4 4 5 # Macro 'RHEL' is a conditional for other macros. On fedora, set it to 0. 6 %define RHEL 1 7 8 # Macro 'perl_vendorlib' is needed for rhel3. rhel4 and fedora includes it. 9 # Macro 'usermgmt' needed for a common package. Set this to 10 # 'fedora-usermgmt >= 0.7' in fedora, and 'shadow-utils' on rhel. 11 # Corresponding macros for groupadd and useradd, and groupdel and userdel 12 # are needed. Set these to corresponding commands, like 13 # '/usr/sbin/fedora-groupadd' and '/usr/sbin/fedora-useradd' on fedora, and 14 # '/usr/sbin/groupadd' and '/usr/sbin/useradd' on rhel 15 16 %if %{RHEL} 17 %define perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib) 18 %define usermgmt shadow-utils 19 %define groupadd /usr/sbin/groupadd -g 20 %define useradd /usr/sbin/useradd -u 21 %define groupdel /usr/sbin/groupdel 22 %define userdel /usr/sbin/userdel 23 %else 24 %define usermgmt fedora-usermgmt >= 0.7 25 %define groupadd /usr/sbin/fedora-groupadd 26 %define useradd /usr/sbin/fedora-useradd 27 %define groupdel /usr/sbin/fedora-groupdel 28 %define userdel /usr/sbin/fedora-userdel 29 %endif 30 1 31 Name: munin 2 32 Version: @@VERSION@@ 3 Release: 433 Release: 0.%{?dist} 4 34 Summary: Network-wide graphing framework (grapher/gatherer) 5 Copyright:GPL35 License: GPL 6 36 Group: System Environment/Daemons 7 URL: http://www.linpro.no/ 8 Packager: Ingvar Hagelund <ingvar@linpro.no> 9 Vendor: Linpro AS 10 Distribution: Linpro AS RHEL Software Archives 11 12 BuildRoot: %{_tmppath}/%{name}-%{version}-root 13 Source: %{name}-%{version}.tar.gz 37 URL: http://munin.projects.linpro.no/ 38 39 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 40 41 Source0: http://download.sourceforge.net/sourceforge/munin/%{name}_%{version}.tar.gz 42 #Patch0: munin-conf.patch 14 43 BuildArchitectures: noarch 15 Provides: perl(RRDs)16 44 Requires: perl-HTML-Template 17 45 Requires: perl-Net-Server 18 46 Requires: rrdtool 19 47 Requires: logrotate 20 Obsoletes: lrrd-server 48 Requires(pre): %{usermgmt} 49 Requires(postun): %{usermgmt} 21 50 22 51 %description … … 31 60 32 61 Munin is written in Perl, and relies heavily on Tobi Oetiker's excellent 33 RRDtool. To see a real example of Munin in action, take a peek at 34 <http://www.linpro.no/projects/munin/example/>. 62 RRDtool. 63 64 The RHEL package is based on the package from Fedora Extras 35 65 36 66 %package node … … 39 69 BuildArchitectures: noarch 40 70 Requires: perl-Net-Server 41 #Requires: perl-Config-General42 71 Requires: procps >= 2.0.7 43 72 Requires: sysstat 44 Obsoletes: lrrd-client 73 Requires(pre): %{usermgmt} 74 Requires(postun): %{usermgmt} 75 Requires(post): /sbin/chkconfig 76 Requires(preun): /sbin/chkconfig 77 Requires(preun): /sbin/service 45 78 46 79 %description node … … 63 96 64 97 Munin is written in Perl, and relies heavily on Tobi Oetiker's excellent 65 RRDtool. To see a real example of Munin in action, take a peek at66 <http://www.linpro.no/projects/munin/example/>. 67 98 RRDtool. 99 100 The RHEL package is based on the package from Fedora Extras 68 101 69 102 %prep 70 103 %setup -q 71 rm -rf %{buildroot} 72 mkdir -p %{buildroot} 104 #%patch0 -p1 73 105 74 106 %build … … 78 110 perl -pi -e 's,htmldoc munin,cat munin, or s,html(2text|doc),# $&,' Makefile 79 111 perl -pi -e 's,\$\(INSTALL.+\.(pdf|txt) \$\(DOCDIR,# $&,' Makefile 80 make clean 81 make CONFIG=dists/redhat/Makefile.config \ 82 build 112 make CONFIG=dists/redhat/Makefile.config build 83 113 84 114 %install … … 86 116 ## Node 87 117 make CONFIG=dists/redhat/Makefile.config \ 88 DOCDIR=%{buildroot}%{_docdir}/ munin\118 DOCDIR=%{buildroot}%{_docdir}/%{name}-%{version} \ 89 119 MANDIR=%{buildroot}%{_mandir} \ 90 120 DESTDIR=%{buildroot} \ 91 install-main install-node install-node-plugins install-doc install-man121 install-main install-node-non-snmp install-node-plugins install-doc install-man 92 122 93 123 mkdir -p %{buildroot}/etc/rc.d/init.d … … 98 128 mkdir -p %{buildroot}/var/log/munin 99 129 100 install -m0755 dists/redhat/munin-node.rc %{buildroot}/etc/rc.d/init.d/munin-node 130 # 131 # don't enable munin-node by default. 132 # 133 cat dists/redhat/munin-node.rc | sed -e 's/2345/\-/' > %{buildroot}/etc/rc.d/init.d/munin-node 134 chmod 755 %{buildroot}/etc/rc.d/init.d/munin-node 135 101 136 install -m0644 dists/tarball/plugins.conf %{buildroot}/etc/munin/ 102 137 install -m0644 dists/tarball/plugins.conf %{buildroot}/etc/munin/plugin-conf.d/munin-node 103 138 install -m0644 dists/debian/munin.logrotate %{buildroot}/etc/logrotate.d/munin 104 139 install -m0644 dists/debian/munin-node.logrotate %{buildroot}/etc/logrotate.d/munin-node 105 106 # Prevent rpmbuild from adding a lot of perl dependencies 107 chmod -x %{buildroot}%{_datadir}/munin/plugins/* 108 chmod -x %{buildroot}%{_sbindir}/munin-node-configure-snmp 109 chmod -x %{buildroot}%{_sbindir}/munin-node-configure 110 chmod -x %{buildroot}%{_sbindir}/munin-run 140 install -m0644 dists/redhat/sendmail_plugin_conf.d %{buildroot}/etc/munin/plugin-conf.d/sendmail 141 142 # 143 # remove the Net::SNMP and Sybase plugins for now, as they need perl modules 144 # that are not in extras. We can readd them when/if those modules are added. 145 # 146 rm -f %{buildroot}/usr/share/munin/plugins/pm3users_ 147 rm -f %{buildroot}/usr/share/munin/plugins/snmp_* 148 rm -f %{buildroot}/usr/share/munin/plugins/sybase_space 111 149 112 150 ## Server … … 115 153 install-main 116 154 117 # cf=%{buildroot}/etc/munin/munin.conf; sed 's,/var/www/munin,/var/www/html/munin,g' < $cf > $cf.patched && mv $cf.patched $cf118 119 155 mkdir -p %{buildroot}/var/www/html/munin 120 156 mkdir -p %{buildroot}/var/log/munin 121 157 mkdir -p %{buildroot}/etc/cron.d 122 # silly RPM triggers want to make debug enabled libraries. let it try. 123 mkdir -p %{buildroot}/usr/lib/debug 124 125 install -m 0755 dists/redhat/munin.cron.d %{buildroot}/etc/cron.d/munin 126 install -m 0644 server/munin-htaccess %{buildroot}/var/www/html/munin/.htaccess 127 install -m 0755 server/style.css %{buildroot}/var/www/html/munin 128 install -m 0644 ChangeLog %{buildroot}%{_docdir}/munin/ChangeLog 158 159 install -m 0644 dists/redhat/munin.cron.d %{buildroot}/etc/cron.d/munin 160 install -m 0644 server/style.css %{buildroot}/var/www/html/munin 161 install -m 0644 ChangeLog %{buildroot}%{_docdir}/%{name}-%{version}/ChangeLog 129 162 130 163 %clean 131 [ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot} 164 rm -rf $RPM_BUILD_ROOT 165 166 # 167 # node package scripts 168 # uid 18 is the next uid in http://fedoraproject.org/wiki/PackageUserRegistry 169 # 170 %pre node 171 %{groupadd} 18 -r munin &>/dev/null || : 172 %{useradd} 18 -r -s /sbin/nologin -d /var/lib/munin -M \ 173 -c 'Munin user' -g munin munin &>/dev/null || : 174 175 %post node 176 /sbin/chkconfig --add munin-node 177 /usr/sbin/munin-node-configure --shell | sh 178 179 %preun node 180 test "$1" != 0 || %{_initrddir}/munin-node stop &>/dev/null || : 181 test "$1" != 0 || /sbin/chkconfig --del munin-node 182 183 %postun node 184 test "$1" != 0 || %{userdel} munin &>/dev/null || : 185 test "$1" != 0 || %{groupdel} munin &>/dev/null || : 186 187 # 188 # main package scripts 189 # uid 18 is the next uid in http://fedoraproject.org/wiki/PackageUserRegistry 190 # 191 %pre 192 %{groupadd} 18 -r munin &>/dev/null || : 193 %{useradd} 18 -r -s /sbin/nologin -d /var/lib/munin -M \ 194 -c 'Munin user' -g munin munin &>/dev/null || : 195 196 %postun 197 test "$1" != 0 || %{userdel} munin &>/dev/null || : 198 test "$1" != 0 || %{groupdel} munin &>/dev/null || : 132 199 133 %pre node134 getent group munin >/dev/null || groupadd -r munin135 getent passwd munin > /dev/null || useradd -r -d /var/lib/munin -g munin munin136 137 %post node138 chmod -R g+w /var/lib/munin/139 chmod +x %{_datadir}/munin/plugins/*140 chmod +x %{_sbindir}/munin*141 142 if [ $1 = 1 ]143 then144 /sbin/chkconfig --add munin-node145 /usr/sbin/munin-node-configure --shell | sh146 fi147 chown -R munin /var/lib/munin148 149 150 %preun node151 if [ $1 = 0 ]152 then153 /sbin/chkconfig --del munin-node154 rmdir /var/log/munin 2>/dev/null || echo " "155 fi156 157 %pre158 getent group munin >/dev/null || groupadd -r munin159 getent passwd munin > /dev/null || useradd -r -d /var/lib/munin -g munin munin160 161 %post162 mkdir -p /var/run/munin163 chown -R munin /var/run/munin164 chown -R munin /var/www/html/munin165 chown -R munin /var/log/munin166 chown -R munin /var/lib/munin167 168 %postun169 if [ $1 = 0 ]170 then171 userdel munin172 fi173 174 200 %files 175 201 %defattr(-, root, root) 176 %doc %{_docdir}/munin/README.api 177 #%doc %{_docdir}/munin/README.config 178 %doc %{_docdir}/munin/README.plugins 179 %doc %{_docdir}/munin/COPYING 180 %doc %{_docdir}/munin/ChangeLog 181 %doc %{_docdir}/munin/README-apache-cgi 202 %doc %{_docdir}/%{name}-%{version}/README.api 203 %doc %{_docdir}/%{name}-%{version}/README.plugins 204 %doc %{_docdir}/%{name}-%{version}/COPYING 205 %doc %{_docdir}/%{name}-%{version}/ChangeLog 206 %doc %{_docdir}/%{name}-%{version}/README-apache-cgi 182 207 %{_bindir}/munin-cron 183 208 %{_datadir}/munin/munin-graph … … 185 210 %{_datadir}/munin/munin-limits 186 211 %{_datadir}/munin/munin-update 187 %{ _libdir}/perl5/*perl/5.*/Munin.pm212 %{perl_vendorlib}/Munin.pm 188 213 /var/www/html/munin/cgi/munin-cgi-graph 189 214 %dir /etc/munin/templates 190 215 %dir /etc/munin 191 /etc/munin/templates/*192 /etc/cron.d/munin216 %config(noreplace) /etc/munin/templates/* 217 %config(noreplace) /etc/cron.d/munin 193 218 %config(noreplace) /etc/munin/munin.conf 194 219 %config(noreplace) /etc/logrotate.d/munin 195 220 196 %attr(-, munin, root) %dir /var/lib/munin197 %attr(-, munin, root) %dir /var/log/munin198 %attr(-, munin, root) %dir /var/www/html/munin199 %attr(-, munin, root) %dir /var/www/html/munin/cgi200 %attr(-, munin, root) /var/www/html/munin/style.css201 % config /var/www/html/munin/.htaccess221 %attr(-, munin, munin) %dir /var/lib/munin 222 %attr(-, munin, munin) %dir /var/run/munin 223 %attr(-, munin, munin) %dir /var/log/munin 224 %attr(-, munin, munin) %dir /var/www/html/munin 225 %attr(-, root, root) %dir /var/www/html/munin/cgi 226 %attr(-, root, root) /var/www/html/munin/style.css 202 227 %doc %{_mandir}/man8/munin-graph* 203 228 %doc %{_mandir}/man8/munin-update* … … 211 236 %config(noreplace) /etc/munin/munin-node.conf 212 237 %config(noreplace) /etc/munin/plugin-conf.d/munin-node 238 %config(noreplace) /etc/munin/plugin-conf.d/sendmail 213 239 %config(noreplace) /etc/logrotate.d/munin-node 214 %config/etc/rc.d/init.d/munin-node240 /etc/rc.d/init.d/munin-node 215 241 %config(noreplace) /etc/munin/plugins.conf 216 242 %{_sbindir}/munin-run 217 243 %{_sbindir}/munin-node 218 244 %{_sbindir}/munin-node-configure 219 %{_sbindir}/munin-node-configure-snmp 220 %dir /var/log/munin 245 %attr(-, munin, munin) %dir /var/log/munin 221 246 %dir %{_datadir}/munin 222 247 %dir /etc/munin/plugins 223 248 %dir /etc/munin 224 % dir /var/lib/munin225 %dir %attr(-, root, munin) /var/lib/munin/plugin-state249 %attr(-, munin, munin) %dir /var/lib/munin 250 %dir %attr(-, munin, munin) /var/lib/munin/plugin-state 226 251 %{_datadir}/munin/plugins/* 227 %doc %{_docdir}/ munin/COPYING228 %doc %{_docdir}/ munin/munin-doc.html229 %doc %{_docdir}/ munin/munin-faq.html252 %doc %{_docdir}/%{name}-%{version}/COPYING 253 %doc %{_docdir}/%{name}-%{version}/munin-doc.html 254 %doc %{_docdir}/%{name}-%{version}/munin-faq.html 230 255 %doc %{_mandir}/man8/munin-run* 231 256 %doc %{_mandir}/man8/munin-node* … … 233 258 234 259 %changelog 235 * Thu Apr 21 2005 Ingvar Hagelund <ingvar@linpro.no> 1.2.3-4 260 * Mon Jun 12 2006 Ingvar Hagelund <ingvar@linpro.no> - 1.3-unstable 261 - Synced most changes from Fedora package into unstable tree 262 - Added a sendmail config file that is RedHat specific 263 264 * Thu Jun 01 2006 Ingvar Hagelund <ingvar@linpro.no> - 1.2.4-8rhel4 265 - Simple repacking from fc5 to rhel. All kudos to Kevin for 266 maintaining the Fedora Package 267 268 * Sat Apr 22 2006 Kevin Fenzi <kevin@tummy.com> - 1.2.4-8 269 - add patch to remove unneeded munin-nagios in cron. 270 - add patch to remove buildhostname in munin.conf (fixes #188928) 271 - clean up prep section of spec. 272 273 * Fri Feb 24 2006 Kevin Fenzi <kevin@scrye.com> - 1.2.4-7 274 - Remove bogus Provides for perl RRDs (fixes #182702) 275 276 * Thu Feb 16 2006 Kevin Fenzi <kevin@tummy.com> - 1.2.4-6 277 - Readded old changelog entries per request 278 - Rebuilt for fc5 279 280 * Sat Dec 24 2005 Kevin Fenzi <kevin@tummy.com> - 1.2.4-5 281 - Fixed ownership for /var/log/munin in node subpackage (fixes 176529) 282 283 * Wed Dec 14 2005 Kevin Fenzi <kevin@tummy.com> - 1.2.4-4 284 - Fixed ownership for /var/lib/munin in node subpackage 285 286 * Wed Dec 14 2005 Kevin Fenzi <kevin@tummy.com> - 1.2.4-3 287 - Fixed libdir messup to allow builds on x86_64 288 289 * Mon Dec 12 2005 Kevin Fenzi <kevin@tummy.com> - 1.2.4-2 290 - Removed plugins that require Net-SNMP and Sybase 291 292 * Tue Dec 6 2005 Kevin Fenzi <kevin@tummy.com> - 1.2.4-1 293 - Inital cleanup for fedora-extras 294 295 * Thu Apr 21 2005 Ingvar Hagelund <ingvar@linpro.no> - 1.2.3-4 236 296 - Fixed a bug in the iostat plugin 237 * Wed Apr 20 2005 Ingvar Hagelund <ingvar@linpro.no> 1.2.3-3 297 298 * Wed Apr 20 2005 Ingvar Hagelund <ingvar@linpro.no> - 1.2.3-3 238 299 - Added the missing /var/run/munin 239 * Tue Apr 19 2005 Ingvar Hagelund <ingvar@linpro.no> 1.2.3-2 300 301 * Tue Apr 19 2005 Ingvar Hagelund <ingvar@linpro.no> - 1.2.3-2 240 302 - Removed a lot of unecessary perl dependencies 241 * Mon Apr 18 2005 Ingvar Hagelund <ingvar@linpro.no> 1.2.3-1 303 304 * Mon Apr 18 2005 Ingvar Hagelund <ingvar@linpro.no> - 1.2.3-1 242 305 - Sync with svn 243 * Tue Mar 22 2005 Ingvar Hagelund <ingvar@linpro.no> 1.2.2-5 306 307 * Tue Mar 22 2005 Ingvar Hagelund <ingvar@linpro.no> - 1.2.2-5 244 308 - Sync with release of 1.2.2 245 309 - Add some nice text from the suse specfile … … 247 311 - Some cosmetic changes 248 312 - Added logrotate scripts (stolen from debian package) 313 249 314 * Sun Feb 01 2004 Ingvar Hagelund <ingvar@linpro.no> 250 315 - Sync with CVS. Version 1.0.0pre2 316 251 317 * Sun Jan 18 2004 Ingvar Hagelund <ingvar@linpro.no> 252 318 - Sync with CVS. Change names to munin. 319 253 320 * Fri Oct 31 2003 Ingvar Hagelund <ingvar@linpro.no> 254 321 - Lot of small fixes. Now builds on more RPM distros 322 255 323 * Wed May 21 2003 Ingvar Hagelund <ingvar@linpro.no> 256 324 - Sync with CVS 257 325 - 0.9.5-1 326 258 327 * Tue Apr 1 2003 Ingvar Hagelund <ingvar@linpro.no> 259 328 - Sync with CVS 260 329 - Makefile-based install of core files 261 330 - Build doc (only pod2man) 331 262 332 * Thu Jan 9 2003 Ingvar Hagelund <ingvar@linpro.no> 263 333 - Sync with CVS, auto rpmbuild 334 264 335 * Thu Jan 2 2003 Ingvar Hagelund <ingvar@linpro.no> 265 336 - Fix spec file for RedHat 8.0 and new version of lrrd 337 266 338 * Wed Sep 4 2002 Ingvar Hagelund <ingvar@linpro.no> 267 339 - Small bugfixes in the rpm package 340 268 341 * Tue Jun 18 2002 Kjetil Torgrim Homme <kjetilho@linpro.no> 269 342 - new package people/ilmari/modularisation-branch/node/munin-node-simple.in
r1012 r1045 36 36 %ENV = (); 37 37 $ENV{PATH} = "/bin:/usr/bin"; 38 # We emptied the environment. There will be no locale issues. 38 39 39 40 my $config = &read_config($conffile); people/ilmari/modularisation-branch/node/munin-node.in
r1012 r1045 1 1 #!@@PERL@@ -wT 2 2 # 3 # Copyright (C) 2004 Audun Ytterdal, Jimmy Olsen 3 # Copyright (C) 2002-2006 Audun Ytterdal, Jimmy Olsen, Tore Anderson, 4 # Nicolai Langfeldt 4 5 # 5 6 # This program is free software; you can redistribute it and/or … … 17 18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 19 # 19 #20 20 # $Id$ 21 21 # … … 49 49 my %services; 50 50 my %nodes; 51 my $servicedir=" @@CONFDIR@@/plugins";52 my $sconfdir=" @@CONFDIR@@/plugin-conf.d";53 my $conffile=" @@CONFDIR@@/munin-node.conf";51 my $servicedir="$CONFDIR/plugins"; 52 my $sconfdir="$CONFDIR/plugin-conf.d"; 53 my $conffile="$CONFDIR/munin-node.conf"; 54 54 my $FQDN=""; 55 55 my $do_usage = 0; 56 56 my $DEBUG = 0; 57 57 my $do_version = 0; 58 my $VERSION= "@@VERSION@@";59 my $defuser = getpwnam ( "@@PLUGINUSER@@");60 my $defgroup= getgrnam ( "@@GROUP@@");58 my $VERSION=$Muninnode::VERSION; 59 my $defuser = getpwnam ($PLUGINUSER); 60 my $defgroup= getgrnam ($GROUP); 61 61 my $paranoia= 0; 62 62 my @ignores = (); … … 179 179 $ENV{FQDN}=$FQDN; 180 180 181 # Some locales uses "," as decimal separator. This can mess up a lot 182 # of plugins. 183 $ENV{'LC_ALL'}='C'; 184 181 185 MyPackage->run(conf_file => $conffile, 182 pid_file => " @@STATEDIR@@/munin-node.pid");186 pid_file => "$STATEDIR/munin-node.pid"); 183 187 exit; 184 188 … … 240 244 closedir (DIR); 241 245 } 242 246 243 247 opendir (DIR,$servicedir) || die "Cannot open plugindir: $servicedir $!"; 244 248 FILES: … … 538 542 $key = &get_var (\%sconf, "tls_private_key") 539 543 unless defined $key; 540 $key = " @@CONFDIR@@/munin-node.pem" unless defined $key;544 $key = "$CONFDIR/munin-node.pem" unless defined $key; 541 545 $cert = &get_var (\%sconf, "tls_certificate") 542 546 unless defined $cert; 543 $cert = " @@CONFDIR@@/munin-node.pem" unless defined $cert;547 $cert = "$CONFDIR/munin-node.pem" unless defined $cert; 544 548 $mode = &get_var (\%sconf, 'tls'); 545 549 $mode = "auto" unless defined $mode and length $mode; … … 1096 1100 =head1 DESCRIPTION 1097 1101 1098 Munin's node is a daemon that Munin connects to fetch data. This datais1099 stored in .rrd-files, and later graphed and htmlified. It's designed to 1100 letit be very easy to graph new datasources.1102 Munin's node is a daemon that Munin connects to to fetch data. This 1103 data is stored and later graphed and htmlified. It's designed to let 1104 it be very easy to graph new datasources. 1101 1105 1102 1106 Munin-node is a small perlscript listening to port 4949 using 1103 Net::Server. It reads all the plugins in /etc/munin/plugins/ on startup. 1104 The node accepts the following commands: 1105 1106 =over 5 1107 1108 =item B<< list [node] >> 1109 1110 list available plugins for host. If no hostname is specified, list plugins 1111 on host running munin-node 1112 1113 =item B<< nodes >> 1114 1115 List nodes that has plugins in this munin-node. 1116 1117 =item B<< config <plugin> >> 1118 1119 output plugin configuration 1120 1121 =item B<< fetch <plugin> >> 1122 1123 output plugin values 1124 1125 =item B<< version >> 1126 1127 Print versionstring 1128 1129 =item B<< quit >> 1130 1131 disconnect 1132 1133 =back 1134 1135 =head2 Plugins 1136 1137 These plugins can be in you language of choice: bash, perl, python, C. The 1138 plugins can be run in two modes: with and without the "config"-parameter. When 1139 run with "config" as parameter, the plugin should output the configuration of 1140 the graph. When run without parameters, the plugin should output just values 1141 1142 # /etc/munin/plugins/load config 1143 host_name 1144 graph_title Load average 1145 graph_args --base 1000 -l 0 1146 graph_vlabel load 1147 load.label load 1148 load.draw LINE2 1149 load.warning 10 1150 load.critical 120 1151 1152 # /etc/munin/plugins/load 1153 load.value 0.43 1154 1155 For more information, see the documentation section at L<http://munin.sf.net/>. 1107 Net::Server. It reads all the plugins in /etc/munin/plugins on startup. 1108 1109 The network protocol is documented at 1110 http://munin.projects.linpro.no/wiki/network-protocol 1111 1112 These plugins can be in you language of choice: bash, perl, python, 1113 C. The plugins can be run in two modes: with and without the 1114 "config"-parameter. When run with "config" as parameter, the plugin 1115 should output the configuration of the graph. When run without 1116 parameters, the plugin should output just values. Writing plugins is 1117 easy and fun; please refer to 1118 http://munin.projects.linpro.no/wiki/HowToWritePlugins and 1119 http://munin.projects.linpro.no/wiki/plugins 1156 1120 1157 1121 =head1 FILES … … 1173 1137 =head1 BUGS 1174 1138 1175 munin-node does, as of now, not check the syntax of the configuration file. 1139 Please se http://munin.projects.linpro.no/report/1 1140 1141 munin-node does, as of now, not check the syntax of the configuration 1142 file. It also does not check that plugins produces legal field names 1143 and observes other niceties. 1176 1144 1177 1145 Please report other bugs in the bug tracker at L<http://munin.sf.net/>. … … 1179 1147 =head1 COPYRIGHT 1180 1148 1181 Copyright © 2002 Audun Ytterdal, Jimmy Olsen, and Tore Anderson / Linpro AS.1149 Copyright © 2002-2006 Audun Ytterdal, Jimmy Olsen, and Tore Anderson / Linpro AS. 1182 1150 1183 1151 This is free software; see the source for copying conditions. There is people/ilmari/modularisation-branch/node/node.d.freebsd/vmstat.in
r1012 r1045 70 70 71 71 if [ "$OSV" -ge "5" ]; then 72 sysctl -n vm.vmtotal | awk '72 /sbin/sysctl -n vm.vmtotal | awk ' 73 73 /^Processes:/ { 74 74 print "running.value", $3; people/ilmari/modularisation-branch/node/node.d.linux/cpu.in
r1012 r1045 15 15 #%# family=auto 16 16 #%# capabilities=autoconf 17 17 # 18 # Environment variables: 19 # 20 # HZ Some combinations of hardware and Linux (probably only 21 # 2.4 kernels) use 1000 units/second in /proc/stat 22 # corresponding to the systems HZ. (see 23 # /usr/src/linux/include/asm/param.h). But Almost all 24 # systems use 100 units/second and this is our default. 25 # Even if Documentation/proc.txt in the kernel source says 26 # otherwise. - Finding and fix by dz@426.ch 27 # 28 # $Id$ 18 29 19 30 … … 28 39 fi 29 40 41 HZ=${HZ:-100} 42 30 43 extinfo="" 31 44 32 if (`egrep '^cpu +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+' /proc/stat 2>/dev/null >/dev/null`) 33 then 45 if egrep -q '^cpu +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+' /proc/stat; then 34 46 extinfo="iowait irq softirq" 35 47 fi … … 37 49 if [ "$1" = "config" ]; then 38 50 39 NCPU=`expr \`grep '^cpu. ' /proc/stat | wc -l\` - 1` 40 PERCENT=`expr $NCPU '*' 100` 51 NCPU=$(egrep '^cpu[0-9]+ ' /proc/stat | wc -l) 52 PERCENT=$(($NCPU * 100)) 53 MAX=$(($NCPU * 100)) 41 54 if [ "$scaleto100" = "yes" ]; then 42 55 graphlimit=100 … … 44 57 graphlimit=$PERCENT 45 58 fi 46 SYSWARNING= `expr $PERCENT '*' 30 / 100`47 SYSCRITICAL= `expr $PERCENT '*' 50 / 100`48 USRWARNING= `expr $PERCENT '*' 80 / 100`59 SYSWARNING=$(($PERCENT * 30 / 100)) 60 SYSCRITICAL=$(($PERCENT * 50 / 100)) 61 USRWARNING=$(($PERCENT * 80 / 100)) 49 62 echo 'graph_title CPU usage' 50 63 echo "graph_order system user nice idle" $extinfo … … 57 70 echo 'system.label system' 58 71 echo 'system.draw AREA' 59 echo 'system.max 5000'72 echo "system.max $MAX" 60 73 echo 'system.min 0' 61 74 echo 'system.type DERIVE' … … 66 79 echo 'user.draw STACK' 67 80 echo 'user.min 0' 68 echo 'user.max 5000'81 echo "user.max $MAX" 69 82 echo "user.warning $USRWARNING" 70 83 echo 'user.type DERIVE' … … 73 86 echo 'nice.draw STACK' 74 87 echo 'nice.min 0' 75 echo 'nice.max 5000'88 echo "nice.max $MAX" 76 89 echo 'nice.type DERIVE' 77 90 echo 'nice.info CPU time spent by nice(1)d programs' … … 79 92 echo 'idle.draw STACK' 80 93 echo 'idle.min 0' 81 echo 'idle.max 5000'94 echo "idle.max $MAX" 82 95 echo 'idle.type DERIVE' 83 96 echo 'idle.info Idle CPU time' … … 93 106 echo 'iowait.draw STACK' 94 107 echo 'iowait.min 0' 95 echo 'iowait.max 5000'108 echo "iowait.max $MAX" 96 109 echo 'iowait.type DERIVE' 97 110 echo 'iowait.info CPU time spent waiting for I/O operations to finish' … … 99 112 echo 'irq.draw STACK' 100 113 echo 'irq.min 0' 101 echo 'irq.max 5000'114 echo "irq.max $MAX" 102 115 echo 'irq.type DERIVE' 103 116 echo 'irq.info CPU time spent handling interrupts' … … 105 118 echo 'softirq.draw STACK' 106 119 echo 'softirq.min 0' 107 echo 'softirq.max 5000'120 echo "softirq.max $MAX" 108 121 echo 'softirq.type DERIVE' 109 122 echo 'softirq.info CPU time spent handling "batched" interrupts' … … 118 131 119 132 120 if [ ! -z "$extinfo" ] 121 then 122 awk '/^cpu / { print "user.value " $2 "\nnice.value " $3 "\nsystem.value " $4 "\nidle.value " $5 "\niowait.value " $6 "\nirq.value " $7 "\nsoftirq.value " $8 }' < /proc/stat 133 if [ ! -z "$extinfo" ]; then 134 awk -v hz=$HZ '/^cpu / { print "user.value " $2*100/hz "\nnice.value " $3*100/hz "\nsystem.value " $4*100/hz "\nidle.value " $5*100/hz "\niowait.value " $6*100/hz "\nirq.value " $7*100/hz "\nsoftirq.value " $8*100/hz }' < /proc/stat 123 135 else 124 awk '/^cpu / { print "user.value " $2 "\nnice.value " $3 "\nsystem.value " $4 "\nidle.value " $5}' < /proc/stat136 awk -v hz=$HZ '/^cpu / { print "user.value " $2*100/hz "\nnice.value " $3*100/hz "\nsystem.value " $4*100/hz "\nidle.value " $5*100/hz }' < /proc/stat 125 137 fi people/ilmari/modularisation-branch/node/node.d.linux/df.in
r1012 r1045 1 #!/ bin/sh1 #!/usr/bin/perl 2 2 # 3 # Script to monitor disk usage.4 # 3 # Plugin to monitor disk usage. Rewrite based on original shell-based version 4 # 5 5 # Parameters understood: 6 6 # 7 # config (required) 8 # autoconf (optional - used by munin-config) 7 # config (required) 8 # autoconf (optional - used by munin-config) 9 # 10 # $Log$ 9 11 # 10 12 # Magic markers (optional - used by munin-config and installation … … 14 16 #%# capabilities=autoconf 15 17 16 MAXLABEL=20 18 use strict; 17 19 18 if [ "$1" = "autoconf" ]; then 19 echo yes 20 exit 0 21 fi 20 my $MAXLABEL=25; 22 21 23 clean_name() { 24 echo $1 $7 $2 | sed 's/[\/.-]/_/g'| awk "{ 25 if (\$3 == \"tmpfs\") 26 n=\$1\$2 27 else 28 n=\$1 29 print n 30 }" 22 # Read /proc/mounts 23 my %mounts; 24 open (MOUNTS,"/proc/mounts") or die "Could not /proc/mounts for reading."; 25 while (<MOUNTS>) { 26 # Does perl really not have any shorthand for this? I guess it has. 27 if ( /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/ ) { 28 $mounts{$2}=$3; 29 } 30 } 31 close MOUNTS; 32 33 sub print_values() { 34 35 # Read from df 36 open (DF,"/bin/df -P -l |") or die "Could not open pipe from /bin/df, $!"; 37 <DF>; # Skip the header 38 while (<DF>) { 39 next if /\/\//; 40 41 # Parse the output 42 if ( /^(\S+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\S+)\s+(\S+)/ ) { 43 my $fs=$mounts{$6}; 44 my $ps=$5; 45 my $name=$1; 46 47 $ps =~ s/\%//; 48 $name =~ s/\//_/g; 49 print $name . ".value " . $ps . "\n"; 50 } 51 } 52 close DF; 53 } 54 55 if ( $ARGV[0] eq "autoconf" ) { 56 if (`perl $0` eq "" ) { 57 print "no\n"; 58 exit 1; 59 } 60 elsif ( `uname -s` eq "SunOS\n" ) { 61 print "no\n"; 62 exit 1; 63 } 64 else { 65 print "yes\n"; 66 exit 0; 67 } 31 68 } 32 69 70 if ( $ARGV[0] eq "config" ) { 33 71 34 if [ "$1" = "config" ]; then 72 # The headers 73 print "graph_title Disk usage (in %)\n"; 74 print "graph_args --upper-limit 100 -l 0\n"; 75 print "graph_vlabel %\n"; 76 77 # Read from df 78 open (DF,"/bin/df -P -l |") or die "Unable to open pipe from /bin/df"; 79 <DF>; # Skip the header 80 while (<DF>) { 81 next if /\/\//; 82 83 # Parse the output 84 if ( /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/ ) { 85 my $fs=$mounts{$6}; 86 my $dir=$6; 87 my $name=$1; 88 89 # Create and print labels 90 $name =~ s/\//_/g; 91 print $name . ".label "; 92 if ( length($dir) <= $MAXLABEL ) { 93 print $dir . "\n"; 94 } 95 else { 96 printf ("...%s\n", substr ($dir, length($dir)-$MAXLABEL+4,$MAXLABEL-3)); 97 } 98 99 print "$name.warning 92\n"; 100 print "$name.critical 98\n"; 101 } 102 } 103 close DF; 104 exit 0; 105 } 35 106 36 echo 'graph_title Filesystem usage (in %)' 37 echo 'graph_args --upper-limit 100 -l 0' 38 echo 'graph_vlabel %' 39 echo 'graph_category disk' 40 echo 'graph_info This graph shows disk usage on the machine.' 41 df -T -P -l -x none -x unknown -x udf -x iso9660 -x romfs -x ramfs | sed 1d | grep -v "//" | sort | while read i; do 42 name=`clean_name $i` 43 echo -n "$name.label " 44 echo $i | awk "{ 45 dir=\$7 46 if (length(dir) <= $MAXLABEL) 47 print dir 48 else 49 printf (\"...%s\n\", substr (dir, length(dir)-$MAXLABEL+4, $MAXLABEL-3)) 50 print \"$name.info \" \$7 \" (\" \$2 \") -> \" \$1; 51 }" 52 echo "$name.warning 92" 53 echo "$name.critical 98" 54 done 55 exit 0 56 fi 57 58 df -T -P -l -x none -x unknown -x udf -x iso9660 -x romfs -x ramfs | sed 1d | grep -v "//" | while read i; do 59 name=`clean_name $i` 60 echo -n "$name.value " 61 echo $i | awk '{ print $6 }' | cut -f1 -d% 62 done 107 print_values(); people/ilmari/modularisation-branch/node/node.d.linux/df_inode.in
r1012 r1045 1 #!/ bin/sh1 #!/usr/bin/perl 2 2 # 3 # Plugin to monitor inode-usage. 4 # 3 # Plugin to monitor inode-usage. Rewrite based on original shell-based version 4 # 5 5 # Parameters understood: 6 6 # 7 # config (required) 8 # autoconf (optional - used by munin-config) 7 # config (required) 8 # autoconf (optional - used by munin-config) 9 # 10 # $Log$ 9 11 # 10 12 # Magic markers (optional - used by munin-config and installation … … 14 16 #%# capabilities=autoconf 15 17 16 MAXLABEL=20 18 use strict; 17 19 18 fs() { 19 local escaped_mntpt=`echo "$*" | awk '{ print $NF }' | sed 's|/|\\\\/|g'` 20 awk "/^[^ ]* $escaped_mntpt / { print \$3 }" /proc/mounts | grep -v rootfs 20 my $MAXLABEL=25; 21 22 # Read /proc/mounts 23 my %mounts; 24 open (MOUNTS,"/proc/mounts") or die "Could not /proc/mounts for reading."; 25 while (<MOUNTS>) { 26 # Does perl really not have any shorthand for this? I guess it has. 27 if ( /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/ ) { 28 $mounts{$2}=$3; 29 } 30 } 31 close MOUNTS; 32 33 sub print_values() { 34 35 # Read from df 36 open (DF,"/bin/df -P -l -i |") or die "Could not open pipe from /bin/df, $!"; 37 <DF>; # Skip the header 38 while (<DF>) { 39 next if /\/\//; 40 41 # Parse the output 42 if ( /^(\S+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\S+)\s+(\S+)/ ) { 43 my $fs=$mounts{$6}; 44 my $ps=$5; 45 my $name=$1; 46 next if $fs eq "reiserfs"; 47 48 $ps =~ s/\%//; 49 $name =~ s/\//_/g; 50 print $name . ".value " . $ps . "\n"; 51 } 52 } 53 close DF; 54 } 55 56 if ( $ARGV[0] eq "autoconf" ) { 57 if (`perl $0` eq "" ) { 58 print "no\n"; 59 exit 1; 60 } 61 elsif ( `uname -s` eq "SunOS\n" ) { 62 print "no\n"; 63 exit 1; 64 } 65 else { 66 print "yes\n"; 67 exit 0; 68 } 21 69 } 22 70 23 print_values() { 24 df -P -l -i -x none -x unknown | sed 1d | grep -v "//" | awk '$5 ~ /[0-9]%/ {print}' | while read i; do 25 if [ "`fs $i`" = "reiserfs" ] ; then continue ; fi 26 name=`echo $i | sed 's/[\/.-]/_/g'| awk '{ print $1 ".value " }'` 27 echo -n "$name " 28 echo $i | awk '{ print $5 }' | cut -f1 -d% 29 done 71 if ( $ARGV[0] eq "config" ) { 72 73 # The headers 74 print "graph_title Inode usage (in %)\n"; 75 print "graph_args --upper-limit 100 -l 0\n"; 76 print "graph_vlabel %\n"; 77 78 # Read from df 79 open (DF,"/bin/df -P -l -i |") or die "Unable to open pipe from /bin/df"; 80 <DF>; # Skip the header 81 while (<DF>) { 82 next if /\/\//; 83 84 # Parse the output 85 if ( /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/ ) { 86 my $fs=$mounts{$6}; 87 my $dir=$6; 88 my $name=$1; 89 90 # Create and print labels 91 $name =~ s/\//_/g; 92 next if $fs eq "reiserfs"; 93 print $name . ".label "; 94 if ( length($dir) <= $MAXLABEL ) { 95 print $dir . "\n"; 96 } 97 else { 98 printf ("...%s\n", substr ($dir, length($dir)-$MAXLABEL+4,$MAXLABEL-3)); 99 } 100 101 print "$name.warning 92\n"; 102 print "$name.critical 98\n"; 103 } 104 } 105 close DF; 106 exit 0; 30 107 } 31 108 32 if [ "$1" = "autoconf" ]; then 33 if [ "`print_values`" = "" ] ; then 34 echo no 35 else 36 echo yes 37 fi 38 exit 0 39 fi 40 41 if [ "$1" = "config" ]; then 42 43 echo 'graph_title Inode usage (in %)' 44 echo 'graph_args --upper-limit 100 -l 0' 45 echo 'graph_vlabel %' 46 echo 'graph_category disk' 47 echo 'graph_info This graph shows the inode usage for the partitions of types that use inodes.' 48 df -P -l -i -x unknown -x none -T| sed 1d | grep -v "//" | sort | awk '$6 ~ /[0-9]%/ {print}' | awk " 49 \$2 !~ /reiserfs/ { 50 dir=\$7 51 name=\$1; gsub(/[\/.-]/, \"_\", name); 52 if (length(dir) <= $MAXLABEL) 53 print name \".label \" dir 54 else 55 printf (\"%s.label ...%s\n\", name, substr (dir, length(dir)-$MAXLABEL+4, $MAXLABEL-3)) 56 print name \".info \" \$7 \" (\" \$2 \") -> \" \$1; 57 print name \".warning 92\" 58 print name \".critical 98\" 59 }" 60 exit 0 61 fi 62 63 print_values 109 print_values(); people/ilmari/modularisation-branch/node/node.d.linux/fw_forwarded_local.in
r1012 r1045 2 2 # 3 3 # Plugin to monitor network connections. 4 # forward: number of connections forwarder 5 # local: number of connections for the host itself 4 6 # 5 7 # Parameters: … … 47 49 fi 48 50 49 cat /proc/net/ip_conntrack | grep ESTABLISHED | sed 's/.*src=\(.*\) .*dst=\(.*\) sport.*src=\(.*\) .*dst=\(.*\) spo.*/\1 \2 \3 \4/g' | awk 'BEGIN {{FORW=0} {LOCAL=0}} {if($1 != $4){ FORW += 1} else { LOCAL += 1}} END {{print "forward.value "FORW} {print "local.value "LOCAL}}' 51 perl -ne ' 52 BEGIN { $forward=0; $local=0; } 53 54 if ( ($src, $dst, $isrc, $idst) = 55 /.*ESTABLISHED src=(.*) .*dst=(.*) sport.*src=(.*) .*dst=(.*) sport.*/ ) { 56 if( $src eq $idst) { 57 $local++; 58 } else { 59 $forward++; 60 } 61 } 62 END { print "forward.value $forward\nlocal.value $local\n" } 63 ' </proc/net/ip_conntrack 64 people/ilmari/modularisation-branch/node/node.d.linux/nfs_client.in
r1012 r1045 31 31 fi 32 32 33 i=4; 33 awk '/proc3/ { 34 split("'"$proc"'", names) 35 split($0,values) 36 for (e in names) { 37 printf("%s.value %d\n", names[++i], values[i+3]); 38 } 39 }' $NFS 34 40 35 for a in $proc; do36 echo -n "$a.value "37 grep proc3 $NFS \38 | cut -f $i -d ' ' \39 | awk '{print $1}'40 i=$(expr $i + 1)41 donepeople/ilmari/modularisation-branch/node/node.d.linux/nfsd.in
r1012 r1045 2 2 # 3 3 # Plugin created by Alexandre Dupouy, with the assistance of Mike Fedyk 4 # 5 # $Log$ 6 # Revision 1.9.2.1 2005/03/16 13:45:45 ilmari 7 # Fix autoconf for linux/{nfsd,nfs_client}. 8 # 9 # Revision 1.9 2004/12/10 10:47:49 jimmyo 10 # Change name from ${scale} to ${graph_period}, to be more consistent. 11 # 12 # Revision 1.8 2004/12/09 22:12:56 jimmyo 13 # Added "graph_period" option, to make "graph_sums" usable. 14 # 15 # Revision 1.7 2004/11/21 00:17:12 jimmyo 16 # Changed a lot of plugins so they use DERIVE instead of COUNTER. 17 # 18 # Revision 1.6 2004/10/01 12:32:09 ilmari 19 # complete "rpc" removal 20 # 21 # Revision 1.5 2004/10/01 08:40:50 ilmari 22 # Remove useless 'rpc' field, add total field 23 # 24 # Revision 1.4 2004/05/20 19:02:37 jimmyo 25 # Set categories on a bunch of plugins 26 # 27 # Revision 1.3 2004/05/15 21:33:29 jimmyo 28 # "Upped" som plugins from contrib/manual to manual or auto. 29 # 30 # Revision 1.2 2004/05/06 21:55:18 jimmyo 31 # Added patch to contrib-plugin linux/nfsd, to graph rpc count (Alexandre Dupouy). 32 # 33 # Revision 1.1 2004/02/18 18:41:54 jimmyo 34 # Plugin created by Alexandre Dupouy, with the assistance of Mike Fedyk 35 # 4 36 # 5 37 #%# family=auto … … 11 43 12 44 if [ "$1" = "autoconf" ]; then 13 if [ - x"$NFSD" ]; then45 if [ -f "$NFSD" ]; then 14 46 echo yes 15 47 exit 0 16 48 else 17 echo no49 echo "no (no $NFSD)" 18 50 exit 1 19 51 fi … … 31 63 fi 32 64 33 i=4; 34 35 for a in $proc; do 36 echo -n "$a.value " 37 grep proc3 $NFSD \ 38 | cut -f $i -d ' ' \ 39 | awk '{print $1}' 40 i=$(expr $i + 1) 41 done 65 awk '/proc3/ { 66 split("'"$proc"'", names) 67 split($0,values) 68 for (e in names) 69 printf("%s.value %d\n", names[++i], values[i+3]); 70 }' $NFSD people/ilmari/modularisation-branch/node/node.d/apc_envunit_.in
r864 r1045 46 46 if [ "$community" ]; then COMMUNITY=$community ; fi 47 47 48 UNITS="rg20-sonde b105-sonde"49 COMMUNITY="zorglub"50 48 SNMPOPTS="-Ov -Oq -v1 -c ${COMMUNITY}" 51 49 people/ilmari/modularisation-branch/node/node.d/bind9_rndc.in
r1012 r1045 32 32 33 33 open(my $stats, '<', $querystats) or die "$querystats: $!\n"; 34 seek($stats , 400, -1); # go nearly to the end of the file34 seek($stats , -400, 2); # go nearly to the end of the file 35 35 # to avoid reading it all 36 36 people/ilmari/modularisation-branch/node/node.d/cupsys_pages.in
r1012 r1045 1 # 1 2 #!@@PERL@@ -w 2 3 # … … 23 24 24 25 use strict; 26 # use Muninnode; 25 27 26 28 my $statefile = "@@PLUGSTATE@@/munin-cupsys-pages.state"; 29 # my $statefile = "$Muninnode::PLUGSTATE/munin-cupsys-pages.state"; 27 30 my $pos = undef; 28 31 my %printers = (); 29 32 30 my $LOGDIR = $ENV{ logdir} || "/var/log/cups/";31 my $LOGFILE = $ENV{ logfile} || "page_log";32 my $MAXLABEL = $ENV{ maxlabel} || 20;33 my $LOGDIR = $ENV{'logdir'} || '/var/log/cups'; 34 my $LOGFILE = $ENV{'logfile'} || 'page_log'; 35 my $MAXLABEL = $ENV{'maxlabel'} || 20; 33 36 34 if($ARGV[0] and $ARGV[0] eq "autoconf") {37 if($ARGV[0] and $ARGV[0] eq 'autoconf' ) { 35 38 my $logfile; 36 39 if(-d $LOGDIR) { … … 60 63 } elsif (-f "$logfile.01") { 61 64 $rotlogfile = $logfile . ".01"; 62 } 65 } 63 66 64 67 if (! -f $logfile and ! -f $rotlogfile) { … … 67 70 } 68 71 69 if (-f "$statefile") {70 open(IN, "$statefile") or exit 4;72 if (-f $statefile) { 73 open(IN, $statefile) or exit 4; 71 74 if(<IN> =~ /^(\d+)$/) { 72 75 $pos = $1; … … 100 103 101 104 # Write back to state file 105 print "Foo! $statefile\n"; 102 106 open (STATFILE, ">$statefile") or exit 4; 103 107 print STATFILE "$pos\n"; … … 112 116 print "graph_args --base 1000 -l 0\n"; 113 117 print "graph_vlabel pages/\${graph_period}\n"; 114 print "graph_order ".join(" ",sort(keys(%printers)))."\n"; 118 print "graph_order ". 119 join(" ", 120 sort(map { s/^[^a-zA-Z_]*//; s/[^a-zA-Z0-9_]/_/g; $_; } 121 keys(%printers))), 122 "\n"; 115 123 foreach my $printer (sort(keys %printers)) { 116 print "$printer.label $printer\n"; 124 # Convert printername to something legal 125 my $p = $printer; 126 $printer =~ s/^[^a-zA-Z_]*//; 127 $printer =~ s/[^a-zA-Z0-9_]/_/g; 128 print "$printer.label $p\n"; 117 129 print "$printer.type DERIVE\n"; 118 130 print "$printer.min 0\n"; … … 121 133 } else { 122 134 foreach my $printer (sort(keys %printers)) { 123 print "$printer.value ".$printers{$printer}."\n"; 135 my $p = $printer; 136 $printer =~ s/^[^a-zA-Z_]*//; 137 $printer =~ s/[^a-zA-Z0-9_]/_/g; 138 print "$printer.value ".$printers{$p}."\n"; 124 139 } 125 140 } 126 141 127 sub parselogfile { 142 sub parselogfile { 128 143 my ($fname, $start, $stop) = @_; 129 144 open (LOGFILE, $fname) or exit 3; … … 140 155 } 141 156 } 142 close(LOGFILE); 157 close(LOGFILE); 143 158 } 159 160 people/ilmari/modularisation-branch/node/node.d/hddtemp_smartctl.in
r1012 r1045 137 137 my @F = split ' ', $1; 138 138 print "$_.value $F[9]\n"; 139 } elsif ($output =~ /^(231 Temperature_Celsius.*)/m) { 140 my @F = split ' ', $1; 141 print "$_.value $F[9]\n"; 139 142 } 140 143 } people/ilmari/modularisation-branch/node/node.d/mailscanner.in
r1012 r1045 1 # 1 2 #!@@PERL@@ -w 2 3 # … … 63 64 64 65 my @lines = split(/\n/, qx($logtail -f $logfile -o $offsetfile)); 66 67 # sometimes the logtail syntax is: 68 #my @lines = split(/\n/, qx($logtail $logfile $offsetfile)); 69 65 70 foreach (@lines) { 66 SWITCH: { 67 if (/New Batch: S/) { 68 s/.*New Batch: Scanning ([0-9]+) messages.*/$1/; 69 $total += $_; 70 last SWITCH; 71 } 72 if (/Virus Scanning: F/) { 73 s/.*Virus Scanning: Found ([0-9]+) viruses.*/$1/g; 74 $viruses += $_; 75 last SWITCH; 76 } 77 if (/Spam Checks: F/) { 78 s/.*Spam Checks: Found ([0-9]+) spam.*/$1/g; 79 $spams += $_; 80 last SWITCH; 81 } 82 if (/Other Checks: F/) { 83 s/.*Other Checks: Found ([0-9]+) problems.*/$1/g; 84 $others += $_; 85 last SWITCH; 86 } 87 } 71 if (s/.*New Batch: Scanning ([0-9]+) messages.*/$1/) { 72 $total += $_; 73 next; 74 } 75 if (s/.*Virus Scanning: Found ([0-9]+) viruses.*/$1/g) { 76 $viruses += $_; 77 next; 78 } 79 if (s/.*Spam Checks: Found ([0-9]+) spam.*/$1/g) { 80 $spams += $_; 81 next; 82 } 83 if (s/.*Other Checks: Found ([0-9]+) problems.*/$1/g) { 84 $others += $_; 85 next; 86 } 88 87 } 88 89 89 $clean = $total - ($viruses + $spams + $others); 90 90 people/ilmari/modularisation-branch/node/node.d/multips.in
r1012 r1045 33 33 34 34 echo graph_title Number of selected processes 35 echo 'graph_category processes' 35 36 echo 'graph_args --base 1000 --vertical-label processes -l 0' 36 37 for name in $names; do people/ilmari/modularisation-branch/node/node.d/mysql_queries.in
r1012 r1045 48 48 49 49 open(SERVICE, "$COMMAND |") 50 or die("Coul tnot execute '$COMMAND': $!");50 or die("Could not execute '$COMMAND': $!"); 51 51 52 52 while (<SERVICE>) { people/ilmari/modularisation-branch/node/node.d/ps_.in
r1012 r1045 49 49 printf "count.value " 50 50 51 PGREP=`which pgrep` 52 if [ -n "$PGREP" ]; then 53 $PGREP -f -l "$name" | grep "$REGEX" | wc -l 51 PGREP=/usr/bin/pgrep 52 53 if [ -x "$PGREP" ]; then 54 $PGREP -f -l "$name" | grep "$REGEX" | grep -v grep | wc -l 54 55 elif [ -x /usr/ucb/ps ]; then 55 56 # Solaris without pgrep. How old is that? people/ilmari/modularisation-branch/node/node.d/sendmail_mailqueue.in
r1012 r1045 21 21 MTA_QUEUE=/var/spool/mqueue 22 22 if [ "$mspqueue" ]; then MSP_QUEUE=$mspqueue ; fi 23 if [ "$mtaqueue" ]; then MTA_QUEUE=$m spqueue ; fi23 if [ "$mtaqueue" ]; then MTA_QUEUE=$mtaqueue ; fi 24 24 25 25 if [ "$1" = "autoconf" ]; then … … 43 43 fi 44 44 45 mspmails=`find ${MSP_QUEUE} -type f -name '[qQ]*' 2>/dev/null | wc -l` 46 mtamails=`find ${MTA_QUEUE} -type f -name '[qQ]*' 2>/dev/null | wc -l` 45 # Append /. to directory to force following symlinks at the start 46 # point. 47 mspmails=$(find ${MSP_QUEUE}/. -type f -name '[qQ]*' 2>/dev/null | wc -l) 48 mtamails=$(find ${MTA_QUEUE}/. -type f -name '[qQ]*' 2>/dev/null | wc -l) 47 49 echo "mails.value `expr ${mspmails} + ${mtamails}`" people/ilmari/modularisation-branch/server/munin-update.in
r1012 r1045 1 1 #!@@PERL@@ -w 2 # -*- cperl -*- 2 3 # 3 4 # Copyright (C) 2002-2004 Jimmy Olsen, Audun Ytterdal … … 148 149 munin_runlock("$config->{rundir}/munin-update.lock"); 149 150 150 open (STATS,">$config->{dbdir}/munin-update.stats.tmp") or logger("Unable to open $config->{datadir}/munin-update.stats"); 151 if (!open (STATS,">$config->{dbdir}/munin-update.stats.tmp")) { 152 logger("Unable to open $config->{dbdir}/munin-update.stats"); 153 # Use /dev/null instead - if the admin won't fix he won't care 154 open(STATS,">/dev/null") or die "Could not open STATS to /dev/null: $?"; 155 } 151 156 152 157 my %children = (); … … 166 171 167 172 logger("Starting munin-update"); 168 169 173 170 174 for my $key (keys %{$config->{domain}}) { people/ilmari/modularisation-branch/server/munin.conf.pod
r864 r1045 67 67 update no 68 68 load.graph_title Total load 69 load.sum_load. titleload69 load.sum_load.label load 70 70 load.sum_load.special_stack machine1=machine1.one.dom:load.load machine2=machine2.one.dom:load.load 71 71
