Merge branch 'ph/irq'
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Wed, 28 Feb 2007 07:54:36 +0000 (08:54 +0100)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Wed, 28 Feb 2007 07:54:36 +0000 (08:54 +0100)
1  2 
configure.in
contrib/collection.cgi
contrib/fedora/collectd.spec

diff --combined configure.in
@@@ -1046,13 -1046,14 +1046,14 @@@ AC_COLLECTD([dns],       [disable], [mo
  AC_COLLECTD([email],     [disable], [module], [email statistics])
  AC_COLLECTD([quota],     [enable],  [module], [quota statistics (experimental)])
  AC_COLLECTD([hddtemp],   [disable], [module], [hdd temperature statistics])
+ AC_COLLECTD([irq],       [disable], [module], [irq statistics])
  AC_COLLECTD([load],      [disable], [module], [system load statistics])
  AC_COLLECTD([mbmon],     [disable], [module], [motherboard monitor statistics])
  AC_COLLECTD([memory],    [disable], [module], [memory statistics])
  AC_COLLECTD([multimeter],[disable], [module], [multimeter statistics])
  AC_COLLECTD([mysql],     [disable], [module], [mysql statistics])
  AC_COLLECTD([nfs],       [disable], [module], [nfs statistics])
 -AC_COLLECTD([ntpd],      [disable], [module], [nfs statistics])
 +AC_COLLECTD([ntpd],      [disable], [module], [ntpd statistics])
  AC_COLLECTD([ping],      [disable], [module], [ping statistics])
  AC_COLLECTD([processes], [disable], [module], [processes statistics])
  AC_COLLECTD([sensors],   [disable], [module], [lm_sensors statistics])
@@@ -1099,6 -1100,7 +1100,7 @@@ Configuration
      dns . . . . . . . . $enable_dns
      email . . . . . . . $enable_email
      hddtemp . . . . . . $enable_hddtemp
+     irq . . . . . . . . $enable_irq
      load  . . . . . . . $enable_load
      mbmon . . . . . . . $enable_mbmon
      memory  . . . . . . $enable_memory
diff --combined contrib/collection.cgi
@@@ -366,6 -366,16 +366,16 @@@ our $GraphDefs
                        'GPRINT:temp_max:MAX:%4.1lf Max,',
                        'GPRINT:temp_avg:LAST:%4.1lf Last\l'
                ],
+               irq => ['DEF:irq_avg={file}:irq:AVERAGE',
+                       'DEF:irq_min={file}:irq:MIN',
+                       'DEF:irq_max={file}:irq:MAX',
+                       "AREA:irq_max#$HalfBlue",
+                       "AREA:irq_min#$Canvas",
+                       "LINE1:irq_avg#$FullBlue:Interrupts",
+                       'GPRINT:irq_min:MIN:%5.1lf Min,',
+                       'GPRINT:irq_avg:AVERAGE:%5.1lf Avg,',
+                       'GPRINT:irq_max:MAX:%5.1lf Max,',
+                       'GPRINT:irq_avg:LAST:%5.1lf Last'],
                if_packets => ['DEF:tx_min={file}:tx:MIN',
                        'DEF:tx_avg={file}:tx:AVERAGE',
                        'DEF:tx_max={file}:tx:MAX',
@@@ -1185,6 -1195,7 +1195,7 @@@ our $GraphArgs 
        fanspeed => ['-t', '{host} fanspeed {inst}', '-v', 'RPM'],
        frequency_offset => ['-t', 'NTPd frequency offset ({inst})', '-v', 'Parts per million'],
        hddtemp => ['-t', '{host} hdd temperature {inst}', '-v', '°Celsius'],
+       irq => ['-t', '{host} Interrupts {inst}', '-v', 'Ints/s'],
        if_errors => ['-t', '{host} {inst} errors', '-v', 'Errors/s'],
        if_packets => ['-t', '{host} {inst} packets', '-v', 'Packets/s'],
        load => ['-t', '{host} load average', '-v', 'System load', '-X', '0'],
@@@ -1229,6 -1240,7 +1240,7 @@@ our $GraphMulti 
        disk    => 1,
        email   => \&output_graph_email_count,
        email_size => \&output_graph_email_size,
+       irq     => \&output_graph_irq,
        spam_score => 1,
        spam_check => \&output_graph_spam_check,
        load    => 0,
@@@ -1419,6 -1431,49 +1431,49 @@@ sub output_graph_pin
        return (@ret);
  }
  
+ sub output_graph_irq
+ {
+       my @inst = sort { $a <=> $b } @_;
+       my @ret = ();
+       die if (@inst < 2);
+       my @colors = get_n_colors (scalar (@inst));
+       for (my $i = 0; $i < scalar (@inst); $i++)
+       {
+               my $inst = $inst[$i];
+               push (@ret,
+                       "DEF:avg_$i=$AbsDir/irq-$inst.rrd:irq:AVERAGE",
+                       "DEF:min_$i=$AbsDir/irq-$inst.rrd:irq:MIN",
+                       "DEF:max_$i=$AbsDir/irq-$inst.rrd:irq:MAX");
+       }
+       for (my $i = 0; $i < scalar (@inst); $i++)
+       {
+               my $inst = $inst[$i];
+               my $color = $colors[$i];
+               if (length ($inst) > 15)
+               {
+                       $inst = substr ($inst, 0, 12) . '...';
+               }
+               else
+               {
+                       $inst = sprintf ('%-15s', $inst);
+               }
+               push (@ret,
+                       "LINE1:avg_$i#$color:$inst",
+                       "GPRINT:min_$i:MIN:%5.1lf Min,",
+                       "GPRINT:avg_$i:AVERAGE:%5.1lf Avg,",
+                       "GPRINT:max_$i:MAX:%5.1lf Max,",
+                       "GPRINT:avg_$i:LAST:%5.1lf Last\\l");
+       }
+       return (@ret);
+ }
  sub output_graph_email_count
  {
        my @inst = @_;
@@@ -1819,83 -1874,6 +1874,83 @@@ Cache-Control: no-cach
        </head>
  
        <body>
 +      <script type="text/javascript">
 +        var lastUpdateHour = (new Date ()).getTime () / 1000;
 +        var lastUpdateDay = lastUpdateHour;
 +        var lastUpdateWeek = lastUpdateHour;
 +        var lastUpdateMonth = lastUpdateHour;
 +        var lastUpdateYear = lastUpdateHour;
 +
 +        function exchangeImages (origImg, newImg)
 +        {
 +          var parent = origImg.parentNode;
 +
 +          if (!newImg.complete)
 +            setTimeout (function () { exchangeImages (origImg, newImg); }, 100);
 +          else
 +            parent.replaceChild (newImg, origImg);
 +        }
 +
 +        function updateImage (origImg)
 +        {
 +          var imgSrc = origImg.src;
 +          var newImg = new Image (origImg.width, origImg.height);
 +          var now = (new Date ()).getTime () / 1000;
 +
 +          imgSrc = imgSrc.replace (/\\?.*/, "");
 +          imgSrc = imgSrc + "?update=" + now;
 +
 +          newImg.className = origImg.className;
 +          newImg.src = imgSrc;
 +
 +          exchangeImages (origImg, newImg);
 +        } /* updateImage */
 +
 +        function updateImageClass (className)
 +        {
 +          var elems = document.getElementsByTagName ("img");
 +          for (var i = 0; i < elems.length; i++)
 +          {
 +            var img = elems[i];
 +            if (img.className != className)
 +            continue;
 +            updateImage (img);
 +          }
 +        } /* updateImageClass */
 +
 +        function doUpdate ()
 +        {
 +          var now = (new Date ()).getTime () / 1000;
 +          if ((now - lastUpdateHour) >= 10)
 +          {
 +            updateImageClass ("hour");
 +            lastUpdateHour = 0 + now;
 +          }
 +          if ((now - lastUpdateDay) >= 120)
 +          {
 +            updateImageClass ("day");
 +            lastUpdateDay = now;
 +          }
 +          if ((now - lastUpdateWeek) >= 600)
 +          {
 +            updateImageClass ("week");
 +            lastUpdateWeek = now;
 +          }
 +          if ((now - lastUpdateMonth) >= 3600)
 +          {
 +            updateImageClass ("month");
 +            lastUpdateMonth = now;
 +          }
 +          if ((now - lastUpdateYear) >= 7200)
 +          {
 +            updateImageClass ("year");
 +            lastUpdateYear = now;
 +          }
 +        } /* doUpdate */
 +
 +        /* It's important to save this variable */
 +        var updateInterval = window.setInterval ("doUpdate ()", 10000);
 +      </script>
  HEADER
  
        my $MySelf = defined ($ENV{'GATEWAY_INTERFACE'}) ? $ENV{'SCRIPT_NAME'} : $0;
                print qq(\t\t<div><a href="$MySelf$RelDir">Go up</a></div>\n);
  
                print "\t\t<ul>\n";
-               for (@{$files->{$Type}})
+               for (sort { $a <=> $b } @{$files->{$Type}})
                {
                        print qq(\t\t\t<li><a href="$MySelf$RelDir/$Type/$_">$_</a></li>\n);
                }
                </ul>
  
                <h3>Hourly</h3>
 -              <div><img src="$MySelf$RelDir/$Type/hour" /></div>
 +              <div><img src="$MySelf$RelDir/$Type/hour" class="hour" /></div>
                <h3>Daily</h3>
 -              <div><img src="$MySelf$RelDir/$Type/day" /></div>
 +              <div><img src="$MySelf$RelDir/$Type/day" class="day" /></div>
                <h3>Weekly</h3>
 -              <div><img src="$MySelf$RelDir/$Type/week" /></div>
 +              <div><img src="$MySelf$RelDir/$Type/week" class="week" /></div>
                <h3>Monthly</h3>
 -              <div><img src="$MySelf$RelDir/$Type/month" /></div>
 +              <div><img src="$MySelf$RelDir/$Type/month" class="month" /></div>
                <h3>Yearly</h3>
 -              <div><img src="$MySelf$RelDir/$Type/year" /></div>
 +              <div><img src="$MySelf$RelDir/$Type/year" class="year" /></div>
  HTML
        }
        elsif (length ($Type) != 0)
  
                print <<HTML;
                <h3>Hourly</h3>
 -              <div><img src="$MySelf$RelDir/$ext/hour" /></div>
 +              <div><img src="$MySelf$RelDir/$ext/hour" class="hour" /></div>
                <h3>Daily</h3>
 -              <div><img src="$MySelf$RelDir/$ext/day" /></div>
 +              <div><img src="$MySelf$RelDir/$ext/day" class="day" /></div>
                <h3>Weekly</h3>
 -              <div><img src="$MySelf$RelDir/$ext/week" /></div>
 +              <div><img src="$MySelf$RelDir/$ext/week" class="week" /></div>
                <h3>Monthly</h3>
 -              <div><img src="$MySelf$RelDir/$ext/month" /></div>
 +              <div><img src="$MySelf$RelDir/$ext/month" class="month" /></div>
                <h3>Yearly</h3>
 -              <div><img src="$MySelf$RelDir/$ext/year" /></div>
 +              <div><img src="$MySelf$RelDir/$ext/year" class="year" /></div>
  HTML
        }
        else
                        if (ref ($GraphMulti->{$type}) eq 'CODE')
                        {
                                print qq(\t\t<a href="$MySelf$RelDir/$type" />),
 -                              qq(<img src="$MySelf$RelDir/$type/day" /></a>\n);
 +                              qq(<img src="$MySelf$RelDir/$type/day" class="day" /></a>\n);
                                next;
                        }
  
                                if (length ($inst))
                                {
                                        print qq(\t\t<a href="$MySelf$RelDir/$type/$inst" />),
 -                                      qq(<img src="$MySelf$RelDir/$type/$inst/day" /></a>\n);
 +                                      qq(<img src="$MySelf$RelDir/$type/$inst/day" class="day" /></a>\n);
                                }
                                else
                                {
                                        print qq(\t\t<a href="$MySelf$RelDir/$type" />),
 -                                      qq(<img src="$MySelf$RelDir/$type/day" /></a>\n);
 +                                      qq(<img src="$MySelf$RelDir/$type/day" class="day" /></a>\n);
                                }
                        }
                }
