Changeset 1045

Show
Ignore:
Timestamp:
07/24/06 11:43:10 (6 years ago)
Author:
ilmari
Message:

r8503@vesla: ilmari | 2006-07-24 10:37:37 +0100
Merge from trunk

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • people/ilmari/modularisation-branch/Makefile

    r1044 r1045  
    217217 
    218218rpm: 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) 
    221221 
    222222rpm-src: rpm-pre 
     
    224224        (cd ..; rpmbuild -ts munin-$(RELEASE).tar.gz) 
    225225 
    226 +suse-pre: 
     226suse-pre: 
    227227        @for file in `find dists/suse/ -type f -name '*.in'`; do                \ 
    228228                destname=`echo $$file | sed 's/.in$$//'`;               \ 
     
    256256 
    257257        -rm -f dists/redhat/munin.spec 
     258        -rm -f dists/suse/munin.spec 
    258259 
    259260source_dist: clean 
  • people/ilmari/modularisation-branch/RELEASE

    r1012 r1045  
    1 1.3.2 
     1snapshot 
  • people/ilmari/modularisation-branch/dists/redhat/munin.cron.d

    r864 r1045  
    66 
    77*/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 --removeok 
  • people/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 
    131Name:      munin 
    232Version:   @@VERSION@@ 
    3 Release:   4 
     33Release:   0.%{?dist} 
    434Summary:   Network-wide graphing framework (grapher/gatherer) 
    5 Copyright: GPL 
     35License:  GPL 
    636Group:     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 
     37URL:       http://munin.projects.linpro.no/ 
     38 
     39BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 
     40 
     41Source0: http://download.sourceforge.net/sourceforge/munin/%{name}_%{version}.tar.gz 
     42#Patch0: munin-conf.patch 
    1443BuildArchitectures: noarch 
    15 Provides: perl(RRDs) 
    1644Requires: perl-HTML-Template 
    1745Requires: perl-Net-Server 
    1846Requires: rrdtool 
    1947Requires: logrotate 
    20 Obsoletes: lrrd-server 
     48Requires(pre):          %{usermgmt} 
     49Requires(postun):       %{usermgmt} 
    2150 
    2251%description 
     
    3160 
    3261Munin 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/>. 
     62RRDtool.  
     63 
     64The RHEL package is based on the package from Fedora Extras 
    3565 
    3666%package node 
     
    3969BuildArchitectures: noarch 
    4070Requires: perl-Net-Server 
    41 #Requires: perl-Config-General 
    4271Requires: procps >= 2.0.7 
    4372Requires: sysstat 
    44 Obsoletes: lrrd-client 
     73Requires(pre):          %{usermgmt} 
     74Requires(postun):       %{usermgmt} 
     75Requires(post): /sbin/chkconfig 
     76Requires(preun): /sbin/chkconfig 
     77Requires(preun): /sbin/service 
    4578 
    4679%description node 
     
    6396 
    6497Munin 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 at 
    66 <http://www.linpro.no/projects/munin/example/>. 
    67  
     98RRDtool.  
     99 
     100The RHEL package is based on the package from Fedora Extras 
    68101 
    69102%prep 
    70103%setup -q 
    71 rm -rf %{buildroot} 
    72 mkdir -p %{buildroot} 
     104#%patch0 -p1 
    73105 
    74106%build 
     
    78110perl -pi -e 's,htmldoc munin,cat munin, or s,html(2text|doc),# $&,' Makefile 
    79111perl -pi -e 's,\$\(INSTALL.+\.(pdf|txt) \$\(DOCDIR,# $&,' Makefile 
    80 make    clean 
    81 make    CONFIG=dists/redhat/Makefile.config \ 
    82         build 
     112make    CONFIG=dists/redhat/Makefile.config build 
    83113 
    84114%install 
     
    86116## Node 
    87117make    CONFIG=dists/redhat/Makefile.config \ 
    88         DOCDIR=%{buildroot}%{_docdir}/munin
     118        DOCDIR=%{buildroot}%{_docdir}/%{name}-%{version}
    89119        MANDIR=%{buildroot}%{_mandir} \ 
    90120        DESTDIR=%{buildroot} \ 
    91         install-main install-node install-node-plugins install-doc install-man 
     121        install-main install-node-non-snmp install-node-plugins install-doc install-man 
    92122 
    93123mkdir -p %{buildroot}/etc/rc.d/init.d 
     
    98128mkdir -p %{buildroot}/var/log/munin 
    99129 
    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
     133cat dists/redhat/munin-node.rc | sed -e 's/2345/\-/' > %{buildroot}/etc/rc.d/init.d/munin-node 
     134chmod 755 %{buildroot}/etc/rc.d/init.d/munin-node 
     135 
    101136install -m0644 dists/tarball/plugins.conf %{buildroot}/etc/munin/ 
    102137install -m0644 dists/tarball/plugins.conf %{buildroot}/etc/munin/plugin-conf.d/munin-node 
    103138install -m0644 dists/debian/munin.logrotate %{buildroot}/etc/logrotate.d/munin 
    104139install -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 
     140install -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
     146rm -f %{buildroot}/usr/share/munin/plugins/pm3users_ 
     147rm -f %{buildroot}/usr/share/munin/plugins/snmp_* 
     148rm -f %{buildroot}/usr/share/munin/plugins/sybase_space 
    111149 
    112150## Server 
     
    115153        install-main 
    116154 
    117 # cf=%{buildroot}/etc/munin/munin.conf; sed 's,/var/www/munin,/var/www/html/munin,g' < $cf > $cf.patched && mv $cf.patched $cf 
    118  
    119155mkdir -p %{buildroot}/var/www/html/munin 
    120156mkdir -p %{buildroot}/var/log/munin 
    121157mkdir -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 
     159install -m 0644 dists/redhat/munin.cron.d %{buildroot}/etc/cron.d/munin 
     160install -m 0644 server/style.css %{buildroot}/var/www/html/munin 
     161install -m 0644 ChangeLog %{buildroot}%{_docdir}/%{name}-%{version}/ChangeLog 
    129162 
    130163%clean 
    131 [ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot} 
     164rm -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 
     180test "$1" != 0 || %{_initrddir}/munin-node stop &>/dev/null || : 
     181test "$1" != 0 || /sbin/chkconfig --del munin-node 
     182 
     183%postun node 
     184test "$1" != 0 || %{userdel} munin &>/dev/null || : 
     185test "$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 
     197test "$1" != 0 || %{userdel} munin &>/dev/null || : 
     198test "$1" != 0 || %{groupdel} munin &>/dev/null || : 
    132199  
    133 %pre node 
    134 getent group munin >/dev/null || groupadd -r munin 
    135 getent passwd munin > /dev/null || useradd -r -d /var/lib/munin -g munin munin 
    136  
    137 %post node 
    138 chmod -R g+w /var/lib/munin/ 
    139 chmod +x %{_datadir}/munin/plugins/* 
    140 chmod +x %{_sbindir}/munin* 
    141  
    142 if [ $1 = 1 ] 
    143 then 
    144         /sbin/chkconfig --add munin-node 
    145         /usr/sbin/munin-node-configure --shell | sh 
    146 fi 
    147 chown -R munin /var/lib/munin 
    148  
    149  
    150 %preun node 
    151 if [ $1 = 0 ] 
    152 then 
    153         /sbin/chkconfig --del munin-node 
    154         rmdir /var/log/munin 2>/dev/null || echo " " 
    155 fi 
    156  
    157 %pre 
    158 getent group munin >/dev/null || groupadd -r munin 
    159 getent passwd munin > /dev/null || useradd -r -d /var/lib/munin -g munin munin 
    160  
    161 %post 
    162 mkdir -p /var/run/munin 
    163 chown -R munin /var/run/munin 
    164 chown -R munin /var/www/html/munin 
    165 chown -R munin /var/log/munin 
    166 chown -R munin /var/lib/munin 
    167  
    168 %postun 
    169 if [ $1 = 0 ] 
    170 then 
    171         userdel munin 
    172 fi 
    173  
    174200%files 
    175201%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 
    182207%{_bindir}/munin-cron 
    183208%{_datadir}/munin/munin-graph 
     
    185210%{_datadir}/munin/munin-limits 
    186211%{_datadir}/munin/munin-update 
    187 %{_libdir}/perl5/*perl/5.*/Munin.pm 
     212%{perl_vendorlib}/Munin.pm 
    188213/var/www/html/munin/cgi/munin-cgi-graph 
    189214%dir /etc/munin/templates 
    190215%dir /etc/munin 
    191 /etc/munin/templates/* 
    192 /etc/cron.d/munin 
     216%config(noreplace) /etc/munin/templates/* 
     217%config(noreplace) /etc/cron.d/munin 
    193218%config(noreplace) /etc/munin/munin.conf 
    194219%config(noreplace) /etc/logrotate.d/munin 
    195220 
    196 %attr(-, munin, root) %dir /var/lib/munin 
    197 %attr(-, munin, root) %dir /var/log/munin 
    198 %attr(-, munin, root) %dir /var/www/html/munin 
    199 %attr(-, munin, root) %dir /var/www/html/munin/cgi 
    200 %attr(-, munin, root) /var/www/html/munin/style.css 
    201 %config /var/www/html/munin/.htaccess 
     221%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 
    202227%doc %{_mandir}/man8/munin-graph* 
    203228%doc %{_mandir}/man8/munin-update* 
     
    211236%config(noreplace) /etc/munin/munin-node.conf 
    212237%config(noreplace) /etc/munin/plugin-conf.d/munin-node 
     238%config(noreplace) /etc/munin/plugin-conf.d/sendmail 
    213239%config(noreplace) /etc/logrotate.d/munin-node 
    214 %config /etc/rc.d/init.d/munin-node 
     240/etc/rc.d/init.d/munin-node 
    215241%config(noreplace) /etc/munin/plugins.conf 
    216242%{_sbindir}/munin-run 
    217243%{_sbindir}/munin-node 
    218244%{_sbindir}/munin-node-configure 
    219 %{_sbindir}/munin-node-configure-snmp 
    220 %dir /var/log/munin 
     245%attr(-, munin, munin) %dir /var/log/munin 
    221246%dir %{_datadir}/munin 
    222247%dir /etc/munin/plugins 
    223248%dir /etc/munin 
    224 %dir /var/lib/munin 
    225 %dir %attr(-, root, munin) /var/lib/munin/plugin-state 
     249%attr(-, munin, munin) %dir /var/lib/munin 
     250%dir %attr(-, munin, munin) /var/lib/munin/plugin-state 
    226251%{_datadir}/munin/plugins/* 
    227 %doc %{_docdir}/munin/COPYING 
    228 %doc %{_docdir}/munin/munin-doc.html 
    229 %doc %{_docdir}/munin/munin-faq.html 
     252%doc %{_docdir}/%{name}-%{version}/COPYING 
     253%doc %{_docdir}/%{name}-%{version}/munin-doc.html 
     254%doc %{_docdir}/%{name}-%{version}/munin-faq.html 
    230255%doc %{_mandir}/man8/munin-run* 
    231256%doc %{_mandir}/man8/munin-node* 
     
    233258 
    234259%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 
    236296- 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 
    238299- 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 
    240302- 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 
    242305- 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 
    244308- Sync with release of 1.2.2 
    245309- Add some nice text from the suse specfile 
     
    247311- Some cosmetic changes 
    248312- Added logrotate scripts (stolen from debian package) 
     313 
    249314* Sun Feb 01 2004 Ingvar Hagelund <ingvar@linpro.no> 
    250315- Sync with CVS. Version 1.0.0pre2 
     316 
    251317* Sun Jan 18 2004 Ingvar Hagelund <ingvar@linpro.no> 
    252318- Sync with CVS. Change names to munin. 
     319 
    253320* Fri Oct 31 2003 Ingvar Hagelund <ingvar@linpro.no> 
    254321- Lot of small fixes. Now builds on more RPM distros 
     322 
    255323* Wed May 21 2003 Ingvar Hagelund <ingvar@linpro.no> 
    256324- Sync with CVS 
    257325- 0.9.5-1 
     326 
    258327* Tue Apr  1 2003 Ingvar Hagelund <ingvar@linpro.no> 
    259328- Sync with CVS 
    260329- Makefile-based install of core files 
    261330- Build doc (only pod2man) 
     331 
    262332* Thu Jan  9 2003 Ingvar Hagelund <ingvar@linpro.no> 
    263333- Sync with CVS, auto rpmbuild 
     334 
    264335* Thu Jan  2 2003 Ingvar Hagelund <ingvar@linpro.no> 
    265336- Fix spec file for RedHat 8.0 and new version of lrrd 
     337 
    266338* Wed Sep  4 2002 Ingvar Hagelund <ingvar@linpro.no> 
    267339- Small bugfixes in the rpm package 
     340 
    268341* Tue Jun 18 2002 Kjetil Torgrim Homme <kjetilho@linpro.no> 
    269342- new package 
  • people/ilmari/modularisation-branch/node/munin-node-simple.in

    r1012 r1045  
    3636%ENV = (); 
    3737$ENV{PATH}  = "/bin:/usr/bin"; 
     38# We emptied the environment. There will be no locale issues. 
    3839 
    3940my $config  = &read_config($conffile); 
  • people/ilmari/modularisation-branch/node/munin-node.in

    r1012 r1045  
    11#!@@PERL@@ -wT 
    22# 
    3 # Copyright (C) 2004 Audun Ytterdal, Jimmy Olsen 
     3# Copyright (C) 2002-2006 Audun Ytterdal, Jimmy Olsen, Tore Anderson, 
     4#    Nicolai Langfeldt 
    45# 
    56# This program is free software; you can redistribute it and/or 
     
    1718# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
    1819# 
    19 # 
    2020# $Id$ 
    2121# 
     
    4949my %services; 
    5050my %nodes; 
    51 my $servicedir="@@CONFDIR@@/plugins"; 
    52 my $sconfdir="@@CONFDIR@@/plugin-conf.d"; 
    53 my $conffile="@@CONFDIR@@/munin-node.conf"; 
     51my $servicedir="$CONFDIR/plugins"; 
     52my $sconfdir="$CONFDIR/plugin-conf.d"; 
     53my $conffile="$CONFDIR/munin-node.conf"; 
    5454my $FQDN=""; 
    5555my $do_usage = 0; 
    5656my $DEBUG = 0; 
    5757my $do_version = 0; 
    58 my $VERSION="@@VERSION@@"
    59 my $defuser = getpwnam ("@@PLUGINUSER@@"); 
    60 my $defgroup= getgrnam ("@@GROUP@@"); 
     58my $VERSION=$Muninnode::VERSION
     59my $defuser = getpwnam ($PLUGINUSER); 
     60my $defgroup= getgrnam ($GROUP); 
    6161my $paranoia= 0; 
    6262my @ignores = (); 
     
    179179$ENV{FQDN}=$FQDN; 
    180180 
     181# Some locales uses "," as decimal separator. This can mess up a lot 
     182# of plugins. 
     183$ENV{'LC_ALL'}='C'; 
     184 
    181185MyPackage->run(conf_file => $conffile, 
    182                pid_file => "@@STATEDIR@@/munin-node.pid"); 
     186               pid_file => "$STATEDIR/munin-node.pid"); 
    183187exit; 
    184188 
     
    240244        closedir (DIR); 
    241245    } 
    242      
     246 
    243247    opendir (DIR,$servicedir) || die "Cannot open plugindir: $servicedir $!"; 
    244248FILES: 
     
    538542      $key = &get_var (\%sconf, "tls_private_key") 
    539543          unless defined $key; 
    540       $key = "@@CONFDIR@@/munin-node.pem" unless defined $key; 
     544      $key = "$CONFDIR/munin-node.pem" unless defined $key; 
    541545      $cert = &get_var (\%sconf, "tls_certificate") 
    542546          unless defined $cert; 
    543       $cert = "@@CONFDIR@@/munin-node.pem" unless defined $cert; 
     547      $cert = "$CONFDIR/munin-node.pem" unless defined $cert; 
    544548      $mode = &get_var (\%sconf, 'tls'); 
    545549      $mode = "auto" unless defined $mode and length $mode; 
     
    10961100=head1 DESCRIPTION 
    10971101 
    1098 Munin's node is a daemon that Munin connects to fetch data. This data is 
    1099 stored in .rrd-files, and later graphed and htmlified. It's designed to 
    1100 let it be very easy to graph new datasources. 
     1102Munin's node is a daemon that Munin connects to to fetch data. This 
     1103data is stored and later graphed and htmlified. It's designed to let 
     1104it be very easy to graph new datasources. 
    11011105 
    11021106Munin-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/>. 
     1107Net::Server. It reads all the plugins in /etc/munin/plugins on startup. 
     1108 
     1109The network protocol is documented at 
     1110http://munin.projects.linpro.no/wiki/network-protocol 
     1111 
     1112These plugins can be in you language of choice: bash, perl, python, 
     1113C. The plugins can be run in two modes: with and without the 
     1114"config"-parameter. When run with "config" as parameter, the plugin 
     1115should output the configuration of the graph. When run without 
     1116parameters, the plugin should output just values.  Writing plugins is 
     1117easy and fun; please refer to 
     1118http://munin.projects.linpro.no/wiki/HowToWritePlugins and 
     1119http://munin.projects.linpro.no/wiki/plugins 
    11561120 
    11571121=head1 FILES 
     
    11731137=head1 BUGS 
    11741138 
    1175 munin-node does, as of now, not check the syntax of the configuration file. 
     1139Please se http://munin.projects.linpro.no/report/1 
     1140 
     1141munin-node does, as of now, not check the syntax of the configuration 
     1142file.  It also does not check that plugins produces legal field names 
     1143and observes other niceties. 
    11761144 
    11771145Please report other bugs in the bug tracker at L<http://munin.sf.net/>. 
     
    11791147=head1 COPYRIGHT 
    11801148 
    1181 Copyright © 2002 Audun Ytterdal, Jimmy Olsen, and Tore Anderson / Linpro AS. 
     1149Copyright © 2002-2006 Audun Ytterdal, Jimmy Olsen, and Tore Anderson / Linpro AS. 
    11821150 
    11831151This is free software; see the source for copying conditions. There is 
  • people/ilmari/modularisation-branch/node/node.d.freebsd/vmstat.in

    r1012 r1045  
    7070 
    7171if [ "$OSV" -ge "5" ]; then 
    72         sysctl -n vm.vmtotal | awk ' 
     72        /sbin/sysctl -n vm.vmtotal | awk ' 
    7373/^Processes:/ { 
    7474        print "running.value", $3; 
  • people/ilmari/modularisation-branch/node/node.d.linux/cpu.in

    r1012 r1045  
    1515#%# family=auto 
    1616#%# 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$ 
    1829 
    1930 
     
    2839fi 
    2940 
     41HZ=${HZ:-100} 
     42 
    3043extinfo="" 
    3144 
    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 
     45if egrep -q '^cpu +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+' /proc/stat; then 
    3446        extinfo="iowait irq softirq" 
    3547fi 
     
    3749if [ "$1" = "config" ]; then 
    3850 
    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)) 
    4154        if [ "$scaleto100" = "yes" ]; then 
    4255                graphlimit=100 
     
    4457                graphlimit=$PERCENT 
    4558        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)) 
    4962        echo 'graph_title CPU usage' 
    5063        echo "graph_order system user nice idle" $extinfo 
     
    5770        echo 'system.label system' 
    5871        echo 'system.draw AREA' 
    59         echo 'system.max 5000' 
     72        echo "system.max $MAX" 
    6073        echo 'system.min 0' 
    6174        echo 'system.type DERIVE' 
     
    6679        echo 'user.draw STACK' 
    6780        echo 'user.min 0' 
    68         echo 'user.max 5000' 
     81        echo "user.max $MAX" 
    6982        echo "user.warning $USRWARNING" 
    7083        echo 'user.type DERIVE' 
     
    7386        echo 'nice.draw STACK' 
    7487        echo 'nice.min 0' 
    75         echo 'nice.max 5000' 
     88        echo "nice.max $MAX" 
    7689        echo 'nice.type DERIVE' 
    7790        echo 'nice.info CPU time spent by nice(1)d programs' 
     
    7992        echo 'idle.draw STACK' 
    8093        echo 'idle.min 0' 
    81         echo 'idle.max 5000' 
     94        echo "idle.max $MAX" 
    8295        echo 'idle.type DERIVE' 
    8396        echo 'idle.info Idle CPU time' 
     
    93106                echo 'iowait.draw STACK' 
    94107                echo 'iowait.min 0' 
    95                 echo 'iowait.max 5000' 
     108                echo "iowait.max $MAX" 
    96109                echo 'iowait.type DERIVE' 
    97110                echo 'iowait.info CPU time spent waiting for I/O operations to finish' 
     
    99112                echo 'irq.draw STACK' 
    100113                echo 'irq.min 0' 
    101                 echo 'irq.max 5000' 
     114                echo "irq.max $MAX" 
    102115                echo 'irq.type DERIVE' 
    103116                echo 'irq.info CPU time spent handling interrupts' 
     
    105118                echo 'softirq.draw STACK' 
    106119                echo 'softirq.min 0' 
    107                 echo 'softirq.max 5000' 
     120                echo "softirq.max $MAX" 
    108121                echo 'softirq.type DERIVE' 
    109122                echo 'softirq.info CPU time spent handling "batched" interrupts' 
     
    118131 
    119132 
    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 
     133if [ ! -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 
    123135else 
    124         awk '/^cpu / { print "user.value " $2 "\nnice.value " $3 "\nsystem.value " $4 "\nidle.value " $5 }' < /proc/stat 
     136        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 
    125137fi 
  • people/ilmari/modularisation-branch/node/node.d.linux/df.in

    r1012 r1045  
    1 #!/bin/sh 
     1#!/usr/bin/perl 
    22# 
    3 # Script to monitor disk usage. 
    4 # 
     3# Plugin to monitor disk usage. Rewrite based on original shell-based version 
     4#  
    55# Parameters understood: 
    66# 
    7 #       config   (required) 
    8 #       autoconf (optional - used by munin-config) 
     7#       config   (required) 
     8#       autoconf (optional - used by munin-config) 
     9
     10# $Log$ 
    911# 
    1012# Magic markers (optional - used by munin-config and installation 
     
    1416#%# capabilities=autoconf 
    1517 
    16 MAXLABEL=20 
     18use strict; 
    1719 
    18 if [ "$1" = "autoconf" ]; then 
    19         echo yes 
    20         exit 0 
    21 fi 
     20my $MAXLABEL=25; 
    2221 
    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 
     23my %mounts; 
     24open (MOUNTS,"/proc/mounts") or die "Could not /proc/mounts for reading."; 
     25while (<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
     31close MOUNTS; 
     32 
     33sub 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     
     55if ( $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  } 
    3168} 
    3269 
     70if ( $ARGV[0] eq "config" ) { 
    3371 
    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
    35106 
    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 
     107print_values(); 
  • people/ilmari/modularisation-branch/node/node.d.linux/df_inode.in

    r1012 r1045  
    1 #!/bin/sh 
     1#!/usr/bin/perl 
    22# 
    3 # Plugin to monitor inode-usage. 
    4 # 
     3# Plugin to monitor inode-usage. Rewrite based on original shell-based version 
     4#  
    55# Parameters understood: 
    66# 
    7 #       config   (required) 
    8 #       autoconf (optional - used by munin-config) 
     7#       config   (required) 
     8#       autoconf (optional - used by munin-config) 
     9
     10# $Log$ 
    911# 
    1012# Magic markers (optional - used by munin-config and installation 
     
    1416#%# capabilities=autoconf 
    1517 
    16 MAXLABEL=20 
     18use strict; 
    1719 
    18 fs() { 
    19         local escaped_mntpt=`echo "$*" | awk '{ print $NF }' | sed 's|/|\\\\/|g'` 
    20         awk "/^[^ ]* $escaped_mntpt / { print \$3 }" /proc/mounts | grep -v rootfs 
     20my $MAXLABEL=25; 
     21 
     22# Read /proc/mounts 
     23my %mounts; 
     24open (MOUNTS,"/proc/mounts") or die "Could not /proc/mounts for reading."; 
     25while (<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
     31close MOUNTS; 
     32 
     33sub 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     
     56if ( $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  } 
    2169} 
    2270 
    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 
     71if ( $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; 
    30107} 
    31108 
    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 
     109print_values(); 
  • people/ilmari/modularisation-branch/node/node.d.linux/fw_forwarded_local.in

    r1012 r1045  
    22# 
    33# Plugin to monitor network connections. 
     4#  forward: number of connections forwarder 
     5#  local:   number of connections for the host itself 
    46# 
    57# Parameters: 
     
    4749fi 
    4850 
    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}}' 
     51perl -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  
    3131fi 
    3232 
    33 i=4; 
     33awk '/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 
    3440 
    35 for a in $proc; do 
    36         echo -n "$a.value " 
    37         grep proc3 $NFS \ 
    38                 | cut -f $i -d ' ' \ 
    39                 | awk '{print $1}' 
    40         i=$(expr $i + 1) 
    41 done 
  • people/ilmari/modularisation-branch/node/node.d.linux/nfsd.in

    r1012 r1045  
    22# 
    33# 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# 
    436# 
    537#%# family=auto 
     
    1143 
    1244if [ "$1" = "autoconf" ]; then 
    13         if [ -x "$NFSD" ]; then 
     45        if [ -f "$NFSD" ]; then 
    1446                echo yes 
    1547                exit 0 
    1648        else 
    17                 echo no 
     49                echo "no (no $NFSD)" 
    1850                exit 1 
    1951        fi 
     
    3163fi 
    3264 
    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 
     65awk '/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  
    4646if [ "$community" ]; then COMMUNITY=$community ; fi 
    4747 
    48 UNITS="rg20-sonde b105-sonde" 
    49 COMMUNITY="zorglub" 
    5048SNMPOPTS="-Ov -Oq -v1 -c ${COMMUNITY}" 
    5149 
  • people/ilmari/modularisation-branch/node/node.d/bind9_rndc.in

    r1012 r1045  
    3232     
    3333open(my $stats, '<', $querystats) or die "$querystats: $!\n"; 
    34 seek($stats , 400, -1);               # go nearly to the end of the file 
     34seek($stats , -400, 2);               # go nearly to the end of the file 
    3535                                # to avoid reading it all 
    3636 
  • people/ilmari/modularisation-branch/node/node.d/cupsys_pages.in

    r1012 r1045  
     1# 
    12#!@@PERL@@ -w 
    23# 
     
    2324 
    2425use strict; 
     26# use Muninnode; 
    2527 
    2628my $statefile = "@@PLUGSTATE@@/munin-cupsys-pages.state"; 
     29# my $statefile = "$Muninnode::PLUGSTATE/munin-cupsys-pages.state"; 
    2730my $pos       = undef; 
    2831my %printers  = (); 
    2932 
    30 my $LOGDIR    = $ENV{logdir}   || "/var/log/cups/"
    31 my $LOGFILE   = $ENV{logfile}  || "page_log"
    32 my $MAXLABEL  = $ENV{maxlabel} || 20; 
     33my $LOGDIR    = $ENV{'logdir'}   || '/var/log/cups'
     34my $LOGFILE   = $ENV{'logfile'}  || 'page_log'
     35my $MAXLABEL  = $ENV{'maxlabel'} || 20; 
    3336 
    34 if($ARGV[0] and $ARGV[0] eq "autoconf" ) { 
     37if($ARGV[0] and $ARGV[0] eq 'autoconf' ) { 
    3538    my $logfile; 
    3639    if(-d $LOGDIR) { 
     
    6063} elsif (-f "$logfile.01") { 
    6164    $rotlogfile = $logfile . ".01"; 
    62 }  
     65} 
    6366 
    6467if (! -f $logfile and ! -f $rotlogfile) { 
     
    6770} 
    6871 
    69 if (-f "$statefile") { 
    70     open(IN, "$statefile") or exit 4; 
     72if (-f $statefile) { 
     73    open(IN, $statefile) or exit 4; 
    7174    if(<IN> =~ /^(\d+)$/) { 
    7275        $pos = $1; 
     
    100103 
    101104# Write back to state file 
     105print "Foo! $statefile\n"; 
    102106open (STATFILE, ">$statefile") or exit 4; 
    103107print STATFILE "$pos\n"; 
     
    112116    print "graph_args --base 1000 -l 0\n"; 
    113117    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"; 
    115123    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"; 
    117129        print "$printer.type DERIVE\n"; 
    118130        print "$printer.min 0\n"; 
     
    121133} else { 
    122134    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"; 
    124139    } 
    125140} 
    126141 
    127 sub parselogfile {     
     142sub parselogfile { 
    128143    my ($fname, $start, $stop) = @_; 
    129144    open (LOGFILE, $fname) or exit 3; 
     
    140155        }  
    141156    } 
    142     close(LOGFILE);     
     157    close(LOGFILE); 
    143158} 
     159 
     160 
  • people/ilmari/modularisation-branch/node/node.d/hddtemp_smartctl.in

    r1012 r1045  
    137137    my @F = split ' ', $1; 
    138138    print "$_.value $F[9]\n"; 
     139  } elsif ($output =~ /^(231 Temperature_Celsius.*)/m) { 
     140    my @F = split ' ', $1; 
     141    print "$_.value $F[9]\n"; 
    139142  } 
    140143} 
  • people/ilmari/modularisation-branch/node/node.d/mailscanner.in

    r1012 r1045  
     1# 
    12#!@@PERL@@ -w 
    23# 
     
    6364 
    6465my @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 
    6570foreach (@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    } 
    8887} 
     88 
    8989$clean = $total - ($viruses + $spams + $others); 
    9090 
  • people/ilmari/modularisation-branch/node/node.d/multips.in

    r1012 r1045  
    3333 
    3434        echo graph_title Number of selected processes 
     35        echo 'graph_category processes' 
    3536        echo 'graph_args --base 1000 --vertical-label processes -l 0' 
    3637        for name in $names; do 
  • people/ilmari/modularisation-branch/node/node.d/mysql_queries.in

    r1012 r1045  
    4848 
    4949open(SERVICE, "$COMMAND |") 
    50   or die("Coult not execute '$COMMAND': $!"); 
     50  or die("Could not execute '$COMMAND': $!"); 
    5151 
    5252while (<SERVICE>) { 
  • people/ilmari/modularisation-branch/node/node.d/ps_.in

    r1012 r1045  
    4949printf "count.value " 
    5050 
    51 PGREP=`which pgrep` 
    52 if [ -n "$PGREP" ]; then 
    53         $PGREP -f -l "$name" | grep "$REGEX" | wc -l 
     51PGREP=/usr/bin/pgrep 
     52 
     53if [ -x "$PGREP" ]; then 
     54        $PGREP -f -l "$name" | grep "$REGEX" | grep -v grep | wc -l 
    5455elif [ -x /usr/ucb/ps ]; then 
    5556        # Solaris without pgrep. How old is that? 
  • people/ilmari/modularisation-branch/node/node.d/sendmail_mailqueue.in

    r1012 r1045  
    2121MTA_QUEUE=/var/spool/mqueue 
    2222if [ "$mspqueue"  ]; then MSP_QUEUE=$mspqueue ; fi 
    23 if [ "$mtaqueue"  ]; then MTA_QUEUE=$mspqueue ; fi 
     23if [ "$mtaqueue"  ]; then MTA_QUEUE=$mtaqueue ; fi 
    2424 
    2525if [ "$1" = "autoconf" ]; then 
     
    4343fi 
    4444 
    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. 
     47mspmails=$(find ${MSP_QUEUE}/. -type f -name '[qQ]*' 2>/dev/null | wc -l) 
     48mtamails=$(find ${MTA_QUEUE}/. -type f -name '[qQ]*' 2>/dev/null | wc -l) 
    4749echo "mails.value `expr ${mspmails} + ${mtamails}`" 
  • people/ilmari/modularisation-branch/server/munin-update.in

    r1012 r1045  
    11#!@@PERL@@ -w 
     2# -*- cperl -*- 
    23# 
    34# Copyright (C) 2002-2004 Jimmy Olsen, Audun Ytterdal 
     
    148149munin_runlock("$config->{rundir}/munin-update.lock"); 
    149150 
    150 open (STATS,">$config->{dbdir}/munin-update.stats.tmp") or logger("Unable to open $config->{datadir}/munin-update.stats"); 
     151if (!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
    151156 
    152157my %children = (); 
     
    166171 
    167172logger("Starting munin-update");  
    168  
    169173 
    170174for my $key (keys %{$config->{domain}}) { 
  • people/ilmari/modularisation-branch/server/munin.conf.pod

    r864 r1045  
    6767                update no 
    6868                load.graph_title Total load 
    69                 load.sum_load.title load 
     69                load.sum_load.label load 
    7070                load.sum_load.special_stack machine1=machine1.one.dom:load.load machine2=machine2.one.dom:load.load 
    7171