Merge branch 'sb/iptables'
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Wed, 14 Mar 2007 22:24:38 +0000 (23:24 +0100)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Wed, 14 Mar 2007 22:24:38 +0000 (23:24 +0100)
Conflicts:

configure.in
src/Makefile.am
src/collectd.conf.in

14 files changed:
AUTHORS
ChangeLog
collectd.spec [deleted file]
configure.in
contrib/collection.cgi
contrib/fedora/collectd.spec [new file with mode: 0644]
contrib/fedora/init.d-collectd [new file with mode: 0644]
contrib/init.d-rh7 [deleted file]
src/Makefile.am
src/apache.c
src/collectd.conf.in
src/collectd.conf.pod
src/collectd.pod
src/irq.c [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
index b123877..b10958b 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -4,7 +4,7 @@ This package was written by:
 apcups plugin by:
   Anthony Gialluca <tonyabg at charter.net>
 
-cpufreq and multimeter module by:
+cpufreq, multimeter and irq module by:
   Peter Holik <peter at holik.at>
 
 hddtemp module by:
index ef41358..66c1fc1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+       * apache plugin: Support for lighttpd's `BusyServers' (aka.
+       connections) field was added by Florent Monbillard.
+
 2007-02-11, Version 3.11.2
        * plugin: Catch NULL-pointer and try to fix them. Otherwise the
          NULL-pointer may have been passed to `printf' which causes a
diff --git a/collectd.spec b/collectd.spec
deleted file mode 100644 (file)
index 6116ffd..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-Summary:       Statistics collection daemon for filling RRD files.
-Name:           collectd
-Version:       3.11.2
-Release:       0
-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 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
-cp src/collectd.conf $RPM_BUILD_ROOT/etc/collectd.conf
-cp contrib/init.d-rh7 $RPM_BUILD_ROOT/etc/rc.d/init.d/collectd
-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
-
-%files
-%defattr(-,root,root)
-%doc AUTHORS COPYING ChangeLog INSTALL NEWS README
-%doc contrib
-%config /etc/collectd.conf
-%attr(0755,root,root) /etc/rc.d/init.d/collectd
-%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}/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 mysql
-%attr(0444,root,root) %{_libdir}/%{name}/mysql.so*
-
-%files sensors
-%attr(0444,root,root) %{_libdir}/%{name}/sensors.so*
-
-%changelog
-* 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
index 24b3579..7251383 100644 (file)
@@ -1088,13 +1088,14 @@ 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([iptables],  [disable], [module], [IPtables 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])
@@ -1142,6 +1143,8 @@ Configuration:
     dns . . . . . . . . $enable_dns
     email . . . . . . . $enable_email
     hddtemp . . . . . . $enable_hddtemp
+    irq . . . . . . . . $enable_irq
+    iptables  . . . . . $enable_iptables
     load  . . . . . . . $enable_load
     mbmon . . . . . . . $enable_mbmon
     memory  . . . . . . $enable_memory
index 5c8bd4d..31f1b91 100755 (executable)
@@ -366,6 +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 @@ 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 @@ 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 @@ sub output_graph_ping
        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,6 +1874,83 @@ Cache-Control: no-cache
        </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;
@@ -1828,7 +1960,7 @@ HEADER
                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);
                }
@@ -1836,15 +1968,15 @@ HEADER
                </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)
@@ -1862,15 +1994,15 @@ HTML
 
                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
@@ -1898,7 +2030,7 @@ HTML
                        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;
                        }
 
@@ -1909,12 +2041,12 @@ HTML
                                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);
                                }
                        }
                }
diff --git a/contrib/fedora/collectd.spec b/contrib/fedora/collectd.spec
new file mode 100644 (file)
index 0000000..9cc9f2b
--- /dev/null
@@ -0,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
diff --git a/contrib/fedora/init.d-collectd b/contrib/fedora/init.d-collectd
new file mode 100644 (file)
index 0000000..2bf877c
--- /dev/null
@@ -0,0 +1,66 @@
+#!/bin/bash
+#
+# collectd    Startup script for the Collectd statistics gathering daemon
+# chkconfig: - 86 15
+# description: Collectd is a statistics gathering daemon used to collect \
+#   system information ie. cpu, memory, disk, network
+# processname: collectd
+# config: /etc/collectd.conf
+# config: /etc/sysconfig/collectd
+# pidfile: /var/run/collectd.pid
+
+# Source function library.
+. /etc/init.d/functions
+
+RETVAL=0
+ARGS=""
+prog="collectd"
+CONFIG=/etc/collectd.conf
+
+if [ -r /etc/default/$prog ]; then
+       . /etc/default/$prog
+fi
+
+start () {
+       echo -n $"Starting $prog: "
+       if [ -r "$CONFIG" ]
+       then
+               daemon /usr/sbin/collectd -C "$CONFIG"
+               RETVAL=$?
+               echo
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
+       fi
+}
+stop () {
+       echo -n $"Stopping $prog: "
+       killproc $prog
+       RETVAL=$?
+       echo
+       [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
+}
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
+       ;;
+  status)
+       status $prog
+       ;;
+  restart|reload)
+       stop
+       start
+       ;;
+  condrestart)
+       [ -f /var/lock/subsys/$prog ] && restart || :
+       ;;
+  *)
+       echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
+       exit 1
+esac
+
+exit $?
+
+# vim:syntax=sh
diff --git a/contrib/init.d-rh7 b/contrib/init.d-rh7
deleted file mode 100755 (executable)
index c7fe270..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/bash
-
-# Source function library.
-. /etc/init.d/functions
-
-RETVAL=0
-ARGS=""
-prog="collectd"
-CONFIG=/etc/collectd.conf
-
-if [ -r /etc/default/$prog ]; then
-       . /etc/default/$prog
-fi
-
-start () {
-       echo -n $"Starting $prog: "
-       if [ -r "$CONFIG" ]
-       then
-               daemon /usr/sbin/collectd -C "$CONFIG"
-               RETVAL=$?
-               echo
-               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
-       fi
-}
-stop () {
-       echo -n $"Stopping $prog: "
-       killproc $prog
-       RETVAL=$?
-       echo
-       [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
-}
-# See how we were called.
-case "$1" in
-  start)
-       start
-       ;;
-  stop)
-       stop
-       ;;
-  status)
-       status $prog
-       ;;
-  restart|reload)
-       stop
-       sleep 1
-       start
-       ;;
-  condrestart)
-       [ -f /var/lock/subsys/$prog ] && restart || :
-       ;;
-  *)
-       echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
-       exit 1
-esac
-
-exit $?
-
-# vim:syntax=sh
index 88ce2c4..aee7479 100644 (file)
@@ -219,6 +219,14 @@ collectd_LDADD += "-dlopen" iptables.la
 collectd_DEPENDENCIES += iptables.la
 endif
 
+if BUILD_MODULE_IRQ
+pkglib_LTLIBRARIES += irq.la
+irq_la_SOURCES = irq.c
+irq_la_LDFLAGS = -module -avoid-version
+collectd_LDADD += "-dlopen" irq.la
+collectd_DEPENDENCIES += irq.la
+endif
+
 if BUILD_MODULE_LOAD
 pkglib_LTLIBRARIES += load.la
 load_la_SOURCES = load.c
index 530481b..7c48f08 100644 (file)
@@ -1,6 +1,7 @@
 /**
  * collectd - src/apache.c
  * Copyright (C) 2006  Florian octo Forster
+ * Copyright (C) 2007  Florent EppO Monbillard
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
@@ -18,6 +19,8 @@
  *
  * Authors:
  *   Florian octo Forster <octo at verplant.org>
+ *   Florent EppO Monbillard <eppo at darox.net>
+ *   - connections/lighttpd extension
  **/
 
 #include "collectd.h"
@@ -75,6 +78,15 @@ static char *scoreboard_ds_def[] =
 };
 static int scoreboard_ds_num = 1;
 
+/* for lighttpd; Limit to 65536 active connections */
+static char *connections_file = "apache/apache_connections.rrd";
+static char *connections_ds_def[] =
+{
+       "DS:connections:GAUGE:"COLLECTD_HEARTBEAT":0:65536", 
+       NULL
+};
+static int connections_ds_num = 1;
+
 static char *config_keys[] =
 {
        "URL",
@@ -197,6 +209,12 @@ static void scoreboard_write (char *host, char *inst, char *val)
        rrd_update_file (host, buf, val, scoreboard_ds_def, scoreboard_ds_num);
 }
 
+static void connections_write (char *host, char *inst, char *val)
+{
+       rrd_update_file (host, connections_file, val, connections_ds_def,
+                       connections_ds_num);
+}
+
 #if APACHE_HAVE_READ
 static void submit (char *type, char *inst, long long value)
 {
@@ -319,6 +337,8 @@ static void apache_read (void)
                {
                        if (strcmp (fields[0], "Scoreboard:") == 0)
                                submit_scoreboard (fields[1]);
+                       else if (strcmp (fields[0], "BusyServers:") == 0)
+                               submit ("apache_connections", NULL, atol (fields[1]));
                }
        }
 
@@ -334,6 +354,7 @@ void module_register (void)
        plugin_register ("apache_requests",   NULL, NULL, requests_write);
        plugin_register ("apache_bytes",      NULL, NULL, bytes_write);
        plugin_register ("apache_scoreboard", NULL, NULL, scoreboard_write);
+       plugin_register ("apache_connections", NULL, NULL, connections_write);
        cf_register (MODULE_NAME, config, config_keys, config_keys_num);
 }
 
index 7cfcc9d..b3f9963 100644 (file)
@@ -31,6 +31,7 @@
 @BUILD_MODULE_DNS_TRUE@LoadPlugin dns
 @BUILD_MODULE_HDDTEMP_TRUE@LoadPlugin hddtemp
 @BUILD_MODULE_IPTABLES_TRUE@LoadPlugin iptables
+@BUILD_MODULE_IRQ_TRUE@LoadPlugin irq
 @BUILD_MODULE_LOAD_TRUE@LoadPlugin load
 @BUILD_MODULE_MBMON_TRUE@LoadPlugin mbmon
 @BUILD_MODULE_MEMORY_TRUE@LoadPlugin memory
 #      Chain table chain
 #</Plugin>
 
+#<Plugin irq>
+#      Irq 7
+#      Irq 8
+#      Irq 9
+#      IgnoreSelected true
+#</Plugin>
+
 #<Plugin mbmon>
 #      Host 127.0.0.1
 #      Port 411
index cffb7ad..803df8b 100644 (file)
@@ -118,6 +118,10 @@ the following snipped to base your Apache config upon:
     </Location>
   </IfModule>
 
+Since it's C<mod_status> module is very similar to Apache's, B<lighttpd> is
+also supported. It introduces a new field, called C<BusyServers>, to count the
+number of currently connected clients. This field is also supported.
+
 The following options are accepted by the C<apache>-plugin:
 
 =over 4
@@ -240,6 +244,27 @@ TCP-Port to connect to. Defaults to B<7634>.
 
 =back
 
+=head2 Plugin C<irq>
+
+=over 4
+
+=item B<Irq> I<Irq>
+
+Select this irq. By default these irqs will then be collected. For a more
+detailed description see B<IgnoreSelected> below.
+
+=item B<IgnoreSelected> I<true>|I<false>
+
+If no configuration if given, the B<irq>-plugin will collect data from all
+irqs. This may not be practical, especially if no interrupts happen. Thus, you
+can use the B<Irq>-option to pick the interupt you're interested in.
+Sometimes, however, it's easier/prefered to collect all interupts I<except> a
+few ones. This option enables you to do that: By setting B<IgnoreSelected> to
+I<true> the effect of B<Irq> is inversed: All selected interupts are ignored
+and all other interupts are collected.
+
+=back
+
 =head2 Plugin C<mbmon>
 
 =over 4
index 8ee77ea..96c3fcd 100644 (file)
@@ -16,7 +16,7 @@ settings. The following features may be available:
 
 =item
 
-Apache server stats (I<apache>)
+Apache and lighttpd server statistics (I<apache>)
 
 =item
 
@@ -52,6 +52,10 @@ Harddisk temperatures (I<hddtemp>)
 
 =item
 
+Irq (I<irq>)
+
+=item
+
 System load averages (I<load>)
 
 =item
@@ -170,10 +174,10 @@ values.
 
 =head2 apache
 
-This module connects to an Apache webserver and expects the output produced by
-B<mod_status.c>. If requires B<libcurl> to set up the HTTP connection and issue
-the request(s). The following is a sample config for the Apache webserver. The
-use of C<ExtendedStatus on> is mandatory.
+This module connects to an Apache or lighttpd webserver and expects the output
+produced by B<mod_status.c>. If requires B<libcurl> to set up the HTTP
+connection and issue the request(s). The following is a sample config for the
+Apache webserver. Under Apache, the use of C<ExtendedStatus on> is mandatory.
 
   ExtendedStatus on
   <IfModule mod_status.c>
@@ -387,6 +391,10 @@ The DS'es depend on the module creating the RRD files:
 
   DS:value:GAUGE:HEARTBEAT:U:U
 
+=item Irq (F<irq-I<E<lt>irqnumberE<gt>>.rrd>)
+
+  DS:value:COUNTER:HEARTBEAT:0:65535
+
 =item System load (F<load.rrd>)
 
   DS:shortterm:GAUGE:HEARTBEAT:0:100
diff --git a/src/irq.c b/src/irq.c
new file mode 100644 (file)
index 0000000..69a3196
--- /dev/null
+++ b/src/irq.c
@@ -0,0 +1,238 @@
+/**
+ * collectd - src/irq.c
+ * Copyright (C) 2007  Peter Holik
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ *
+ * Authors:
+ *   Peter Holik <peter at holik.at>
+ **/
+
+#include "collectd.h"
+#include "common.h"
+#include "plugin.h"
+#include "configfile.h"
+
+#define MODULE_NAME "irq"
+
+#if KERNEL_LINUX
+# define IRQ_HAVE_READ 1
+#else
+# define IRQ_HAVE_READ 0
+#endif
+
+#define BUFSIZE 128
+
+/*
+ * (Module-)Global variables
+ */
+static char *irq_file   = "irq/irq-%s.rrd";
+
+static char *config_keys[] =
+{
+       "Irq",
+       "IgnoreSelected",
+       NULL
+};
+static int config_keys_num = 2;
+
+static char *ds_def[] =
+{
+       "DS:value:COUNTER:"COLLECTD_HEARTBEAT":0:65535",
+       NULL
+};
+static int ds_num = 1;
+
+static unsigned int *irq_list;
+static unsigned int irq_list_num;
+
+/* 
+ * irq_list_action:
+ * 0 => default is to collect selected irqs
+ * 1 => ignore selcted irqs
+ */
+static int irq_list_action;
+
+static int irq_config (char *key, char *value)
+{
+       if (strcasecmp (key, "Irq") == 0)
+       {
+               unsigned int *temp;
+               unsigned int irq;
+               char *endptr;
+
+               temp = (unsigned int *) realloc (irq_list, (irq_list_num + 1) * sizeof (unsigned int *));
+               if (temp == NULL)
+               {
+                       fprintf (stderr, "irq plugin: Cannot allocate more memory.\n");
+                       syslog (LOG_ERR, "irq plugin: Cannot allocate more memory.");
+                       return (1);
+               }
+               irq_list = temp;
+
+               /* Clear errno, because we need it to see if an error occured. */
+               errno = 0;
+
+               irq = strtol(value, &endptr, 10);
+               if ((endptr == value) || (errno != 0))
+               {
+                       fprintf (stderr, "irq plugin: Irq value is not a "
+                                       "number: `%s'\n", value);
+                       syslog (LOG_ERR, "irq plugin: Irq value is not a "
+                                       "number: `%s'", value);
+                       return (1);
+               }
+               irq_list[irq_list_num] = irq;
+               irq_list_num++;
+       }
+       else if (strcasecmp (key, "IgnoreSelected") == 0)
+       {
+               if ((strcasecmp (value, "True") == 0)
+                               || (strcasecmp (value, "Yes") == 0)
+                               || (strcasecmp (value, "On") == 0))
+                       irq_list_action = 1;
+               else
+                       irq_list_action = 0;
+       }
+       else
+       {
+               return (-1);
+       }
+       return (0);
+}
+
+/*
+ * Check if this interface/instance should be ignored. This is called from
+ * both, `submit' and `write' to give client and server the ability to
+ * ignore certain stuff..
+ */
+static int check_ignore_irq (const unsigned int irq)
+{
+       int i;
+
+       if (irq_list_num < 1)
+               return (0);
+
+       for (i = 0; i < irq_list_num; i++)
+               if (irq == irq_list[i])
+                       return (irq_list_action);
+
+       return (1 - irq_list_action);
+}
+
+static void irq_write (char *host, char *inst, char *value)
+{
+       char file[BUFSIZE];
+       int status;
+
+       if (check_ignore_irq (atoi(inst)))
+               return;
+
+       status = snprintf (file, BUFSIZE, irq_file, inst);
+       if (status < 1)
+               return;
+       else if (status >= BUFSIZE)
+               return;
+
+       rrd_update_file (host, file, value, ds_def, ds_num);
+}
+
+#if IRQ_HAVE_READ
+static void irq_submit (unsigned int irq, unsigned int value)
+{
+       char value_str[32];
+       char type_str[16];
+       int  status;
+
+       if (check_ignore_irq (irq))
+               return;
+
+       status = snprintf (value_str, 32, "%u:%u",
+                               (unsigned int) curtime, value);
+       if ((status >= 32) || (status < 1))
+               return;
+
+       status = snprintf (type_str, 16, "%u", irq);
+       if ((status >= 16) || (status < 1))
+               return;
+
+       plugin_submit (MODULE_NAME, type_str, value_str);
+} /* void irq_submit */
+
+static void irq_read (void)
+{
+#if KERNEL_LINUX
+
+#undef BUFSIZE
+#define BUFSIZE 256
+
+       FILE *fh;
+       char buffer[BUFSIZE];
+       unsigned int irq;
+       unsigned int irq_value;
+       long value;
+       char *endptr;
+       int i;
+
+       char *fields[64];
+       int fields_num;
+
+       if ((fh = fopen ("/proc/interrupts", "r")) == NULL)
+       {
+               syslog (LOG_WARNING, "irq plugin: fopen (/proc/interrupts): %s",
+                               strerror (errno));
+               return;
+       }
+       while (fgets (buffer, BUFSIZE, fh) != NULL)
+       {
+               fields_num = strsplit (buffer, fields, 64);
+               if (fields_num < 2)
+                       continue;
+
+               errno = 0;    /* To distinguish success/failure after call */
+               irq = strtol (fields[0], &endptr, 10);
+
+               if ((endptr == fields[0]) || (errno != 0) || (*endptr != ':'))
+                       continue;
+
+               irq_value = 0;
+               for (i = 1; i < fields_num; i++)
+               {
+                       errno = 0;
+                       value = strtol (fields[i], &endptr, 10);
+
+                       if ((*endptr != '\0') || (errno != 0))
+                               break;
+
+                       irq_value += value;
+               } /* for (i) */
+
+               irq_submit (irq, irq_value);
+       }
+       fclose (fh);
+#endif /* KERNEL_LINUX */
+} /* void irq_read */
+#else
+#define irq_read NULL
+#endif /* IRQ_HAVE_READ */
+
+void module_register (void)
+{
+       plugin_register (MODULE_NAME, NULL, irq_read, irq_write);
+       cf_register (MODULE_NAME, irq_config, config_keys, config_keys_num);
+}
+
+#undef BUFSIZE
+#undef MODULE_NAME