index 08af149,0000000..9cc9f2b
mode 100644,000000..100644
--- /dev/null
@@@ -1,237 -1,0 +1,238 @@@
 +Summary:      Statistics collection daemon for filling RRD files.
 +Name:           collectd
 +Version:      3.11.2
 +Release:      0.fc0
 +Source:               http://collectd.org/files/%{name}-%{version}.tar.gz
 +License:      GPL
 +Group:                System Environment/Daemons
 +BuildRoot:    %{_tmppath}/%{name}-%{version}-root
 +BuildPrereq:  lm_sensors-devel, mysql-devel, rrdtool-devel
 +Requires:     rrdtool
 +Packager:     Florian octo Forster <octo@verplant.org>
 +Vendor:               Florian octo Forster <octo@verplant.org>
 +
 +%description
 +collectd is a small daemon written in C for performance.  It reads various
 +system  statistics  and updates  RRD files,  creating  them if neccessary.
 +Since the daemon doesn't need to startup every time it wants to update the
 +files it's very fast and easy on the system. Also, the statistics are very
 +fine grained since the files are updated every 10 seconds.
 +
 +%package apache
 +Summary:      apache-plugin for collectd.
 +Group:                System Environment/Daemons
 +Requires:     collectd = %{version}, libcurl3
 +%description apache
 +This plugin collectd data provided by Apache's `mod_status'.
 +
 +#%package email
 +#Summary:     email-plugin for collectd.
 +#Group:               System Environment/Daemons
 +#Requires:    collectd = %{version}, spamassassin
 +#%description email
 +#This plugin collectd data provided by spamassassin.
 +
 +%package mysql
 +Summary:      mysql-module for collectd.
 +Group:                System Environment/Daemons
 +Requires:     collectd = %{version}, mysql
 +%description mysql
 +MySQL  querying  plugin.  This plugins  provides data of  issued commands,
 +called handlers and database traffic.
 +
 +%package sensors
 +Summary:      libsensors-module for collectd.
 +Group:                System Environment/Daemons
 +Requires:     collectd = %{version}, lm_sensors
 +%description sensors
 +This  plugin  for  collectd  provides  querying  of sensors  supported  by
 +lm_sensors.
 +
 +%prep
 +rm -rf $RPM_BUILD_ROOT
 +%setup
 +
 +%build
 +./configure --prefix=%{_prefix} --sbindir=%{_sbindir} --mandir=%{_mandir} --libdir=%{_libdir} --sysconfdir=%{_sysconfdir}
 +make
 +
 +%install
 +make install DESTDIR=$RPM_BUILD_ROOT
 +mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
 +mkdir -p $RPM_BUILD_ROOT/var/www/cgi-bin
 +cp src/collectd.conf $RPM_BUILD_ROOT/etc/collectd.conf
 +cp contrib/fedora/init.d-collectd $RPM_BUILD_ROOT/etc/rc.d/init.d/collectd
 +cp contrib/collection.cgi $RPM_BUILD_ROOT/var/www/cgi-bin
 +mkdir -p $RPM_BUILD_ROOT/var/lib/collectd
 +rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}/*.a
 +rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}/*.la
 +
 +%clean
 +rm -rf $RPM_BUILD_ROOT
 +
 +%post
 +/sbin/chkconfig --add collectd
 +/sbin/chkconfig collectd on
 +
 +#%postun
 +#/sbin/chkconfig collectd off
 +#/sbin/chkconfig --del collectd
 +
 +%files
 +%defattr(-,root,root)
 +%doc AUTHORS COPYING ChangeLog INSTALL NEWS README
 +%config /etc/collectd.conf
 +%attr(0755,root,root) /etc/rc.d/init.d/collectd
 +%attr(0755,root,root) /var/www/cgi-bin/collection.cgi
 +%attr(0755,root,root) %{_sbindir}/collectd
 +%attr(0444,root,root) %{_mandir}/man1/*
 +%attr(0444,root,root) %{_mandir}/man5/*
 +%attr(0444,root,root) %{_libdir}/%{name}/apcups.so*
 +%attr(0444,root,root) %{_libdir}/%{name}/apple_sensors.so*
 +%attr(0444,root,root) %{_libdir}/%{name}/battery.so*
 +%attr(0444,root,root) %{_libdir}/%{name}/cpu.so*
 +%attr(0444,root,root) %{_libdir}/%{name}/cpufreq.so*
 +%attr(0444,root,root) %{_libdir}/%{name}/df.so*
 +%attr(0444,root,root) %{_libdir}/%{name}/disk.so*
 +%attr(0444,root,root) %{_libdir}/%{name}/dns.so
 +%attr(0444,root,root) %{_libdir}/%{name}/email.so
 +%attr(0444,root,root) %{_libdir}/%{name}/hddtemp.so*
++%attr(0444,root,root) %{_libdir}/%{name}/irq.so*
 +%attr(0444,root,root) %{_libdir}/%{name}/load.so*
 +%attr(0444,root,root) %{_libdir}/%{name}/mbmon.so
 +%attr(0444,root,root) %{_libdir}/%{name}/memory.so*
 +%attr(0444,root,root) %{_libdir}/%{name}/multimeter.so*
 +%attr(0444,root,root) %{_libdir}/%{name}/nfs.so*
 +%attr(0444,root,root) %{_libdir}/%{name}/ntpd.so*
 +%attr(0444,root,root) %{_libdir}/%{name}/ping.so*
 +%attr(0444,root,root) %{_libdir}/%{name}/processes.so*
 +%attr(0444,root,root) %{_libdir}/%{name}/serial.so*
 +%attr(0444,root,root) %{_libdir}/%{name}/swap.so*
 +%attr(0444,root,root) %{_libdir}/%{name}/tape.so*
 +%attr(0444,root,root) %{_libdir}/%{name}/traffic.so*
 +%attr(0444,root,root) %{_libdir}/%{name}/users.so*
 +%attr(0444,root,root) %{_libdir}/%{name}/vserver.so*
 +%attr(0444,root,root) %{_libdir}/%{name}/wireless.so*
 +
 +%dir /var/lib/collectd
 +
 +%files apache
 +%attr(0444,root,root) %{_libdir}/%{name}/apache.so*
 +
 +#%files email
 +#%attr(0444,root,root) %{_libdir}/%{name}/email.so
 +
 +%files mysql
 +%attr(0444,root,root) %{_libdir}/%{name}/mysql.so*
 +
 +%files sensors
 +%attr(0444,root,root) %{_libdir}/%{name}/sensors.so*
 +
 +%changelog
 +* Wed Jan 11 2007 Iain Lea <iain@bricbrac.de> 3.11.0-0
 +- fixed spec file to build correctly on fedora core
 +- added improved init.d script to work with chkconfig
 +- added %post and %postun to call chkconfig automatically
 +
 +* Sun Jul 09 2006 Florian octo Forster <octo@verplant.org> 3.10.0-1
 +- New upstream version
 +
 +* Tue Jun 25 2006 Florian octo Forster <octo@verplant.org> 3.9.4-1
 +- New upstream version
 +
 +* Tue Jun 01 2006 Florian octo Forster <octo@verplant.org> 3.9.3-1
 +- New upstream version
 +
 +* Tue May 09 2006 Florian octo Forster <octo@verplant.org> 3.9.2-1
 +- New upstream version
 +
 +* Tue May 09 2006 Florian octo Forster <octo@verplant.org> 3.8.5-1
 +- New upstream version
 +
 +* Fri Apr 21 2006 Florian octo Forster <octo@verplant.org> 3.9.1-1
 +- New upstream version
 +
 +* Fri Apr 14 2006 Florian octo Forster <octo@verplant.org> 3.9.0-1
 +- New upstream version
 +- Added the `apache' package.
 +
 +* Thu Mar 14 2006 Florian octo Forster <octo@verplant.org> 3.8.2-1
 +- New upstream version
 +
 +* Thu Mar 13 2006 Florian octo Forster <octo@verplant.org> 3.8.1-1
 +- New upstream version
 +
 +* Thu Mar 09 2006 Florian octo Forster <octo@verplant.org> 3.8.0-1
 +- New upstream version
 +
 +* Sat Feb 18 2006 Florian octo Forster <octo@verplant.org> 3.7.2-1
 +- Include `tape.so' so the build doesn't terminate because of missing files..
 +- New upstream version
 +
 +* Sat Feb 04 2006 Florian octo Forster <octo@verplant.org> 3.7.1-1
 +- New upstream version
 +
 +* Mon Jan 30 2006 Florian octo Forster <octo@verplant.org> 3.7.0-1
 +- New upstream version
 +- Removed the extra `hddtemp' package
 +
 +* Tue Jan 24 2006 Florian octo Forster <octo@verplant.org> 3.6.2-1
 +- New upstream version
 +
 +* Fri Jan 20 2006 Florian octo Forster <octo@verplant.org> 3.6.1-1
 +- New upstream version
 +
 +* Fri Jan 20 2006 Florian octo Forster <octo@verplant.org> 3.6.0-1
 +- New upstream version
 +- Added config file, `collectd.conf(5)', `df.so'
 +- Added package `collectd-mysql', dependency on `mysqlclient10 | mysql'
 +
 +* Wed Dec 07 2005 Florian octo Forster <octo@verplant.org> 3.5.0-1
 +- New upstream version
 +
 +* Sat Nov 26 2005 Florian octo Forster <octo@verplant.org> 3.4.0-1
 +- New upstream version
 +
 +* Sat Nov 05 2005 Florian octo Forster <octo@verplant.org> 3.3.0-1
 +- New upstream version
 +
 +* Tue Oct 26 2005 Florian octo Forster <octo@verplant.org> 3.2.0-1
 +- New upstream version
 +- Added statement to remove the `*.la' files. This fixes a problem when
 +  `Unpackaged files terminate build' is in effect.
 +- Added `processes.so*' to the main package
 +
 +* Fri Oct 14 2005 Florian octo Forster <octo@verplant.org> 3.1.0-1
 +- New upstream version
 +- Added package `collectd-hddtemp'
 +
 +* Fri Sep 30 2005 Florian octo Forster <octo@verplant.org> 3.0.0-1
 +- New upstream version
 +- Split the package into `collectd' and `collectd-sensors'
 +
 +* Fri Sep 16 2005 Florian octo Forster <octo@verplant.org> 2.1.0-1
 +- New upstream version
 +
 +* Mon Sep 10 2005 Florian octo Forster <octo@verplant.org> 2.0.0-1
 +- New upstream version
 +
 +* Mon Aug 29 2005 Florian octo Forster <octo@verplant.org> 1.8.0-1
 +- New upstream version
 +
 +* Sun Aug 25 2005 Florian octo Forster <octo@verplant.org> 1.7.0-1
 +- New upstream version
 +
 +* Sun Aug 21 2005 Florian octo Forster <octo@verplant.org> 1.6.0-1
 +- New upstream version
 +
 +* Sun Jul 17 2005 Florian octo Forster <octo@verplant.org> 1.5.1-1
 +- New upstream version
 +
 +* Sun Jul 17 2005 Florian octo Forster <octo@verplant.org> 1.5-1
 +- New upstream version
 +
 +* Mon Jul 11 2005 Florian octo Forster <octo@verplant.org> 1.4.2-1
 +- New upstream version
 +
 +* Sat Jul 09 2005 Florian octo Forster <octo@verplant.org> 1.4-1
 +- Built on RedHat 7.3