Changeset 1265

Show
Ignore:
Timestamp:
11/29/06 17:55:05 (5 years ago)
Author:
ilmari
Message:

r9313@vesla (orig r1046): janl | 2006-08-17 15:12:08 +0100
IPMI plugin added


r9668@vesla (orig r1047): janl | 2006-08-24 12:43:15 +0100
Applied field.colour patch #54 - not tested O:-)


r9669@vesla (orig r1048): janl | 2006-08-24 23:35:54 +0100
Formating fix, closing #228.


r9670@vesla (orig r1049): janl | 2006-08-24 23:47:59 +0100
Plugin population cleanup


r9671@vesla (orig r1050): janl | 2006-08-25 00:01:54 +0100
New plugin


r9672@vesla (orig r1051): janl | 2006-08-25 00:04:45 +0100
New plugins


r9673@vesla (orig r1052): janl | 2006-08-25 00:16:11 +0100
Applied patch to allow _aggregated graph


r9674@vesla (orig r1053): janl | 2006-08-25 00:27:17 +0100
Tomcat plugins from runesk


r9675@vesla (orig r1054): janl | 2006-08-25 00:31:44 +0100
Debian #314610, Munin #92


r9676@vesla (orig r1055): janl | 2006-08-25 00:45:31 +0100
Adding contributed plugins


r9677@vesla (orig r1056): janl | 2006-08-30 00:35:43 +0100
New and better qmailscan plugin


r9678@vesla (orig r1057): janl | 2006-08-30 00:36:09 +0100
New and better name for it (ticket #58 btw)


r9679@vesla (orig r1058): janl | 2006-08-30 00:48:49 +0100
Applied patches from ticket #42. Unfortunately this does not fix the ticket, only enhances the aix plugins


r9680@vesla (orig r1059): janl | 2006-08-30 01:11:11 +0100
Make warn/crit levels configurable by environment (ticket #44)


r9681@vesla (orig r1060): janl | 2006-08-30 01:44:30 +0100
SNMP based uptime grapher - ticket #141


r9682@vesla (orig r1061): janl | 2006-08-30 02:07:34 +0100
Saner values on 64 bit machines - ticket #119


r9683@vesla (orig r1062): janl | 2006-09-03 21:53:09 +0100
Random cosmetic changes while trying to understand process_node


r9684@vesla (orig r1063): janl | 2006-09-06 13:36:38 +0100
Change global headers limit to 16 or longer labels - 20 was too much even with rrd 1.0


r9685@vesla (orig r1064): janl | 2006-09-06 14:48:19 +0100
Incomplete usage text


r9686@vesla (orig r1065): janl | 2006-09-06 15:40:54 +0100
New plugins


r9687@vesla (orig r1066): janl | 2006-09-06 15:41:25 +0100
very slight rename


r9688@vesla (orig r1067): janl | 2006-09-06 15:59:35 +0100
Some comments to clearify


r9689@vesla (orig r1068): janl | 2006-09-06 16:08:46 +0100
Bah, redundant work


r9690@vesla (orig r1069): janl | 2006-09-06 16:21:21 +0100
The cpuload plugin seems pretty broken. Reinstating the winload


r9691@vesla (orig r1070): janl | 2006-09-06 17:07:34 +0100
And memory too


r9692@vesla (orig r1071): janl | 2006-09-06 17:12:42 +0100
Still better


r9693@vesla (orig r1072): janl | 2006-09-19 11:24:18 +0100
sort keys instead of keys, prettyer that way


r9694@vesla (orig r1073): janl | 2006-09-25 23:05:11 +0100
New version if if_ plugin that also handles mii-tool dependent interfaces
and handles absence of tools better.
Typo fix in memory plugin.


r9695@vesla (orig r1074): janl | 2006-09-28 20:54:15 +0100
Plugins from Lars Strand


r9696@vesla (orig r1075): janl | 2006-09-28 20:54:34 +0100
New AIX plugin


r11484@vesla (orig r1087): bjorn | 2006-10-06 15:20:47 +0100
Lowercased graph category, fixed ticket #118


r11486@vesla (orig r1089): bjorn | 2006-10-06 15:31:07 +0100
Changelog for fixing ticket #118


r11501@vesla (orig r1098): tore | 2006-10-12 11:20:12 +0100
Node: use Sys::Hostname::hostname()+gethostbyname() instead of
Net::Domain::hostfqdn() in order to determine the fully-qualified host
name of the host. The latter appears to be brain-damaged, see
<http://bugs.debian.org/275024> for background (Deb#307462, Trac#89).



r11507@vesla (orig r1104): janl | 2006-10-12 14:30:45 +0100
Foo!?


r11509@vesla (orig r1106): janl | 2006-10-12 14:56:37 +0100
One # too many too


r11511@vesla (orig r1108): tore | 2006-10-13 08:07:29 +0100
Make munin-node-configure-snmp die gracefully with a potentially useful
error message if Net::SNMP->session() fails. Patch helpfully provided by
Cyril Bouthors <cyb@debian.org>, thanks!


r11523@vesla (orig r1120): bjorn | 2006-10-13 14:20:14 +0100
Added "colour" to @legal in Munin.pm (ticket #54)


r11531@vesla (orig r1127): ilmari | 2006-10-14 17:36:09 +0100
Add digitemp and yum plugins
r11533@vesla (orig r1129): tore | 2006-10-14 21:24:20 +0100
Really fix #92. I wonder if Nicolai forgot to commit the fix.


r11542@vesla (orig r1138): bjorn | 2006-10-15 20:51:51 +0100
Applied changeset 1081 to trunk


r11549@vesla (orig r1145): janl | 2006-10-18 21:09:33 +0100
Merge 1076:1093 from 1.3.3rc - making 1.3.3rc was a silly newbie mistake.



------------------------------------------------------------------------
r1093 | janl | 2006-10-06 23:30:16 +0200 (Fri, 06 Oct 2006) | 2 lines


Node: Clear up some operator presidence causing problems in perl 5.8.7


------------------------------------------------------------------------
r1092 | janl | 2006-10-06 21:57:15 +0200 (Fri, 06 Oct 2006) | 2 lines


Merge of trunk


------------------------------------------------------------------------
r1091 | janl | 2006-10-06 21:54:38 +0200 (Fri, 06 Oct 2006) | 2 lines


revert stupid changes I made a long time ago


------------------------------------------------------------------------
r1086 | janl | 2006-10-05 17:11:19 +0200 (Thu, 05 Oct 2006) | 2 lines


Update copyright years and put copyright info into the new README file


------------------------------------------------------------------------
r1085 | janl | 2006-10-05 17:10:26 +0200 (Thu, 05 Oct 2006) | 2 lines


Install a .htaccess file by default and document it


------------------------------------------------------------------------
r1084 | janl | 2006-10-05 16:00:37 +0200 (Thu, 05 Oct 2006) | 2 lines


Not Linux specific. ... I suspect this plugin is redundant and snmpif_ can do

the same job

------------------------------------------------------------------------
r1083 | janl | 2006-10-03 23:54:47 +0200 (Tue, 03 Oct 2006) | 2 lines


Remove obsolete files


------------------------------------------------------------------------
r1082 | janl | 2006-10-03 23:16:52 +0200 (Tue, 03 Oct 2006) | 2 lines


Yet more documentation cleaning


------------------------------------------------------------------------
r1081 | janl | 2006-10-03 09:52:09 +0200 (Tue, 03 Oct 2006) | 2 lines


Bugfix to support notify_alias at service level


------------------------------------------------------------------------
r1080 | janl | 2006-10-03 00:52:52 +0200 (Tue, 03 Oct 2006) | 2 lines


Getting better all the time


------------------------------------------------------------------------
r1079 | janl | 2006-10-02 19:24:26 +0200 (Mon, 02 Oct 2006) | 3 lines


Put configuration-file snippets into resource directory and use install
@@ substitutions in them


------------------------------------------------------------------------
r1078 | janl | 2006-10-02 18:21:20 +0200 (Mon, 02 Oct 2006) | 2 lines


Better dependencies


------------------------------------------------------------------------
r1077 | janl | 2006-09-28 22:17:04 +0200 (Thu, 28 Sep 2006) | 2 lines


Correct release version


------------------------------------------------------------------------
r1076 | janl | 2006-09-28 22:03:37 +0200 (Thu, 28 Sep 2006) | 1 line


Preparing for 1.3.3
---------------------------------------------------------------------


r11551@vesla (orig r1147): janl | 2006-10-18 21:35:55 +0100

  • Fix rrd 1.2 font size problem causing line wrap (#104)
  • Fold in contributed hack to generate single service comparative pages


r11552@vesla (orig r1148): janl | 2006-10-18 21:56:00 +0100

  • munin-html: Split on /\s+/ instead of / / to ensure more robust handling of user input

r11554@vesla (orig r1150): janl | 2006-10-18 22:21:37 +0100

  • nutups_: new plugin for ups checking through "nut".

r11555@vesla (orig r1151): janl | 2006-10-18 22:26:41 +0100

  • Squid plugins: Add timeout to http connection call
  • Correct years of (C) in snmpwinmem

r11556@vesla (orig r1152): janl | 2006-10-18 22:30:36 +0100

  • Add uptime plugin for solaris (trac #419)

r11557@vesla (orig r1153): janl | 2006-10-18 22:38:55 +0100

  • Added init script for Solaris in resources directory

r11558@vesla (orig r1154): janl | 2006-10-18 22:53:58 +0100

  • irqstats plugin: Fix bug related to different /proc/interupts format on Sparc hardware (trac #436)

r11559@vesla (orig r1155): janl | 2006-10-18 23:26:27 +0100

  • Munin.pm: Fix uninitialized value problem in lock reading code.


r11560@vesla (orig r1156): janl | 2006-10-18 23:44:43 +0100

  • Contrib: (updated) hack to generate pages of each-service-on-every-host

r11561@vesla (orig r1157): janl | 2006-10-19 00:02:43 +0100

  • Add a possibly helpful readme file to dists/sunos

r11562@vesla (orig r1158): janl | 2006-10-19 08:43:59 +0100

  • Document what graph_strategy cgi does (trac #98)

r11563@vesla (orig r1159): janl | 2006-10-19 09:09:19 +0100

  • munin-node: Fix depreciated environment setting messages (trac #377)

r11564@vesla (orig r1160): janl | 2006-10-19 09:10:52 +0100
Fix previois changeset better


r11565@vesla (orig r1161): janl | 2006-10-19 09:20:25 +0100

  • New plugin: Multiping shows multiple ping results in one graph (trac #109)

r11566@vesla (orig r1162): janl | 2006-10-19 09:28:11 +0100

  • Contributed plugins for netbsd
  • New ntpdc based ntp plugins to show kernel params

r11567@vesla (orig r1163): janl | 2006-10-19 09:52:18 +0100

  • fw_forwarded_local: Removed arbitrary max settings (trac #149)

r11568@vesla (orig r1164): janl | 2006-10-19 20:45:50 +0100

  • Add maintainer version of Makefile.config - and stop it from being
    distributed as the actual Makefile.config by accident
  • Add favicon.ico file and install
  • Add other convinience features for the maintainer to Makefile


r11569@vesla (orig r1165): janl | 2006-10-19 22:14:53 +0100

  • YUM plugin did not autoconf correctly
  • install-node-plugins now installs all plugins in the distribution -
    no matter what
  • Inform about ruthless installation practices in INSTALL document

r11570@vesla (orig r1166): janl | 2006-10-19 23:45:41 +0100

  • ipmi plugin: Incorrect handeling of 'autoconf' method

r11571@vesla (orig r1167): janl | 2006-10-20 00:00:48 +0100

  • port_ plugin did not use @@PLUGSTATE@@ for plugin state

r11572@vesla (orig r1168): janl | 2006-10-20 00:08:31 +0100

  • Makefile: Create plugin state directory with correct ownership and permissions

r11573@vesla (orig r1169): janl | 2006-10-20 00:09:52 +0100
Work in progress: munin-node-configure was fragile when plugins said the wrong thing. Currently it's broken and will not install any plugins.
Irqstats was and is broken.


r11574@vesla (orig r1170): janl | 2006-10-20 20:59:21 +0100

  • munin-run: Make --debug messages consistent wrt STDERR/STDOUT and prefix with # to make them obvious to users and munin-node-configure

r11575@vesla (orig r1171): janl | 2006-10-20 23:16:16 +0100

  • Munin-node-configure: Make more robust, make it present plugin errors and exit with error if there are any. Write testcases and node-monkeywrench target in Makefile to test the error handling.


r11576@vesla (orig r1172): janl | 2006-10-24 11:48:52 +0100

  • lpstat: New plugin for print queue depths

r11577@vesla (orig r1173): janl | 2006-10-24 14:09:20 +0100

  • Multiple plugins: Correct autoconf/suggest action slightly

r11578@vesla (orig r1174): janl | 2006-10-24 16:18:28 +0100

  • Partial audit of correct magicmarkers in generic and linux plugins

r11579@vesla (orig r1175): janl | 2006-10-24 21:19:22 +0100
Undo some fuzzy thinking in the locking procedures of Munin.pm


r11580@vesla (orig r1176): janl | 2006-10-24 22:26:41 +0100

  • Memory plugin: Remove warning on overcommit

r11581@vesla (orig r1177): janl | 2006-10-25 11:14:27 +0100

  • Bring SunOS df plugin names into line with other platforms
  • Make SunOS df plugins auto/autoconf

r11582@vesla (orig r1178): janl | 2006-10-25 11:15:01 +0100
Brainfart in renaming


r11583@vesla (orig r1179): janl | 2006-10-25 15:42:39 +0100

  • Munin-update: Add code to interpret Scientific notation (3E-20) for RRD so plugins don't have to

r11584@vesla (orig r1180): janl | 2006-10-25 15:45:44 +0100

  • Munin-graph: Installed kluge for rrd 1.2 to make lines narrower to compensate for crayon-effect.

r11585@vesla (orig r1181): janl | 2006-10-25 15:47:14 +0100

  • Makefile: Install platform-specific plugins after generic plugins so that the former override the latter ones

r11586@vesla (orig r1182): janl | 2006-10-25 15:48:21 +0100

  • df* plugins on all architectures: Make fieldnames comply to charset restrictions

r11587@vesla (orig r1183): janl | 2006-10-25 21:40:31 +0100

  • Munin-run/node: Put most @@ config params from install time into plugin environment. This means that plugins can access @@PLUGSTATE@@ as $MUNIN_PLUGSTATE, and so on.

r11588@vesla (orig r1184): janl | 2006-10-25 21:45:48 +0100

  • plugin.sh: Utility functions for shell plugins
  • Munin::Plugin: Utility functions for perl plugins
  • Sample plugins: Convert to use plugin.sh and Munin::Plugin
  • Makefile: Install utility files

r11589@vesla (orig r1185): janl | 2006-10-25 23:20:11 +0100

  • Linux df* plugins: Configurable filesystem-type exclution. cds by defaut

r11590@vesla (orig r1186): janl | 2006-10-26 09:15:11 +0100

  • munin-node docs: Mention two most importand Net::Server config options.

r11591@vesla (orig r1187): janl | 2006-10-26 10:04:27 +0100

  • Put "host" thing in munin-node.conf template config

r11592@vesla (orig r1188): janl | 2006-10-26 10:20:40 +0100
Further featurefixing in these plugins


r11593@vesla (orig r1189): janl | 2006-10-26 14:36:24 +0100

  • exim_* plugins: Problems with "which exim" on Solaris corrected

r11594@vesla (orig r1190): janl | 2006-10-26 14:41:48 +0100

  • Define GOODSH and BASH in Makefile.config to be used by shell plugins

r11595@vesla (orig r1191): janl | 2006-10-26 14:42:35 +0100

  • SunOS df plugins: use @@GOODSH@@

r11596@vesla (orig r1192): janl | 2006-10-26 14:58:10 +0100
More @@ variables into the environment


r11597@vesla (orig r1193): janl | 2006-10-26 15:01:36 +0100
Undo unposix from earlier changeset


r11598@vesla (orig r1194): janl | 2006-10-26 15:11:18 +0100
Further fixes to make the GOODSH stuff work


r11599@vesla (orig r1195): janl | 2006-10-26 15:12:55 +0100

  • munin-node-simple: Fix @@ variable typos

r11600@vesla (orig r1196): tore | 2006-10-26 17:24:48 +0100
Fix typo "contigious"


r11602@vesla (orig r1198): janl | 2006-10-27 10:54:41 +0100
Correct brainfart w.r.t. MUNIN_ env variables. Include all and don't make silly mistakes.


r11603@vesla (orig r1199): janl | 2006-10-29 13:35:48 +0000

  • Further adjustments w.r.t. correct handling of vmalloc_used

r11604@vesla (orig r1200): janl | 2006-10-29 15:25:30 +0000

  • users plugin: change familiy to auto, make generic

r11605@vesla (orig r1201): janl | 2006-10-29 15:26:46 +0000

  • users plugin: Move to platform independent directory

r11606@vesla (orig r1202): janl | 2006-10-29 15:35:05 +0000
Lost a \n in translation


r11607@vesla (orig r1203): janl | 2006-10-29 16:16:39 +0000

  • munin-graph/Munin.pm: Support graph_printf

r11608@vesla (orig r1204): janl | 2006-10-29 16:17:24 +0000

  • users plugin: Further fixing. Make testbed for field.colour and graph_printf

r11609@vesla (orig r1205): janl | 2006-10-29 16:17:43 +0000

  • Makefile: Remove build before rebuilding it

r11610@vesla (orig r1206): janl | 2006-10-29 17:53:55 +0000
Allow ip based access-controll too


r11611@vesla (orig r1207): janl | 2006-10-29 17:54:30 +0000
Ditto for INSTALL file


r11612@vesla (orig r1208): janl | 2006-10-29 18:42:29 +0000
Insert lacking graph_info option


r11613@vesla (orig r1209): janl | 2006-10-29 18:43:31 +0000

  • munin-graph: Simplify colour processing

r11614@vesla (orig r1210): janl | 2006-10-29 18:45:53 +0000

  • INSTALL: Document what to do first when working with a svn checkout

r11677@vesla (orig r1211): janl | 2006-10-29 20:11:34 +0000

  • munin-graph: Support draw types AREASTACK and LINESTACK which is not sensitive to order like LINE/STACK and AREA/STACK

r11678@vesla (orig r1212): janl | 2006-10-29 20:11:58 +0000

  • users plugin: Make vehicle for *STACK draw types

r11787@vesla (orig r1213): janl | 2006-10-29 21:54:50 +0000
But the average format stays the same old


r11788@vesla (orig r1214): janl | 2006-10-29 22:04:56 +0000
Fix so *STACK draw-type don't need to be the first of all.


r11789@vesla (orig r1215): janl | 2006-10-29 23:35:06 +0000

  • munin-html: Log runtime - like with munin-graph etc.

r11790@vesla (orig r1216): janl | 2006-10-30 13:52:06 +0000

  • muin-html: Do not generate height/width attributes when in cgi mode

r11791@vesla (orig r1217): janl | 2006-10-30 14:56:53 +0000

  • munin-cgi-graph: Patch to limit number of concurrent rrdgraph processes

r11792@vesla (orig r1218): janl | 2006-10-30 18:21:55 +0000

  • ntp_kernel_* plugins: Not ntpdc's were created equal, autodetect better

r11793@vesla (orig r1219): janl | 2006-10-30 18:29:55 +0000
And make them "auto" and invent category "time" as well


r11794@vesla (orig r1220): janl | 2006-10-30 18:33:36 +0000

  • ntp_ and ntp_states plugins: Insert graph_category

r11795@vesla (orig r1221): janl | 2006-10-30 18:39:10 +0000

  • munin monitoring plugins: Make them auto-installing

r11796@vesla (orig r1222): janl | 2006-10-30 19:09:48 +0000

  • node.d/df and df_inode plugins: Rewrite like the last 20 years of shell enhancments happened

r11797@vesla (orig r1223): janl | 2006-10-30 19:15:19 +0000

  • Bring the goodness og @@GOODSH@@ to the generic plugins

r11798@vesla (orig r1224): janl | 2006-10-30 20:13:10 +0000

  • sunos memory: Make autoconf'able

r11799@vesla (orig r1225): janl | 2006-10-30 20:19:52 +0000

  • Solaris plugins: bring them @@GOODSH@@ and some elementary civilization

r11800@vesla (orig r1226): janl | 2006-10-30 20:25:43 +0000

  • linux/vlan: Better autoconf messages

r11801@vesla (orig r1227): janl | 2006-10-30 20:38:51 +0000

  • Linux plugins: print posix there too

r11807@vesla (orig r1233): janl | 2006-11-02 20:32:01 +0000
nut is unix, not linux


r11851@vesla (orig r1234): janl | 2006-11-09 15:26:52 +0000

  • Putting 1.3.3 into RELEASE

r11852@vesla (orig r1235): janl | 2006-11-09 15:38:19 +0000
Update plugins.history and adjust Checklist


r11853@vesla (orig r1236): janl | 2006-11-10 12:36:49 +0000
That should do it for 1.3.3


r11855@vesla (orig r1238): janl | 2006-11-10 12:38:39 +0000
And the trunk continues here


r11856@vesla (orig r1239): janl | 2006-11-13 10:49:30 +0000

  • New acpi thermal_zone plugin

r11857@vesla (orig r1240): janl | 2006-11-13 10:49:56 +0000
Actuall new in place now


r11858@vesla (orig r1241): janl | 2006-11-13 14:36:25 +0000

  • Bugfix linux/if_ plugin (--path=>-p, quoting, ethtool output tolerance)

r11860@vesla (orig r1243): janl | 2006-11-13 23:02:08 +0000

  • linux/cpuspeed: $(< ) isn't in POSIX it seems

Files:

Legend:

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

    r864 r1265  
    1                     GNU GENERAL PUBLIC LICENSE 
    2                        Version 2, June 1991 
     1Munin - a network-wide graphing framework 
    32 
    4  Copyright (C) 1989, 1991 Free Software Foundation, Inc. 
    5                        59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    6  Everyone is permitted to copy and distribute verbatim copies 
    7  of this license document, but changing it is not allowed. 
     3  Copyright (C) 2002-2006  Jimmy Olsen, et al. 
    84 
    9                             Preamble 
     5  This program is free software; you can redistribute it and/or modify 
     6  it under the terms of the GNU General Public License as published by 
     7  the Free Software Foundation; version 2 dated June, 1991. 
    108 
    11   The licenses for most software are designed to take away your 
    12 freedom to share and change it.  By contrast, the GNU General Public 
    13 License is intended to guarantee your freedom to share and change free 
    14 software--to make sure the software is free for all its users.  This 
    15 General Public License applies to most of the Free Software 
    16 Foundation's software and to any other program whose authors commit to 
    17 using it.  (Some other Free Software Foundation software is covered by 
    18 the GNU Library General Public License instead.)  You can apply it to 
    19 your programs, too. 
     9  This program is distributed in the hope that it will be useful, 
     10  but WITHOUT ANY WARRANTY; without even the implied warranty of 
     11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     12  GNU General Public License for more details. 
    2013 
    21   When we speak of free software, we are referring to freedom, not 
    22 price.  Our General Public Licenses are designed to make sure that you 
    23 have the freedom to distribute copies of free software (and charge for 
    24 this service if you wish), that you receive source code or can get it 
    25 if you want it, that you can change the software or use pieces of it 
    26 in new free programs; and that you know you can do these things. 
     14  You should have received a copy of the GNU General Public License 
     15  along with this program; if not, write to the Free Software 
     16  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    2717 
    28   To protect your rights, we need to make restrictions that forbid 
    29 anyone to deny you these rights or to ask you to surrender the rights. 
    30 These restrictions translate to certain responsibilities for you if you 
    31 distribute copies of the software, or if you modify it. 
     18Includes the font Bitstream Vera Mono, which is under the following license: 
    3219 
    33   For example, if you distribute copies of such a program, whether 
    34 gratis or for a fee, you must give the recipients all the rights that 
    35 you have.  You must make sure that they, too, receive or can get the 
    36 source code.  And you must show them these terms so they know their 
    37 rights. 
     20  Copyright (C) 2003 Bitstream, Inc. 
     21  All Rights Reserved. Bitstream Vera is a trademark of Bitstream, Inc. 
    3822 
    39   We protect your rights with two steps: (1) copyright the software, and 
    40 (2) offer you this license which gives you legal permission to copy, 
    41 distribute and/or modify the software. 
     23  Permission is hereby granted, free of charge, to any person obtaining a 
     24  copy of the fonts accompanying this license ("Fonts") and associated 
     25  documentation files (the "Font Software"), to reproduce and distribute 
     26  the Font Software, including without limitation the rights to use, copy, 
     27  merge, publish, distribute, and/or sell copies of the Font Software, and 
     28  to permit persons to whom the Font Software is furnished to do so, 
     29  subject to the following conditions: 
    4230 
    43   Also, for each author's protection and ours, we want to make certain 
    44 that everyone understands that there is no warranty for this free 
    45 software.  If the software is modified by someone else and passed on, we 
    46 want its recipients to know that what they have is not the original, so 
    47 that any problems introduced by others will not reflect on the original 
    48 authors' reputations. 
     31  The above copyright and trademark notices and this permission notice 
     32  shall be included in all copies of one or more of the Font Software 
     33  typefaces. 
    4934 
    50   Finally, any free program is threatened constantly by software 
    51 patents.  We wish to avoid the danger that redistributors of a fre
    52 program will individually obtain patent licenses, in effect making the 
    53 program proprietary.  To prevent this, we have made it clear that any 
    54 patent must be licensed for everyone's free use or not licensed at all
     35  The Font Software may be modified, altered, or added to, and in 
     36  particular the designs of glyphs or characters in the Fonts may b
     37  modified and additional glyphs or characters may be added to the Fonts, 
     38  only if the fonts are renamed to names not containing either the words 
     39  "Bitstream" or the word "Vera"
    5540 
    56   The precise terms and conditions for copying, distribution and 
    57 modification follow. 
    58   
    59                     GNU GENERAL PUBLIC LICENSE 
    60    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 
     41  This License becomes null and void to the extent applicable to Fonts or 
     42  Font Software that has been modified and is distributed under the 
     43  "Bitstream Vera" names. 
    6144 
    62   0. This License applies to any program or other work which contains 
    63 a notice placed by the copyright holder saying it may be distributed 
    64 under the terms of this General Public License.  The "Program", below, 
    65 refers to any such program or work, and a "work based on the Program" 
    66 means either the Program or any derivative work under copyright law: 
    67 that is to say, a work containing the Program or a portion of it, 
    68 either verbatim or with modifications and/or translated into another 
    69 language.  (Hereinafter, translation is included without limitation in 
    70 the term "modification".)  Each licensee is addressed as "you". 
     45  The Font Software may be sold as part of a larger software package but 
     46  no copy of one or more of the Font Software typefaces may be sold by 
     47  itself. 
    7148 
    72 Activities other than copying, distribution and modification are not 
    73 covered by this License; they are outside its scope.  The act of 
    74 running the Program is not restricted, and the output from the Program 
    75 is covered only if its contents constitute a work based on the 
    76 Program (independent of having been made by running the Program). 
    77 Whether that is true depends on what the Program does. 
     49  THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
     50  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 
     51  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 
     52  COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL 
     53  BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR 
     54  OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, 
     55  OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
     56  OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT 
     57  SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. 
    7858 
    79   1. You may copy and distribute verbatim copies of the Program's 
    80 source code as you receive it, in any medium, provided that you 
    81 conspicuously and appropriately publish on each copy an appropriate 
    82 copyright notice and disclaimer of warranty; keep intact all the 
    83 notices that refer to this License and to the absence of any warranty; 
    84 and give any other recipients of the Program a copy of this License 
    85 along with the Program. 
    86  
    87 You may charge a fee for the physical act of transferring a copy, and 
    88 you may at your option offer warranty protection in exchange for a fee. 
    89  
    90   2. You may modify your copy or copies of the Program or any portion 
    91 of it, thus forming a work based on the Program, and copy and 
    92 distribute such modifications or work under the terms of Section 1 
    93 above, provided that you also meet all of these conditions: 
    94  
    95     a) You must cause the modified files to carry prominent notices 
    96     stating that you changed the files and the date of any change. 
    97  
    98     b) You must cause any work that you distribute or publish, that in 
    99     whole or in part contains or is derived from the Program or any 
    100     part thereof, to be licensed as a whole at no charge to all third 
    101     parties under the terms of this License. 
    102  
    103     c) If the modified program normally reads commands interactively 
    104     when run, you must cause it, when started running for such 
    105     interactive use in the most ordinary way, to print or display an 
    106     announcement including an appropriate copyright notice and a 
    107     notice that there is no warranty (or else, saying that you provide 
    108     a warranty) and that users may redistribute the program under 
    109     these conditions, and telling the user how to view a copy of this 
    110     License.  (Exception: if the Program itself is interactive but 
    111     does not normally print such an announcement, your work based on 
    112     the Program is not required to print an announcement.) 
    113   
    114 These requirements apply to the modified work as a whole.  If 
    115 identifiable sections of that work are not derived from the Program, 
    116 and can be reasonably considered independent and separate works in 
    117 themselves, then this License, and its terms, do not apply to those 
    118 sections when you distribute them as separate works.  But when you 
    119 distribute the same sections as part of a whole which is a work based 
    120 on the Program, the distribution of the whole must be on the terms of 
    121 this License, whose permissions for other licensees extend to the 
    122 entire whole, and thus to each and every part regardless of who wrote it. 
    123  
    124 Thus, it is not the intent of this section to claim rights or contest 
    125 your rights to work written entirely by you; rather, the intent is to 
    126 exercise the right to control the distribution of derivative or 
    127 collective works based on the Program. 
    128  
    129 In addition, mere aggregation of another work not based on the Program 
    130 with the Program (or with a work based on the Program) on a volume of 
    131 a storage or distribution medium does not bring the other work under 
    132 the scope of this License. 
    133  
    134   3. You may copy and distribute the Program (or a work based on it, 
    135 under Section 2) in object code or executable form under the terms of 
    136 Sections 1 and 2 above provided that you also do one of the following: 
    137  
    138     a) Accompany it with the complete corresponding machine-readable 
    139     source code, which must be distributed under the terms of Sections 
    140     1 and 2 above on a medium customarily used for software interchange; or, 
    141  
    142     b) Accompany it with a written offer, valid for at least three 
    143     years, to give any third party, for a charge no more than your 
    144     cost of physically performing source distribution, a complete 
    145     machine-readable copy of the corresponding source code, to be 
    146     distributed under the terms of Sections 1 and 2 above on a medium 
    147     customarily used for software interchange; or, 
    148  
    149     c) Accompany it with the information you received as to the offer 
    150     to distribute corresponding source code.  (This alternative is 
    151     allowed only for noncommercial distribution and only if you 
    152     received the program in object code or executable form with such 
    153     an offer, in accord with Subsection b above.) 
    154  
    155 The source code for a work means the preferred form of the work for 
    156 making modifications to it.  For an executable work, complete source 
    157 code means all the source code for all modules it contains, plus any 
    158 associated interface definition files, plus the scripts used to 
    159 control compilation and installation of the executable.  However, as a 
    160 special exception, the source code distributed need not include 
    161 anything that is normally distributed (in either source or binary 
    162 form) with the major components (compiler, kernel, and so on) of the 
    163 operating system on which the executable runs, unless that component 
    164 itself accompanies the executable. 
    165  
    166 If distribution of executable or object code is made by offering 
    167 access to copy from a designated place, then offering equivalent 
    168 access to copy the source code from the same place counts as 
    169 distribution of the source code, even though third parties are not 
    170 compelled to copy the source along with the object code. 
    171   
    172   4. You may not copy, modify, sublicense, or distribute the Program 
    173 except as expressly provided under this License.  Any attempt 
    174 otherwise to copy, modify, sublicense or distribute the Program is 
    175 void, and will automatically terminate your rights under this License. 
    176 However, parties who have received copies, or rights, from you under 
    177 this License will not have their licenses terminated so long as such 
    178 parties remain in full compliance. 
    179  
    180   5. You are not required to accept this License, since you have not 
    181 signed it.  However, nothing else grants you permission to modify or 
    182 distribute the Program or its derivative works.  These actions are 
    183 prohibited by law if you do not accept this License.  Therefore, by 
    184 modifying or distributing the Program (or any work based on the 
    185 Program), you indicate your acceptance of this License to do so, and 
    186 all its terms and conditions for copying, distributing or modifying 
    187 the Program or works based on it. 
    188  
    189   6. Each time you redistribute the Program (or any work based on the 
    190 Program), the recipient automatically receives a license from the 
    191 original licensor to copy, distribute or modify the Program subject to 
    192 these terms and conditions.  You may not impose any further 
    193 restrictions on the recipients' exercise of the rights granted herein. 
    194 You are not responsible for enforcing compliance by third parties to 
    195 this License. 
    196  
    197   7. If, as a consequence of a court judgment or allegation of patent 
    198 infringement or for any other reason (not limited to patent issues), 
    199 conditions are imposed on you (whether by court order, agreement or 
    200 otherwise) that contradict the conditions of this License, they do not 
    201 excuse you from the conditions of this License.  If you cannot 
    202 distribute so as to satisfy simultaneously your obligations under this 
    203 License and any other pertinent obligations, then as a consequence you 
    204 may not distribute the Program at all.  For example, if a patent 
    205 license would not permit royalty-free redistribution of the Program by 
    206 all those who receive copies directly or indirectly through you, then 
    207 the only way you could satisfy both it and this License would be to 
    208 refrain entirely from distribution of the Program. 
    209  
    210 If any portion of this section is held invalid or unenforceable under 
    211 any particular circumstance, the balance of the section is intended to 
    212 apply and the section as a whole is intended to apply in other 
    213 circumstances. 
    214  
    215 It is not the purpose of this section to induce you to infringe any 
    216 patents or other property right claims or to contest validity of any 
    217 such claims; this section has the sole purpose of protecting the 
    218 integrity of the free software distribution system, which is 
    219 implemented by public license practices.  Many people have made 
    220 generous contributions to the wide range of software distributed 
    221 through that system in reliance on consistent application of that 
    222 system; it is up to the author/donor to decide if he or she is willing 
    223 to distribute software through any other system and a licensee cannot 
    224 impose that choice. 
    225  
    226 This section is intended to make thoroughly clear what is believed to 
    227 be a consequence of the rest of this License. 
    228   
    229   8. If the distribution and/or use of the Program is restricted in 
    230 certain countries either by patents or by copyrighted interfaces, the 
    231 original copyright holder who places the Program under this License 
    232 may add an explicit geographical distribution limitation excluding 
    233 those countries, so that distribution is permitted only in or among 
    234 countries not thus excluded.  In such case, this License incorporates 
    235 the limitation as if written in the body of this License. 
    236  
    237   9. The Free Software Foundation may publish revised and/or new versions 
    238 of the General Public License from time to time.  Such new versions will 
    239 be similar in spirit to the present version, but may differ in detail to 
    240 address new problems or concerns. 
    241  
    242 Each version is given a distinguishing version number.  If the Program 
    243 specifies a version number of this License which applies to it and "any 
    244 later version", you have the option of following the terms and conditions 
    245 either of that version or of any later version published by the Free 
    246 Software Foundation.  If the Program does not specify a version number of 
    247 this License, you may choose any version ever published by the Free Software 
    248 Foundation. 
    249  
    250   10. If you wish to incorporate parts of the Program into other free 
    251 programs whose distribution conditions are different, write to the author 
    252 to ask for permission.  For software which is copyrighted by the Free 
    253 Software Foundation, write to the Free Software Foundation; we sometimes 
    254 make exceptions for this.  Our decision will be guided by the two goals 
    255 of preserving the free status of all derivatives of our free software and 
    256 of promoting the sharing and reuse of software generally. 
    257  
    258                             NO WARRANTY 
    259  
    260   11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 
    261 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN 
    262 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 
    263 PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 
    264 OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
    265 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS 
    266 TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE 
    267 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 
    268 REPAIR OR CORRECTION. 
    269  
    270   12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 
    271 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 
    272 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 
    273 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 
    274 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 
    275 TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 
    276 YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 
    277 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 
    278 POSSIBILITY OF SUCH DAMAGES. 
    279  
    280                      END OF TERMS AND CONDITIONS 
    281   
    282             How to Apply These Terms to Your New Programs 
    283  
    284   If you develop a new program, and you want it to be of the greatest 
    285 possible use to the public, the best way to achieve this is to make it 
    286 free software which everyone can redistribute and change under these terms. 
    287  
    288   To do so, attach the following notices to the program.  It is safest 
    289 to attach them to the start of each source file to most effectively 
    290 convey the exclusion of warranty; and each file should have at least 
    291 the "copyright" line and a pointer to where the full notice is found. 
    292  
    293     <one line to give the program's name and a brief idea of what it does.> 
    294     Copyright (C) <year>  <name of author> 
    295  
    296     This program is free software; you can redistribute it and/or modify 
    297     it under the terms of the GNU General Public License as published by 
    298     the Free Software Foundation; version 2 dated June, 1991. 
    299  
    300     This program is distributed in the hope that it will be useful, 
    301     but WITHOUT ANY WARRANTY; without even the implied warranty of 
    302     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    303     GNU General Public License for more details. 
    304  
    305     You should have received a copy of the GNU General Public License 
    306     along with this program; if not, write to the Free Software 
    307     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    308  
    309  
    310 Also add information on how to contact you by electronic and paper mail. 
    311  
    312 If the program is interactive, make it output a short notice like this 
    313 when it starts in an interactive mode: 
    314  
    315     Gnomovision version 69, Copyright (C) year name of author 
    316     Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 
    317     This is free software, and you are welcome to redistribute it 
    318     under certain conditions; type `show c' for details. 
    319  
    320 The hypothetical commands `show w' and `show c' should show the appropriate 
    321 parts of the General Public License.  Of course, the commands you use may 
    322 be called something other than `show w' and `show c'; they could even be 
    323 mouse-clicks or menu items--whatever suits your program. 
    324  
    325 You should also get your employer (if you work as a programmer) or your 
    326 school, if any, to sign a "copyright disclaimer" for the program, if 
    327 necessary.  Here is a sample; alter the names: 
    328  
    329   Yoyodyne, Inc., hereby disclaims all copyright interest in the program 
    330   `Gnomovision' (which makes passes at compilers) written by James Hacker. 
    331  
    332   <signature of Ty Coon>, 1 April 1989 
    333   Ty Coon, President of Vice 
    334  
    335 This General Public License does not permit incorporating your program into 
    336 proprietary programs.  If your program is a subroutine library, you may 
    337 consider it more useful to permit linking proprietary applications with the 
    338 library.  If this is what you want to do, use the GNU Library General 
    339 Public License instead of this License. 
     59  Except as contained in this notice, the names of Gnome, the Gnome 
     60  Foundation, and Bitstream Inc., shall not be used in advertising or 
     61  otherwise to promote the sale, use or other dealings in this Font 
     62  Software without prior written authorization from the Gnome Foundation 
     63  or Bitstream Inc., respectively. For further information, contact: 
     64  <fonts@gnome.org>. 
  • people/ilmari/modularisation-branch/ChangeLog

    r1262 r1265  
     1-*- text -*- 
    12munin (repository) 
    23 
     
    67  * Move Perl modules to {node,server}/lib/. 
    78  * Server: Display the time period in the title of the comparison pages. 
    8   * Node: Make it possible to run plugins with group root. 
    9   * Merge changes from 1.2.3->1.2.4. Some of the following entries may not 
    10   apply. 
     9 
     10munin (1.3.3, r910-r1236) 
     11 
     12  It's very likely that the entries for 1.3.3 contain some duplicates. 
     13  In part because it's been going on for more than a year, in part 
     14  because a large part has been constructed from the svn commit log. 
     15 
     16  * Linux plugins: Use @@GOODSH@@ (posix-shell) there too 
     17  * linux/vlan: Better autoconf messages 
     18  * Solaris plugins: bring them @@GOODSH@@ and some elementary civilization 
     19  * sunos memory: Make autoconf'able 
     20  * Bring the goodness og @@GOODSH@@ to the generic plugins 
     21  * node.d/df and df_inode plugins: Rewrite like the last 20 years of shell 
     22        enhancments happened 
     23  * munin monitoring plugins: Make them auto-installing 
     24  * ntp_ and ntp_states plugins: Insert graph_category, make them "auto" 
     25         and invent category "time" as well 
     26  * ntp_kernel_* plugins: Not ntpdc's were created equal, autodetect better 
     27  * munin-cgi-graph: Patch to limit number of concurrent rrdgraph processes 
     28  * munin-html: Do not generate height/width attributes when in cgi mode 
     29  * munin-html: Log runtime - like with munin-graph etc. 
     30  * users plugin: Make vehicle for *STACK draw types 
     31  * munin-graph: Support draw types AREASTACK and LINESTACK which is not 
     32        sensitive to order like LINE/STACK and AREA/STACK 
     33  * INSTALL: Document what to do first when working with a svn checkout 
     34  * munin-graph: Simplify colour processing 
     35  * Makefile: Remove build before rebuilding it 
     36  * users plugin: Further fixing. Make testbed for field.colour and 
     37        graph_printf 
     38  * munin-graph/Munin.pm: Support graph_printf 
     39  * users plugin: Move to platform independent directory 
     40  * users plugin: change familiy to auto, make generic 
     41  * linux/memory: Further adjustments w.r.t. correct handling of vmalloc_used 
     42  * Fix typo "contigious" 
     43  * munin-node-simple: Fix @@ variable typos 
     44  * SunOS df plugins: use @@GOODSH@@ 
     45  * Define GOODSH and BASH in Makefile.config to be used by shell plugins 
     46  * exim_* plugins: Problems with "which exim" on Solaris corrected 
     47  * Put "host" thing in munin-node.conf template config 
     48  * munin-node docs: Mention two most importand Net::Server config options. 
     49  * Linux df* plugins: Configurable filesystem-type exclution. cds by defaut 
     50  * plugin.sh: Utility functions for shell plugins 
     51  * Munin::Plugin: Utility functions for perl plugins 
     52  * Sample plugins: Convert to use plugin.sh and Munin::Plugin 
     53  * Makefile: Install utility files 
     54  * Munin-run/node: Put most @@ config params from install time into 
     55        plugin environment.  This means that plugins can access 
     56        @@PLUGSTATE@@ as $MUNIN_PLUGSTATE, and so on. 
     57  * df* plugins on all architectures: Make fieldnames comply to charset 
     58        restrictions 
     59  * Makefile: Install platform-specific plugins after generic plugins so 
     60        that the former override the latter ones 
     61  * Munin-graph: Installed kluge for rrd 1.2 to make lines narrower to 
     62        compensate for crayon-effect. 
     63  * Munin-update: Add code to interpret Scientific notation (3E-20) for 
     64        RRD so plugins don't have to 
     65  * Bring SunOS df plugin names into line with other platforms 
     66  * Make SunOS df plugins auto/autoconf 
     67  * Linux/memory plugin: Remove warning on overcommit 
     68  * Partial audit of correct magicmarkers in generic and linux plugins 
     69  * Multiple plugins: Correct autoconf/suggest action slightly 
     70  * lpstat: New plugin for print queue depths 
     71  * Munin-node-configure: Make more robust, make it present plugin 
     72        errors and exit with error if there are any. Write testcases and 
     73        node-monkeywrench target in Makefile to test the error handling. 
     74  * munin-run: Make --debug messages consistent wrt STDERR/STDOUT and 
     75        prefix with # to make them obvious to users and munin-node-configure 
     76  * Makefile: Create plugin state directory with correct ownership and 
     77        permissions 
     78  * port_ plugin did not use @@PLUGSTATE@@ for plugin state 
     79  * ipmi plugin: Incorrect handeling of 'autoconf' method 
     80  * YUM plugin did not autoconf correctly 
     81  * install-node-plugins now installs all plugins in the distribution - 
     82        no matter if they existed already - how else do we get bugfixed 
     83        plugins installed? 
     84  * Inform about ruthless installation practices in INSTALL document 
     85  * Add maintainer version of Makefile.config - and stop it from being 
     86           distributed as the actual Makefile.config by accident 
     87  * Add favicon.ico file and install 
     88  * Add other convinience features for the maintainer to Makefile 
     89  * linux/fw_forwarded_local: Removed arbitrary max settings (trac #149) 
     90  * Contributed plugins for netbsd 
     91  * New ntpdc based ntp plugins to show kernel params 
     92  * New plugin: Multiping shows multiple ping results in one graph (trac #109) 
     93  * munin-node: Fix depreciated environment setting messages (trac #377) 
     94  * Document what graph_strategy cgi does (wiki docs, trac #98) 
     95  * Add a possibly helpful readme file to dists/sunos 
     96  * Contrib: (updated) hack to generate pages of each-service-on-every-host 
     97  * Munin.pm: Fix uninitialized value problem in lock reading code. 
     98  * linux/irqstats plugin: Fix bug related to different /proc/interupts 
     99        format on Sparc hardware (trac #436) 
     100  * Added init script for Solaris in resources directory 
     101  * Add uptime plugin for solaris (trac #419) 
     102  * Squid plugins: Add timeout to http connection call 
     103  * Correct years of (C) in snmp__winmem 
     104  * nutups_: new plugin for ups checking through "nut". 
     105  * munin-html: Split on /\s+/ instead of / / to ensure more robust handling 
     106        of user input 
     107  * Fix rrd 1.2 font size problem causing line wrap (#104) 
     108  * Fold in contributed hack to generate single service comparative pages 
     109  * Node: Clear up some operator presidence causing problems in perl 5.8.7 
     110  * Update copyright years and put copyright info into the new README file 
     111  * Install a .htaccess file by default and document it 
     112  * Move surfboard plugin, not Linux specific.  I suspect this plugin is 
     113         redundant and snmp__if_ can do the same job 
     114  * Bugfix to support notify_alias at service level 
     115  * Put configuration-file snippets into resource directory and use install 
     116        @@ substitutions in them 
     117  * Makefile: Better dependencies 
     118  * Add digitemp and yum plugins 
     119  * Make munin-node-configure-snmp die gracefully with a potentially useful 
     120    error message if Net::SNMP->session() fails.  Patch helpfully provided by 
     121    Cyril Bouthors <cyb@debian.org>, thanks! 
     122  * New AIX load plugin 
     123  * Plugins from Lars Strand: linux/threads linux/proc_pri 
     124  * New version of linux/if_ plugin that also handles mii-tool dependent 
     125        interfaces and handles absence of tools better. 
     126  * linux/memory: warn -> warning 
     127  * postfix/mailstats: sort keys instead of keys, prettyer that way 
     128  * Windows SNMP plugins: Memory and cpuload plugins seems pretty broken 
     129        reinstate other versions. 
     130  * New SNMP lugins: snmp__rdp_users and snmp__winload 
     131  * Change global headers limit to 16 or longer labels - 20 was too much 
     132        even with rrd 1.0 
     133  * linux/memory: Saner values on 64 bit machines - ticket #119 
     134  * SNMP based uptime grapher - ticket #141 
     135  * Linux/load: Make warn/crit levels configurable by environment (ticket #44) 
     136  * Aix plugins: Better graph_categories 
     137  * New plugin: qmailscan by David Obando, lists viruses found by name 
     138  * New plugins: freebsd/uptime, linux/quota_usage, snmp: cmc_tc_sensor 
     139        r1054 | janl | 2006-08-25 01:31:44 +0200 (fre, 25 aug 2006) | 2 lines 
     140  * Linux/apt: Better counting: Debian #314610, Munin #92 
     141  * New plugins for Tomcat from runesk 
     142  * Applied patch to allow _aggregated graph 
     143  * spamstats plugin: Check if logfile exists before reading 
     144  * Delete obsolete plugins: i2c* 
     145  * ACPI plugin is linux specific 
     146  * linux/cpu: Various fixes relating to 1000Hz machines, closing #228. 
     147  * Applied field.colour patch by munin@iambitter.org, ticket #54 
     148  * New plugin: IPMI plugin added 
     149  * apc_envunit_ plugin: Remove hard coded defaults that overrode 
     150        configuration. 
     151  * freebsd/vmstat: Avoid calling sysctl through $PATH. That variable is 
     152        changed on process restart. 
     153  * Get rid of undefined variable warnings in mailscanner - patch by 
     154        dz@426.ch (trac #227) 
     155  * cups plugin: No @ in field names (#66, #70) 
     156  * sendmail_mailqueue plugins: Follow symlinks (#102) 
     157  * hddtemp_smartctl: different attribute ID for temperature (#81) 
     158  * ps_ plugin: Counted grep as well as the process 
     159  * New plugin: cpuspeed for linux. 
     160  * Linux/multips: wrong category of multips (#103) 
     161  * Munin-node/run: Set LC_ALL to C to avoid locale changes to program output 
     162  * Linux/cpu plugin: Scale to >10 CPUs (trac #37) 
     163  * Linux/df: Rewritten df plugins in perl. The old plugins were extremely 
     164    slow on busy system due to massive forking 
     165  * sendmail_mqueue: (#65) wrong seek call 
     166  * munin-update: (#39) incorrect error handling when opening STATS handle 
     167  * New plugin: Linux/nfs4_client: should be folded with nfs_client when we 
     168    get multigraph 
     169  * node/munin-run: Inserted missing \n 
     170  * linux/nfs_client: Fixed input processing inefficiency 
     171  * linux/nfsd: Ditto 
     172  * linux/fw_forwarded_local: Ditto 
     173  * ps_ plugin: pgrep? /usr/bin/pgrep! 
     174  * sendmail_mailqueue plugin: Replaced a $mspqueue too many 
     175  * Synced most rpm specfile changes from Fedora package into unstable tree 
     176  * A RedHat specific sendmail plugin config file 
     177  * Add testing framework and some tests for munin-run. 
     178  * Updated to final 1.2.4 version [merged change r98r984 from 
     179    /branches/1.2-stable 
     180  * Change copyright notice in programs to mention the GNU *General* 
     181    Public License, Expand on "no warranty". Mention COPYING and 
     182    http://www.fsf.org/licensing/licenses/gpl.txt. 
     183    Extend copyright to 2005. 
     184  * Fix generic/mysql_isam_space_ to pass user-specified mysqlshow 
     185    options first. 
     186  * Fix generic/ntp_ to report seconds instead of milliseconds. 
     187  * Fix handling of 'update no' on services in munin-update. 
     188  * Log warning about nodes without addresses in munin-update. 
     189  * SNMP plugins no longer report host_name when checking localhost. 
     190  * Remade the horizontal logo 
     191  * Added two svg versions of the logo: original and horizontal 
     192  * Merged debian packaging changes from 1.2 
     193    [changes r615:920 from /branches/1.2-stable/dists/debian and 
     194    r855:891 from /branches/debian/sarge/dists/debian] 
     195  * Added support for summing values from log lines. 
     196  * Correct munin-limits pod. 
     197  * Tuned logging. 
     198  * Added support for huge rrd files. 
     199  * Changed paths in Makefile wrt move from cvs to svn. 
     200  * Make it possible to run plugins with group root. 
    11201  * Plugins: "exists $ARGV[0]" does not work with perl < 5.6.0. use 
    12202    "defined $ARGV[0]". 
     
    14204  * Dists: Merged changes from Debian Etch package. See 
    15205    dists/debian/changelog. 
    16   * Main: Correct munin-limits pod documentation. 
    17206  * Server: filter a trivial error message from RRDtool (Deb#326061) 
    18207  * Server: A patch from trunk that makes munin-limits eat stdout/err from the 
    19208    contact.foo.command option in munin.conf. (Deb#301196) 
    20   * Server: make munin-graph deal with RRDtool 1.0.x and 1.2.x. 
    21209  * Server: Fix thinko in category_order in munin-html.in. 
    22   * Server: Fix handling of 'update no' on services.  
    23   * Server: Log warning about nodes without addresses. 
    24210  * Node: Prevent list command from polluting the node list. 
    25   * Plugins: Fix tempfile creation by using the best method available on a given 
    26     platform. (amavis, courier_, perdition) 
     211  * Plugins: Fix tempfile creation by using the best method available on a 
     212       given platform. (amavis, courier_, perdition) 
    27213  * Plugins: Fix to support the Linux cciss driver in the iostat plugin. 
    28214  * Plugins: squid_requests: Put the CDEF back that computes misses. 
    29215  * Plugins: postfix_mailvolume: Fix bad exit code test for `which postconf`. 
    30216  * Plugins: hddtemp_smartctl: Fix bugs on Solaris.  Revert back to using -A 
    31   (attributes) rather than -a (all).  That can be specified through the 
    32   args_$dev mechanism.  THIS CAN BREAK EXISTING SETUPS! 
     217    (attributes) rather than -a (all).  That can be specified through the 
     218    args_$dev mechanism.  THIS CAN BREAK EXISTING SETUPS! 
    33219  * Plugins: samba: Make location of smbstatus program configurable. 
    34   Streamline computation of foo.value. Correct typos and a thinko. Add 
    35   configurable "ignoreipcshare". Make awk program a lot more complicated to 
    36   deal with variations of smbstatus output. Quote error message with 
    37   parentheseis. 
     220    Streamline computation of foo.value. Correct typos and a thinko. Add 
     221    configurable "ignoreipcshare". Make awk program a lot more complicated to 
     222    deal with variations of smbstatus output. Quote error message with 
     223    parentheseis. 
    38224  * Plugins: smart_: Allow to query several drives on the same 3ware card. 
    39   Correct a bug when '-i' was not listed in smartargs.  Don't fail if 
    40   no value was obtained for hard drive model. Minor enhancements and 
    41   minor bug fixes from Nicolas STRANSKY <Nico@neo-lan.net>. smartctl exit 
    42   code is a value composed of bits. Allow more than one to be turned on 
    43   simultaneously by using the exit code itself rather than the log2 of it. 
     225    Correct a bug when '-i' was not listed in smartargs.  Don't fail if 
     226    no value was obtained for hard drive model. Minor enhancements and 
     227    minor bug fixes from Nicolas STRANSKY <Nico@neo-lan.net>. smartctl exit 
     228    code is a value composed of bits. Allow more than one to be turned on 
     229    simultaneously by using the exit code itself rather than the log2 of it. 
    44230  * Plugins: perdition: Add missing backquote on mktempfile line. Support 
    45   IMAPS and POP3S protocols. 
     231    IMAPS and POP3S protocols. 
    46232  * Plugins (FreeBSD): if_, if_errcoll_: Shift field numbers in awk for 
    47   interfaces that have no MAC address. 
     233    interfaces that have no MAC address. 
    48234  * Plugins (Solaris): fs_df, fs_inodes: Allow '-' in mountpoints. 
    49235  * Plugins (Solaris): processes: Replaced numerous calls to various programs 
    50   with a single awk program. 
     236    with a single awk program. 
    51237  * Plugins (Solaris): netstat: "exists $ARGV[0]" does not work with perl < 
    52   5.6.0. use "defined $ARGV[0]". 
     238    5.6.0. use "defined $ARGV[0]". 
    53239  * Plugins (Solaris): memory: Rewrite the value computation as a single nawk 
    54   program. Support scale factor "K" (gives values < 1). 
     240    program. Support scale factor "K" (gives values < 1). 
    55241  * Plugins (Linux): port_: Correct offset error in TCP6 code. 
    56242  * Plugins (Linux): if_: Simplify awk program greatly, suggested by 
    57243    Nicolai Langfeldt <janl@linpro.no> 
     244  * Plugins: Added plugin generic/digitemp_. 
     245  * Plugins: Added plugin linux/yum. 
     246  * Node: use Sys::Hostname::hostname()+gethostbyname() instead of 
     247    Net::Domain::hostfqdn() in order to determine the fully-qualified host 
     248    name of the host.  The latter appears to be brain-damaged, see 
     249    <http://bugs.debian.org/275024> for background (Deb#307462, Trac#89). 
    58250 
    59251munin (1.3.2) 
  • people/ilmari/modularisation-branch/INSTALL

    r864 r1265  
    1 Munin consists of the main programs, and a node. The node runs on each of 
    2 the machines you want to collect data from. The main programs does the 
    3 collecting, draws the graphs, and creates the HTML pages.  
     1IF you're working on a SVN checkout: 
    42 
    5 To install the main programs: 
     3        - cp Makefile.config-dist Makefile.conf 
     4 
     5          This overwrites the maintainers copy of Makefile.conf. 
     6 
     7 
     8 
     9Munin consists of the main (central server) programs, and the node 
     10program and the associated plugins.  The node runs on each of the 
     11machines you want to collect data from.  The main programs does the 
     12collecting, draws the graphs, and creates the HTML pages. 
     13 
     14To install the main programs (you might want to install a node first, 
     15that way there is data to collect): 
    616 
    717        - edit Makefile.config 
    818        - create the user "munin" 
    919        - make install-main 
    10         - create a cron-entry to run "munin-cron" as the user "munin" every 5 
    11           minutes 
    12         - if you want to use the dynamic graphs, configure the cgi directory 
    13           (an example for apache can be found in README-apache-cgi). 
     20 
     21        - In your HTMLDIR/munin you will now find a .htaccess file 
     22          looking for passwords in CONFDIR/munin-htpasswd.  Install 
     23          the users you need in munin-htpasswd with the htpasswd 
     24          command.  Check that authentication is required, if it's not  
     25          please refer to build/resources/apache-passwd.conf. 
     26 
     27          The .htaccess file may not be accessed unless you have the 
     28          right AllowOverride in the central Apache configuration. 
     29          This may fix that (see also 
     30          build/resources/apache-passwd.conf): 
     31 
     32                <Location /munin> 
     33                        AllowOverride AuthConfig Limit 
     34                </Location> 
     35 
     36          If you already have a .htaccess file in HTMLDIR it will not 
     37          be overwritten. 
     38 
     39          If you prefer that munin be openly available make the 
     40          .htaccess file empty ( : >.htaccess ) - that way it will 
     41          not be overwritten later. 
     42 
     43        - create a cron-entry to run "munin-cron" as the user "munin" 
     44          every 5 minutes.  You might find cron files for your system 
     45          under the build/dists subdirectory, or perhaps in the 
     46          build/resources directory. 
     47 
     48        - if you want to use the dynamic graphs: Configure the cgi 
     49          directory, you will find a apache config example in 
     50          build/resources.  NOTE: Dynamic graphs are not exactly 
     51          perfect. Se also http://munin.projects.linpro.no/wiki/CgiHowto 
    1452 
    1553To install the documentation: 
     
    1856        - make install-doc install-man 
    1957 
    20 To install the client
     58To install a node
    2159 
    2260        - edit Makefile.config 
    2361        - create the group "munin" 
    24         - make install-node install-node-plugins 
    25         - decide which plugins to use (quick auto-solution:  
    26           "munin-node-configure --shell | sh") 
    27         - start the client (you probably want an init-script for this) 
     62        - make install-node install-node-plugins (NOTE: This installs 
     63          all plugins in the distribution, no matter what you already 
     64          have, if you want to save some plugins you've installed yourself 
     65          or have customized please make a backup copy). 
     66        - decide which plugins to use.  The quick auto-plug-and-play 
     67          solution:  
     68            munin-node-configure --shell --families=contrib,auto | sh -x 
     69 
     70        - start the node agent. You probably want an init-script for 
     71          this and you might find a good one under build/dists 
    2872 
    2973Notes about node plugins 
    30 -------------------------- 
     74------------------------ 
    3175 
    3276"make install-node-plugins" installs the plugins in LIBDIR (defined in 
    3377Makefile.config). Put the ones you want to use (or better yet, create 
    34 softlinks) in CONFDIR/client.d/ . An easy way to do this, is the program 
    35 "munin-node-configure", using the parameter "--shell". It will then 
    36 suggest commands to do this. 
     78softlinks) in CONFDIR/plugins/ . An easy way to do this, is the 
     79program "munin-node-configure", using the parameter "--shell". It will 
     80then suggest commands to do this. 
    3781 
    38 Some of the plugins require some configuration to get running. An 
    39 example configuration file is found in the file "plugins.conf"; 
     82Some of the plugins require some configuration to get running.  Some 
     83example configuration files (plugins.conf) is found under the 
     84build/dists directory. 
    4085 
    41 Many OSes and releases thereof have different ways of gathering data. A 
    42 lot of OSes still have none. If you create plugins for a system which is 
    43 not already in the package, please send us a copy of them, so we can add 
    44 them for others to use. We'd also be happy if you sent us any new plugins 
    45 on systems already in the package. 
    46  
     86Many OSes and releases thereof have different ways of gathering data. 
     87A lot of OSes still have none.  If you create plugins for an OS/system 
     88which is not already in the package, please send us a copy of them, so 
     89we can add them for others to use.  We'd also be happy if you sent us 
     90any new plugins on systems already in the package. 
  • people/ilmari/modularisation-branch/Makefile

    r1045 r1265  
    1 #! /usr/bin/make -f 
    2  
    3 DEFAULTS = Makefile.config 
    4 CONFIG = Makefile.config 
    5  
    6 include $(DEFAULTS) 
    7 include $(CONFIG) 
     1# Gnu make only.  Seriously. 
     2# $Id$ 
     3 
     4# Defaults/paths from this file 
     5include Makefile.config 
    86 
    97RELEASE          = $(shell cat RELEASE) 
     
    119INSTALL          = ./install-sh 
    1210DIR              = $(shell /bin/pwd | sed 's/^.*\///') 
     11INFILES          = $(shell find . -name '*.in') 
     12PLUGINS          = $(wildcard node/node.d.$(OSTYPE)/* node/node.d/*) 
     13MANCENTER        = "Munin Documentation" 
     14MAN8             = node/munin-node node/munin-run \ 
     15                        node/munin-node-configure-snmp \ 
     16                        node/munin-node-configure \ 
     17                        server/munin-graph server/munin-update \ 
     18                        server/munin-limits server/munin-html 
     19PODMAN8          = server/munin-cron 
     20PODMAN5          = server/munin.conf node/munin-node.conf 
    1321 
    1422default: build 
    1523 
    16 install: install-main install-node install-node-plugins install-doc install-man 
     24install: install-main install-node install-node-plugins install-man 
     25 
     26uninstall: uninstall-main 
     27 
     28# This removes the installed config so that the next install-pass installs 
     29# a new config.  Target suitable for maintainers 
     30unconfig: 
     31        rm -f $(HTMLDIR)/.htaccess 
     32        rm -f $(CONFDIR)/munin.conf 
    1733 
    1834install-main: build 
     
    3147        $(CHOWN) $(USER) $(LOGDIR) $(STATEDIR) $(RUNDIR) $(HTMLDIR) $(DBDIR) 
    3248 
    33         for p in build/server/*.tmpl; do                              
     49        for p in build/server/*.tmpl; do                         
    3450                $(INSTALL) -m 0644 "$$p" $(CONFDIR)/templates/ ; \ 
    3551        done 
     
    3753        $(INSTALL) -m 0644 server/style.css $(CONFDIR)/templates/ 
    3854        $(INSTALL) -m 0644 server/definitions.html $(CONFDIR)/templates/ 
    39  
     55        $(INSTALL) -m 0755 server/VeraMono.ttf $(LIBDIR)/ 
     56        $(INSTALL) -m 0644 resources/favicon.ico $(HTMLDIR)/ 
     57        test -f $(HTMLDIR)/.htaccess || $(INSTALL) -m 0644 build/server/munin-htaccess $(HTMLDIR)/.htaccess 
    4058        test -f "$(CONFDIR)/munin.conf"  || $(INSTALL) -m 0644 build/server/munin.conf $(CONFDIR)/ 
    41  
    4259        $(INSTALL) -m 0755 build/server/munin-cron $(BINDIR)/ 
    43  
    4460        $(INSTALL) -m 0755 build/server/munin-update $(LIBDIR)/ 
    4561        $(INSTALL) -m 0755 build/server/munin-graph $(LIBDIR)/ 
     
    4763        $(INSTALL) -m 0755 build/server/munin-limits $(LIBDIR)/ 
    4864        $(INSTALL) -m 0755 build/server/munin-cgi-graph $(CGIDIR)/ 
    49  
    5065        $(INSTALL) -m 0644 build/server/lib/Munin.pm $(PERLLIB)/ 
     66 
     67uninstall-main: build 
     68        for p in build/server/*.tmpl; do            \ 
     69                rm -f $(CONFDIR)/templates/"$$p"  ; \ 
     70        done 
     71        rm -f $(CONFDIR)/templates/logo.png 
     72        rm -f $(CONFDIR)/templates/style.css 
     73        rm -f $(CONFDIR)/templates/definitions.html 
     74        rm -f $(HTMLDIR)/.htaccess 
     75 
     76        rm -f $(CONFDIR)/munin.conf  
     77 
     78        rm -f $(BINDIR)/munin-cron  
     79 
     80        rm -f $(LIBDIR)/munin-update 
     81        rm -f $(LIBDIR)/munin-graph 
     82        rm -f $(LIBDIR)/munin-html 
     83        rm -f $(LIBDIR)/munin-limits 
     84        rm -f $(CGIDIR)/munin-cgi-graph 
     85 
     86        rm -f $(PERLLIB)/Munin.pm  
     87        -rmdir $(CONFDIR)/templates 
     88        -rmdir $(CONFDIR) 
     89        -rmdir $(LIBDIR) 
     90        -rmdir $(BINDIR) 
     91 
     92        -rmdir $(LOGDIR) 
     93        -rmdir $(STATEDIR) 
     94        -rmdir $(HTMLDIR) 
     95        -rmdir $(DBDIR) 
     96        -rmdir $(CGIDIR) 
    5197 
    5298install-node: build install-node-non-snmp install-node-snmp 
    5399        echo Done. 
    54100 
     101uninstall-node: uninstall-node-non-snmp uninstall-node-snmp 
     102        echo Undone. 
     103 
    55104install-node-snmp: build 
    56105        $(INSTALL) -m 0755 build/node/munin-node-configure-snmp $(SBINDIR)/ 
     106 
     107uninstall-node-snmp: build 
     108        rm -f $(SBINDIR)/munin-node-configure-snmp 
     109        -rmdir $(SBINDIR) 
    57110 
    58111install-node-non-snmp: build 
     
    76129        $(INSTALL) -m 0755 build/node/munin-run $(SBINDIR)/ 
    77130 
    78 install-node-plugins: build 
    79         for p in build/node/node.d.$(OSTYPE)/* build/node/node.d/*; do                  \ 
    80                 if test -f "$$p" ; then                                                 \ 
    81                         family=`sed -n 's/^#%# family=\(.*\)$$/\1/p' $$p`;              \ 
    82                         test "$$family" || family=contrib;                              \ 
    83                         if echo $(INSTALL_PLUGINS) | grep $$family >/dev/null; then     \ 
    84                                 test -f "$(LIBDIR)/plugins/`basename $$p`"              \ 
    85                                 || $(INSTALL) -m 0755 $$p $(LIBDIR)/plugins/;                   \ 
    86                         fi;                                                             \ 
    87                 fi                                                                      \ 
    88         done 
     131uninstall-node-non-snmp: build 
     132        rm -f $(SBINDIR)/munin-node  
     133        rm -f $(SBINDIR)/munin-node-configure 
     134        rm -f $(CONFDIR)/munin-node.conf  
     135        rm -f $(SBINDIR)/munin-run 
     136        -rmdir $(CONFDIR)/plugin-conf.d 
     137        -rmdir $(CONFDIR) 
     138        -rmdir $(SBINDIR) 
     139 
     140# ALWAYS DO THE OS SPECIFIC PLUGINS LAST! THAT WAY THEY OVERWRITE THE 
     141# GENERIC ONES 
     142install-node-plugins: build $(PLUGINS) Makefile Makefile.config 
     143        for p in build/node/node.d/* build/node/node.d.$(OSTYPE)/* ; do \ 
     144            if test -f "$$p" ; then                                    \ 
     145                family=`sed -n 's/^#%# family=\(.*\)$$/\1/p' $$p`;     \ 
     146                test "$$family" || family=contrib;                     \ 
     147                if echo $(INSTALL_PLUGINS) |                           \ 
     148                   grep $$family >/dev/null; then                      \ 
     149                        echo Installing $$p;                           \ 
     150                        $(INSTALL) -m 0755 $$p $(LIBDIR)/plugins/;     \ 
     151                fi;                                                    \ 
     152            fi                                                         \ 
     153        done 
     154        -mkdir -p $(PLUGSTATE) 
     155        $(CHOWN) $(PLUGINUSER):$(GROUP) $(PLUGSTATE) 
     156        $(CHMOD) 0664 $(PLUGSTATE) 
    89157        $(INSTALL) -m 0644 build/node/plugins.history $(LIBDIR)/plugins/ 
     158        $(INSTALL) -m 0644 build/node/plugin.sh $(LIBDIR)/plugins/ 
     159        mkdir -p $(PERLLIB)/Munin 
     160        $(INSTALL) -m 0644 build/node/Plugin.pm $(PERLLIB)/Munin/ 
    90161 
    91162        mkdir -p $(PERLLIB)/Munin/Plugin 
     
    94165        $(INSTALL) -m 0644 build/node/lib/Munin/Node/Runner.pm $(PERLLIB)/Munin/Node/ 
    95166 
    96         #TODO: 
    97         #configure plugins. 
    98  
    99 install-man: build-man 
     167uninstall-node-plugins: build $(PLUGINS) 
     168        for p in build/node/node.d.$(OSTYPE)/* build/node/node.d/*; do \ 
     169            rm -f $(LIBDIR)/plugins/`basename $$p` \ 
     170        done 
     171        rm -f $(LIBDIR)/plugins/plugins.history 
     172        rm -f $(LIBDIR)/plugins/plugin.sh 
     173 
     174#TODO: 
     175#configure plugins. 
     176 
     177install-man: build-man Makefile Makefile.config 
    100178        mkdir -p $(MANDIR)/man1 $(MANDIR)/man5 $(MANDIR)/man8 
    101179        $(INSTALL) -m 0644 build/doc/munin-node.conf.5 $(MANDIR)/man5/ 
     
    111189        $(INSTALL) -m 0644 build/doc/munin-cron.8 $(MANDIR)/man8/ 
    112190 
     191uninstall-man: build-man 
     192        rm -f $(MANDIR)/man5/munin-node.conf.5  
     193        rm -f $(MANDIR)/man5/munin.conf.5  
     194        rm -f $(MANDIR)/man8/munin-node.8 
     195        rm -f $(MANDIR)/man8/munin-node-configure.8  
     196        rm -f $(MANDIR)/man8/munin-node-configure-snmp.8 
     197        rm -f $(MANDIR)/man8/munin-run.8 
     198        rm -f $(MANDIR)/man8/munin-graph.8  
     199        rm -f $(MANDIR)/man8/munin-update.8  
     200        rm -f $(MANDIR)/man8/munin-limits.8 
     201        rm -f $(MANDIR)/man8/munin-html.8 
     202        rm -f $(MANDIR)/man8/munin-cron.8  
     203        -rmdir $(MANDIR)/man1 $(MANDIR)/man5 $(MANDIR)/man8 $(MANDIR) 
     204 
    113205install-doc: build-doc 
    114         mkdir -p $(DOCDIR) 
    115         $(INSTALL) -m 0644 build/doc/munin-doc.html $(DOCDIR)/ 
    116         $(INSTALL) -m 0644 build/doc/munin-doc.pdf $(DOCDIR)/ 
    117         $(INSTALL) -m 0644 build/doc/munin-doc.txt $(DOCDIR)/ 
    118         $(INSTALL) -m 0644 build/doc/munin-faq.html $(DOCDIR)/ 
    119         $(INSTALL) -m 0644 build/doc/munin-faq.pdf $(DOCDIR)/ 
    120         $(INSTALL) -m 0644 build/doc/munin-faq.txt $(DOCDIR)/ 
    121         $(INSTALL) -m 0644 README.* $(DOCDIR)/ 
     206        mkdir -p $(DOCDIR)/resources 
     207        $(INSTALL) -m 0644 README $(DOCDIR)/ 
    122208        $(INSTALL) -m 0644 COPYING $(DOCDIR)/ 
    123         $(INSTALL) -m 0644 build/README-apache-cgi $(DOCDIR)/ 
    124         $(INSTALL) -m 0644 node/node.d/README $(DOCDIR)/README.plugins 
     209        $(INSTALL) -m 0644 build/resources/* $(DOCDIR)/resources 
     210 
     211uninstall-doc: build-doc 
     212        rm -rf $(DOCDIR) 
    125213 
    126214build: build-stamp 
    127215 
    128 build-stamp: 
    129         @for file in `find . -type f -name '*.in'`; do                  \ 
     216# Recursive pattern rule needed. 
     217# %: %.in Makefile Makefile.config 
     218 
     219build-stamp: $(INFILES) Makefile Makefile.config 
     220        touch build-stamp 
     221        rm -rf build 
     222        @for file in $(INFILES); do                     \ 
    130223                destname=`echo $$file | sed 's/.in$$//'`;               \ 
    131                 echo Generating $$destname..;                         \ 
     224                echo Generating build/$$destname..;                   \ 
    132225                mkdir -p build/`dirname $$file`;                        \ 
    133226                sed -e 's|@@PREFIX@@|$(PREFIX)|g'                       \ 
     
    144237                    -e 's|@@PERL@@|$(PERL)|g'                           \ 
    145238                    -e 's|@@PERLLIB@@|$(PERLLIB)|g'                     \ 
    146                     -e 's|@@PYTHON@@|$(PYTHON)|g'                              
    147                     -e 's|@@OSTYPE@@|$(OSTYPE)|g'                              
     239                    -e 's|@@PYTHON@@|$(PYTHON)|g'                       
     240                    -e 's|@@OSTYPE@@|$(OSTYPE)|g'                       
    148241                    -e 's|@@HOSTNAME@@|$(HOSTNAME)|g'                   \ 
    149242                    -e 's|@@MKTEMP@@|$(MKTEMP)|g'                       \ 
     
    154247                    -e 's|@@GROUP@@|$(GROUP)|g'                         \ 
    155248                    -e 's|@@PLUGINUSER@@|$(PLUGINUSER)|g'               \ 
     249                    -e 's|@@GOODSH@@|$(GOODSH)|g'                       \ 
     250                    -e 's|@@BASH@@|$(BASH)|g'                           \ 
    156251                    $$file > build/$$destname;                          \ 
    157252        done 
    158         touch build-stamp 
    159  
    160 build-doc: build-doc-stamp 
     253 
     254build-doc: build-doc-stamp Makefile Makefile.config 
    161255 
    162256build-doc-stamp: 
     257        touch build-doc-stamp 
    163258        mkdir -p build/doc 
    164         -htmldoc munin-doc-base.html > build/doc/munin-doc.html 
    165         -htmldoc -t pdf --webpage build/doc/munin-doc.html > build/doc/munin-doc.pdf 
    166         -html2text -style pretty -nobs build/doc/munin-doc.html > build/doc/munin-doc.txt 
    167  
    168         -htmldoc munin-faq-base.html > build/doc/munin-faq.html 
    169         -htmldoc -t pdf --webpage build/doc/munin-faq.html > build/doc/munin-faq.pdf 
    170         -html2text -style pretty -nobs build/doc/munin-faq.html > build/doc/munin-faq.txt 
    171  
    172         touch build-doc-stamp 
    173  
    174 build-man: build-man-stamp 
    175  
    176 build-man-stamp: build 
     259 
     260build-man: build-man-stamp  
     261 
     262build-man-stamp: build Makefile Makefile.config 
     263        touch build-man-stamp 
    177264        mkdir -p build/doc 
    178         pod2man  --section=8 --release=$(RELEASE) --center="Munin Documentation" \ 
    179                 build/node/munin-node > build/doc/munin-node.8 
    180         pod2man  --section=8 --release=$(RELEASE) --center="Munin Documentation" \ 
    181                 build/node/munin-run > build/doc/munin-run.8 
    182         pod2man  --section=8 --release=$(RELEASE) --center="Munin Documentation" \ 
    183                 build/node/munin-node-configure-snmp > build/doc/munin-node-configure-snmp.8 
    184         pod2man  --section=8 --release=$(RELEASE) --center="Munin Documentation" \ 
    185                 build/node/munin-node-configure > build/doc/munin-node-configure.8 
    186         pod2man  --section=8 --release=$(RELEASE) --center="Munin Documentation" \ 
    187                 build/server/munin-graph > build/doc/munin-graph.8 
    188         pod2man  --section=8 --release=$(RELEASE) --center="Munin Documentation" \ 
    189                 build/server/munin-update > build/doc/munin-update.8 
    190         pod2man  --section=8 --release=$(RELEASE) --center="Munin Documentation" \ 
    191                 build/server/munin-limits > build/doc/munin-limits.8 
    192         pod2man  --section=8 --release=$(RELEASE) --center="Munin Documentation" \ 
    193                 build/server/munin-html > build/doc/munin-html.8 
    194         pod2man  --section=8 --release=$(RELEASE) --center="Munin Documentation" \ 
    195                 server/munin-cron.pod > build/doc/munin-cron.8 
    196         pod2man  --section=5 --release=$(RELEASE) --center="Munin Documentation" \ 
    197                 server/munin.conf.pod > build/doc/munin.conf.5 
    198         pod2man  --section=5 --release=$(RELEASE) --center="Munin Documentation" \ 
    199                 node/munin-node.conf.pod > build/doc/munin-node.conf.5 
    200  
    201         touch build-man-stamp 
     265        for f in $(MAN8); do \ 
     266           pod2man --section=8 --release=$(RELEASE) --center=$(MANCENTER) build/"$$f" > build/doc/`basename $$f`.8; \ 
     267        done 
     268        for f in $(PODMAN8); do \ 
     269           pod2man --section=8 --release=$(RELEASE) --center=$(MANCENTER) "$$f".pod > build/doc/`basename $$f .pod`.8; \ 
     270        done 
     271        for f in $(PODMAN5); do \ 
     272           pod2man --section=5 --release=$(RELEASE) --center=$(MANCENTER) "$$f".pod > build/doc/`basename $$f .pod`.5; \ 
     273        done 
     274 
    202275 
    203276deb: 
     277        (! grep MAINTAINER Makefile.config) 
    204278        -rm debian 
    205279        -ln -s dists/debian 
     
    207281 
    208282rpm-pre: 
     283        (! grep MAINTAINER Makefile.config) 
    209284        @for file in `find dists/redhat/ -type f -name '*.in'`; do                      \ 
    210285                destname=`echo $$file | sed 's/.in$$//'`;               \ 
     
    225300 
    226301suse-pre: 
     302        (! grep MAINTAINER Makefile.config) 
    227303        @for file in `find dists/suse/ -type f -name '*.in'`; do                \ 
    228304                destname=`echo $$file | sed 's/.in$$//'`;               \ 
     
    259335 
    260336source_dist: clean 
    261         (cd ..; ln -s $(DIR) munin-$(VERSION)) 
     337        (! grep MAINTAINER Makefile.config) 
     338        (cd .. && ln -s $(DIR) munin-$(VERSION)) 
    262339        tar -C .. --dereference --exclude .svn -cvzf ../munin_$(RELEASE).tar.gz munin-$(VERSION)/ 
     340        (cd .. && rm munin-$(VERSION)) 
    263341 
    264342ifeq ($(MAKELEVEL),0) 
     
    281359        ln -s $< $@ 
    282360 
     361node-monkeywrench: install-node 
     362        rm -rf $(CONFDIR)/plugins 
     363        rm -rf $(LIBDIR)/plugins 
     364        mkdir -p $(LIBDIR)/plugins 
     365        mkdir -p $(CONFDIR)/plugins 
     366        cp monkeywrench/plugin-break*_ $(LIBDIR)/plugins/ 
     367        $(SBINDIR)/munin-node-configure --suggest 
     368        echo 'Done?' 
     369 
    283370t/install:  
    284371        $(MAKE) clean install-node install-node-plugins CONFIG=t/Makefile.config INSTALL_PLUGINS=test 
  • people/ilmari/modularisation-branch/Makefile.config

    r1012 r1265  
     1# MAINTAINER VERSION OF Makefile.config 
     2# -*- Makefile -*- 
     3# 
     4# This file is rigged to overwrite the a debian munin-package as that 
     5# is what janl uses. 
     6# 
     7# $Id$ 
     8 
    19# This file specifies where Munin will look for things after you've 
    210# run 'make' in the source directory.  Modify it to suit your needs. 
     
    513# a shadow tree during make install. 
    614 
    7 
    8 # the base of the Munin installation. 
    9 #  
    10 PREFIX     = $(DESTDIR)/opt/munin 
     15# Include the default config 
     16include Makefile.config-dist 
    1117 
    12 # Where Munin keeps its configurations (server.conf, client.conf, ++) 
    13 CONFDIR    = $(DESTDIR)/etc/opt/munin 
     18# Then override 
    1419 
    15 # Server only - where to put munin-cron 
    16 BINDIR     = $(PREFIX)/bin 
    17  
    18 # Client only - where to put munin-node, munin-node-configure, and munin-run 
    19 SBINDIR    = $(PREFIX)/sbin 
    20  
    21 # Where to put text and html documentation 
    22 DOCDIR     = $(PREFIX)/doc 
    23  
    24 # Where to put man pages 
    25 MANDIR     = $(PREFIX)/man 
     20PREFIX     = $(DESTDIR)/usr 
     21CONFDIR    = $(DESTDIR)/etc/munin 
     22DOCDIR     = $(PREFIX)/share/doc/munin 
     23MANDIR     = $(PREFIX)/share/man 
    2624 
    2725# Where to put internal binaries and plugin repository 
    28 LIBDIR     = $(PREFIX)/lib 
     26LIBDIR     = $(PREFIX)/share/munin 
    2927 
    3028# Server only - Output directory 
    31 HTMLDIR    = $(PREFIX)/var/www 
    32 CGIDIR     = $(HTMLDIR)/cgi 
     29HTMLDIR    = /var/www/munin 
     30CGIDIR     = $(HTMLDIR)/../cgi 
    3331 
    3432# Client only - Where to put RRD files and other intenal data 
    35 DBDIR      = $(DESTDIR)/var/opt/munin 
     33DBDIR      = $(DESTDIR)/var/lib/munin 
    3634 
    3735# Client only - Where plugins should put their states. Must be writable by 
     
    5250PYTHON     = /usr/bin/env python 
    5351 
     52# A modern shell.  We're not looking for arrays, but $() and other modern 
     53# stuff is expected. 
     54# Linux: /bin/bash 
     55# SunOS/Solaris: /usr/xpg4/bin/sh or /bin/ksh 
     56# In general: bash or ksh will work 
     57GOODSH     = /bin/bash 
     58 
     59# Path of bash for bash specific plugins 
     60BASH       = /bin/bash 
     61 
    5462# Server only - Where to install the perl libraries 
    55 PERLLIB    = $(DESTDIR)$(shell $(PERL) -V:sitelib | cut -d= -f2 | sed "s/[\';]//g"
     63PERLLIB    = $(DESTDIR)$(shell $(PERL) -V:sitelib | cut -d"'" -f2
    5664 
    5765# Client only - Install plugins for this architecture 
  • people/ilmari/modularisation-branch/RELEASE

    r1045 r1265  
    1 snapshot 
     1svn-trunk 
  • people/ilmari/modularisation-branch/node/munin-node-configure-snmp.in

    r1012 r1265  
    11#!@@PERL@@ -w 
    22# 
    3 # Copyright (C) 2004 Jimmy Olsen 
     3# Copyright (C) 2004-2006 Jimmy Olsen 
    44# 
    55# This program is free software; you can redistribute it and/or 
     
    1717# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
    1818# 
    19 # 
    2019 
    2120use strict; 
     
    6362    "snmpversion=s" => \$snmpver, 
    6463    "community=s"   => \$community, 
    65     "newer=s"      => \$newer 
     64    "newer=s"      => \$newer   # Seems unused 
    6665); 
    6766 
     
    8786        --servicedir <dir>  Override plugin dir [$servicedir] 
    8887        --libdir <dir>      Override plugin lib [$libdir] 
    89  
     88        --snmpversion <ver> Override SNMP version [$snmpver] 
     89        --community <str>   Override SNMP community [$community] 
    9090 
    9191"; 
     
    100100Written by Jimmy Olsen 
    101101 
    102 Copyright (C) 2004-2005 Jimmy Olsen 
     102Copyright (C) 2004-2006 Jimmy Olsen 
    103103 
    104104This is free software released under the GNU General Public License. There 
     
    166166                ); 
    167167        $session->translate (0); 
     168        die $error if $error; 
    168169 
    169170        if (!defined ($session)) 
  • people/ilmari/modularisation-branch/node/munin-node-configure.in

    r1012 r1265  
    11#!@@PERL@@ -w 
     2# -*- perl -*- 
    23# 
    3 # Copyright (C) 2004 Jimmy Olsen 
     4# Copyright (C) 2003-2006 Jimmy Olsen, 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 # Program to suggest configurations and configuration changes. 
    20 
     20# Program to suggest what plugins to use and not 
    2121 
    2222$| = 1; # Flush after every write to stdout 
     
    2424use strict; 
    2525use Getopt::Long; 
     26# use Data::Dumper; 
    2627 
    2728my $version    = "@@VERSION@@"; 
     
    4647my $do_version = 0; 
    4748my $newer      = undef; 
     49my $debugopt   = '--debug'; # Pass --debug to children or not 
     50my @errors     = (); 
     51my $exiterror  = 1; 
    4852 
    4953$do_error = 1 unless GetOptions ( 
    5054        "help"            => \$do_usage, 
    5155        "shell!"          => \$shell, 
     56        "exitnoterror!"   => \$exiterror, 
    5257        "debug!"          => \$debug, 
    5358        "suggest!"        => \$suggest, 
     
    7984        --suggest               Show suggestions instead of status 
    8085        --shell                 Show shell commands (implies --suggest) 
     86        --exitnoterror          Do not consider non-zero exit-value as error 
    8187        --remove-also           Also show rm-commands when doing --shell 
    8288        --newer <version>       Only show suggestions related to plugins newer 
     
    8692        --snmpcommunity <comm>  Set SNMP community [public] 
    8793 
     94By default this program shows which plugins are activated on the 
     95system.  If you specify --suggest it will present a table of plugins 
     96that will probably work (according to the plugins autoconf command). 
     97If you specify --shell shell commands to install those same plugins 
     98will be printed.  These can be reviewed or piped directly into a shell 
     99to install the plugins. 
     100 
    88101"; 
    89102 
     
    97110Written by Jimmy Olsen 
    98111 
    99 Copyright (C) 2003-2005 Jimmy Olsen 
     112Copyright (C) 2003-2006 Jimmy Olsen 
    100113 
    101114This is free software released under the GNU General Public License. There 
     
    110123if (defined $newer and (!$shell or $removes)) 
    111124{ 
    112     print "Fatal: --newer only supported along with --shell.\n"; 
     125    print STDERR "Fatal: --newer only supported along with --shell.\n"; 
    113126    exit 2; 
    114127} 
    115128 
    116 if (!@families) 
    117 
     129if (@families) { 
     130    @families = split /,/ , $families[0]; 
     131} else { 
    118132    if (@snmp) 
    119133    { 
     
    131145} 
    132146 
    133 @families = split (/,/, join (',', @families)); 
    134 @snmp = split (/,/, join (',', @snmp)); 
     147# Normalize input in case it was taken from commandline? 
     148# This seems like a noop no matter what went before. 
     149# @families = split (/,/, join (',', @families)); 
     150# @snmp = split (/,/, join (',', @snmp)); 
    135151 
    136152if (@snmp and !$shell) 
    137153{ 
    138     print "Fatal: --snmp only supported along with --shell.\n"; 
     154    print STDERR "Fatal: --snmp only supported along with --shell.\n"; 
    139155    exit 3; 
    140156} 
     
    158174    foreach my $plug (sort keys %{$plugins}) 
    159175    { 
     176#       print "New plugin: ", Dumper $plugins->{$plug},"\n"; 
     177 
    160178        next unless defined $plugins->{$plug}->{'family'}; 
    161179        next unless (grep (/^$plugins->{$plug}->{'family'}$/, @families)); 
     
    282300                &normal ($plug, $now, ""); 
    283301            } 
    284              
    285        
    286    
    287 
     302        } 
     303   
     304
     305 
    288306 
    289307if (@snmp and $shell) 
     
    297315            push (@params, "--snmpversion", $snmpver) if defined $snmpver; 
    298316            push (@params, "--community", $snmpcomm) if defined $snmpcomm; 
    299             push (@params, "--debug") if $debug; 
     317            push (@params, $debugopt) if $debug; 
    300318            push (@params, @snmp); 
     319            print "# executing: ",join(' ',@params),"\n" if $debug; 
    301320            exec (@params); 
    302321            # NOTREACHED 
     
    317336} 
    318337 
     338if (@errors) { 
     339    print STDERR "# There were some errors:\n"; 
     340    print STDERR "# ",join("\n# ",@errors),"\n"; 
     341 
     342    exit 1; 
     343} 
     344 
    319345sub link_remove 
    320346{ 
     
    347373} 
    348374 
    349 sub get_installed 
    350 
     375sub get_installed { 
    351376        (my $ps, my $dir) = @_; 
    352377 
    353         print "DEBUG: Opening \"$dir\" for reading...\n" if $debug; 
    354         opendir (DIR, $dir) or die "Could not open \"$dir\" for reading: $!"; 
     378        print "# Opening \"$dir\" for reading...\n" if $debug; 
     379        opendir (DIR, $dir) or die "Could not open \"$dir\" for reading: $!\n"; 
    355380        my @installed = readdir (DIR); 
     381        print "# Found ",scalar(@installed)," files\n" if $debug; 
    356382        close (DIR); 
    357383 
    358         foreach my $inst (@installed) 
    359         { 
     384        foreach my $inst (@installed) { 
    360385                my $realfile = undef; 
    361386 
     
    365390                $realfile =~ s/^.+\///; 
    366391 
    367                 print "DEBUG: Checking file: $inst..." if $debug; 
     392                print "# Checking file: $inst..." if $debug; 
    368393                if ($realfile =~ /_$/) # Wildcard plugin... 
    369394                { 
    370                     print "$realfile..." if $debug; 
     395                    print "# $realfile..." if $debug; 
    371396                    (my $wild = $inst) =~ s/^$realfile//; 
    372                     print "$wild..." if $debug; 
     397                    print "# $wild..." if $debug; 
    373398                    push @{$ps->{$realfile}->{'suggest'}}, $wild; 
    374399                } 
     
    381406} 
    382407 
    383 sub get_plugins 
    384 
    385         (my $ps, my $dir) = @_; 
    386         my %versions = (); 
    387  
    388         if (defined $newer and -f "$dir/plugins.history") 
    389         { 
    390             if (open (HIST, "$dir/plugins.history")) 
    391             { 
    392                 my @slurp = <HIST>; 
    393                 my $reached_version = 0; 
    394                 my $ver = "0.0.0"; 
    395                 close (HIST); 
    396                 my $uname = lc `uname`; 
    397                 chomp $uname; 
    398  
    399                 foreach my $line (@slurp) 
    400                 { 
    401                     chomp $line; 
    402                     $line =~ s/#.*//g; 
    403                     $line =~ s/^\s+//g; 
    404                     $line =~ s/\s+$//g; 
    405                     next unless $line =~ /\S/; 
    406  
    407                     if ($line =~ /^\[([^\]]+)\]$/) 
    408                     { 
    409                         $ver = $1; 
    410                         print "Setting version to \"$ver\".\n" if $debug; 
    411                         if ($ver eq $newer) 
    412                         { 
    413                             $reached_version = 1; 
     408sub get_plugins { 
     409    (my $ps, my $dir) = @_; 
     410    my %versions = (); 
     411 
     412    if (defined $newer and -f "$dir/plugins.history") { 
     413        if (open (HIST, "$dir/plugins.history")) { 
     414            my @slurp = <HIST>; 
     415            my $reached_version = 0; 
     416            my $ver = "0.0.0"; 
     417            close (HIST); 
     418            my $uname = lc `uname`; 
     419            chomp $uname; 
     420 
     421            foreach my $line (@slurp) { 
     422                chomp $line; 
     423                $line =~ s/#.*//g; 
     424                $line =~ s/^\s+//g; 
     425                $line =~ s/\s+$//g; 
     426                next unless $line =~ /\S/; 
     427 
     428                if ($line =~ /^\[([^\]]+)\]$/) { 
     429                    $ver = $1; 
     430                    print "# Setting version to \"$ver\".\n" if $debug; 
     431                    if ($ver eq $newer) { 
     432                        $reached_version = 1; 
     433                    } elsif ($reached_version) { 
     434                        $reached_version++; 
     435                    } 
     436                } elsif ($reached_version < 2) { 
     437                    next; 
     438                } elsif ($line =~ /^([^\/]+)\/(.+)$/) { 
     439                    if ($uname eq $1) { 
     440                        $ps->{$2}->{'version'} = $ver; 
     441                        print "# - Adding plugin '$2' to version tree ", 
     442                          "($ver)...\n" if $debug; 
     443                    } 
     444                } elsif ($line =~ /^(.+)$/) { 
     445                    $ps->{$1}->{'version'} = $ver; 
     446                    print "# - Adding plugin \"$1\" to version tree ", 
     447                      "($ver)...\n" if $debug; 
     448                } 
     449            } 
     450        } else { 
     451            warn "Warning: Could not open \"$dir/plugins.history\": $!\n"; 
     452        } 
     453    } 
     454 
     455    print "# Opening \"$dir\" for reading...\n" if $debug; 
     456    opendir (DIR, $dir) or die "Could not open \"$dir\" for reading: $!\n"; 
     457    my @plugins = readdir (DIR); 
     458    print "# Found ",scalar(@plugins)," files\n" if $debug; 
     459    close (DIR); 
     460 
     461    foreach my $plug (@plugins) { 
     462        my $path = "$dir/$plug"; 
     463        next if $plug =~ /^\./; 
     464        print "# Considering $dir/$plug for checking\n" if $debug; 
     465        # If anyone ever uses a relative symlink this will break so bad 
     466        $path = readlink($path) and 
     467          $path = $path =~ /^\// ? $path : "$dir/$path" 
     468            while -l $path; 
     469        if (!-f $path) { 
     470            print "# File is not a file\n" if $debug; 
     471            next; 
     472        } 
     473        if (!-x _) { 
     474            print "# File is not executable\n" if $debug; 
     475            next; 
     476        } 
     477        if ($plug =~ /~$/    or # Emacs droppings 
     478            $plug =~ /.bak$/ or # Backup file 
     479            $plug =~ /.swp$/) { # Vi droppings 
     480            print "# File is a backup/leftover file\n" if $debug; 
     481            next; 
     482        } 
     483 
     484        $ps->{$plug}->{'family'} = "contrib"; # Set default family... 
     485 
     486        print "# Checking plugin: $plug..." if $debug; 
     487        if (! open (FILE, "$dir/$plug")) { 
     488            warn "WARNING: Could not open file '$dir/$plug' for reading $!.". 
     489              "Skipping.\n"; 
     490            next; 
     491        } 
     492        while (<FILE>) { 
     493            chomp; 
     494            if (/#%#\s+family\s*=\s*(\S+)\s*$/) { 
     495                $ps->{$plug}->{'family'} = $1; 
     496                print "# $1..." if $debug; 
     497            } elsif (/#%#\s+capabilities\s*=\s*(.+)$/) { 
     498                foreach my $cap (split (/\s+/, $1)) { 
     499                    $ps->{$plug}->{'capability'}->{$cap} = 1; 
     500                    print "# $cap..." if $debug; 
     501                } 
     502            } 
     503        } 
     504        close (FILE); 
     505 
     506        unless (grep (/^$ps->{$plug}->{'family'}$/, @families)) { 
     507            print "\n" if $debug; 
     508            next; 
     509        } 
     510        if ($ps->{$plug}->{'family'} eq "auto" and defined $newer and 
     511            !defined $ps->{$plug}->{'version'}) { 
     512            print "\n" if $debug; 
     513            next; 
     514        } 
     515 
     516 
     517        if ($ps->{$plug}->{'capability'}->{'autoconf'}) { 
     518 
     519            my $gotjunk=0;  # Seen junk? 
     520 
     521            my @cmd=("$bindir/munin-run"); 
     522            push(@cmd,$debugopt) if $debug; 
     523            push(@cmd,"--servicedir",$libdir, $plug, "autoconf"); 
     524 
     525            print "\n# Running: ",join(' ',@cmd),"\n" if $debug; 
     526 
     527            my $fork = open (PLUG, "-|"); 
     528 
     529            if ($fork == -1) { 
     530                die "ERROR: Unable to fork: $!\n" 
     531            } elsif ($fork == 0) { # Child 
     532                close (STDERR); 
     533                open (STDERR, ">&STDOUT"); 
     534                exec (@cmd); 
     535            } else { 
     536                # The join map we used here before was somehow 
     537                # fragile.  This construct is possible to 
     538                # debug.L 
     539 
     540                my @pr = ();    # Plugin response 
     541 
     542                # IFF the plugin exits with non-zero exit code we will 
     543                # not use it no matter what. Instead we report it as 
     544                # an error.  This is to be able to tell a error free 
     545                # execution from a erronous one. 
     546                # 
     547                # Also, if the plugin outputs junk we handle that as 
     548                # an error. 
     549 
     550                while (<PLUG>) { 
     551                    chomp; 
     552                    if (m/^yes$/ or m/^no(\s+.*)?$/) { 
     553                        # Some recognized response 
     554                        print "# Got yes/no: $_\n" if $debug; 
     555                        push(@pr,$_); 
     556                    } elsif (m/^#/) { 
     557                        # Likely debug output from munin-run 
     558                        print "# munin-run says: $_\n" if $debug; 
     559                    } else { 
     560                        # Something else 
     561                        push(@errors,"Got from $plug: $_"); 
     562                        print "# Got junk: $_\n" if $debug; 
     563                        $gotjunk=1; 
     564                    } 
     565                } 
     566 
     567                $ps->{$plug}->{'defaultreason'}=join(' ',@pr); 
     568 
     569                # Do we have a yes? 
     570                if ($ps->{$plug}->{'defaultreason'} =~ m/yes/) { 
     571                    $ps->{$plug}->{'default'} = "yes" 
     572                } else { 
     573                    $ps->{$plug}->{'default'} = "no" 
     574                } 
     575            } 
     576            close (PLUG); 
     577            my $pluges   = $?; 
     578            my $plugexit = $?>>8; 
     579            my $plugsig  = $? & 127; 
     580 
     581            # Override to no if there were errors. 
     582            if ($pluges and !$exiterror) { 
     583                push(@errors, 
     584                     "Non-zero exit value from $plug: $plugexit/$plugsig"); 
     585                print "# Non-zero exit value from $plug: $plugexit/$plugsig\n" 
     586                  if $debug; 
     587            } 
     588            if ($? or $gotjunk) { 
     589                $ps->{$plug}->{'default'} = "no"; 
     590            } 
     591            print "# ",$ps->{$plug}->{'default'} if $debug; 
     592        } 
     593 
     594        if ($ps->{$plug}->{'capability'}->{'suggest'}) { 
     595 
     596            my @sugg = (); 
     597 
     598            if (exists $ps->{$plug}->{'default'} and 
     599                $ps->{$plug}->{'default'} eq "yes") { 
     600 
     601                my @cmd=("$bindir/munin-run"); 
     602                # Debug here breaks stuff. 
     603                # push(@cmd,$debugopt) if $debug; 
     604                push(@cmd,"--servicedir",$libdir, $plug, "suggest"); 
     605 
     606                print "\n# Running: ",join(' ',@cmd),"\n" if $debug; 
     607 
     608                my $fork = open (PLUG, "-|"); 
     609 
     610                if ($fork == -1) { 
     611                    die "ERROR: Unable to fork: $!\n" 
     612                } elsif ($fork == 0) { # Child 
     613                    # We would redirect stderr, but with suggest 
     614                    # it's hard to sort errors from the suggestions 
     615                    # as we have no idea what the suggestions might 
     616                    # be. 
     617                    exec (@cmd); 
     618                } else { 
     619                    # Fragile loop, blah blah (se above) 
     620 
     621 
     622                    while (<PLUG>) { 
     623                        chomp; 
     624                        if (m/^#/) { 
     625                            # debug output from munin-run 
     626                            print "# Got junk: $_\n" if $debug; 
     627                        } else { 
     628                            # This ought to be a suggestion. 
     629                            print "# Got suggestion: $_\n" if $debug; 
     630                            push(@sugg,$_); 
    414631                        } 
    415                         elsif ($reached_version) 
    416                         { 
    417                             $reached_version++; 
    418                         } 
    419                     } 
    420                     elsif ($reached_version < 2) 
    421                     { 
    422                         next; 
    423                     } 
    424                     elsif ($line =~ /^([^\/]+)\/(.+)$/) 
    425                     { 
    426                         if ($uname eq $1) 
    427                         { 
    428                             $ps->{$2}->{'version'} = $ver; 
    429                             print "-- Adding plugin \"$2\" to version tree ($ver)...\n" if $debug; 
    430                         } 
    431                     } 
    432                     elsif ($line =~ /^(.+)$/) 
    433                     { 
    434                         $ps->{$1}->{'version'} = $ver; 
    435                         print "-- Adding plugin \"$1\" to version tree ($ver)...\n" if $debug; 
    436                     } 
    437                 } 
    438             } 
    439             else 
    440             { 
    441                 warn "Warning: Could not open \"$dir/plugins.history\": $!"; 
    442             } 
    443         } 
    444  
    445         print "DEBUG: Opening \"$dir\" for reading...\n" if $debug; 
    446         opendir (DIR, $dir) or die "Could not open \"$dir\" for reading: $!"; 
    447         my @plugins = readdir (DIR); 
    448         close (DIR); 
    449  
    450         foreach my $plug (@plugins) 
    451         { 
    452                 my $path = "$dir/$plug"; 
    453                 $path = readlink($path) and $path = $path =~ /^\// ? $path : "$dir/$path" while -l $path; 
    454                 next unless -f $path; 
    455                 next unless -x _; 
    456  
    457                 next if $plug =~ /^\./; 
    458  
    459                 $ps->{$plug}->{'family'} = "contrib"; # Set default family... 
    460  
    461                 print "DEBUG: Checking plugin: $plug..." if $debug; 
    462                 if (! open (FILE, "$dir/$plug")) 
    463                 { 
    464                         warn "WARNING: Could not open file \"$dir/$plug\" for reading ($!). Skipping."; 
    465                         next; 
    466                 } 
    467                 while (<FILE>) 
    468                 { 
    469                         chomp; 
    470                         if (/#%#\s+family\s*=\s*(\S+)\s*$/) 
    471                         { 
    472                                 $ps->{$plug}->{'family'} = $1; 
    473                                 print "$1..." if $debug; 
    474                         } 
    475                         elsif (/#%#\s+capabilities\s*=\s*(.+)$/) 
    476                         { 
    477                                 foreach my $cap (split (/\s+/, $1)) 
    478                                 { 
    479                                         $ps->{$plug}->{'capability'}->{$cap} = 1; 
    480                                         print "$cap..." if $debug; 
    481                                 } 
    482                         } 
    483                 } 
    484                 close (FILE); 
    485  
    486                 unless (grep (/^$ps->{$plug}->{'family'}$/, @families)) { 
    487                         print "\n" if $debug; 
    488                         next; 
    489                 } 
    490                 if ($ps->{$plug}->{'family'} eq "auto" and defined $newer and 
    491                         !defined $ps->{$plug}->{'version'}) { 
    492                         print "\n" if $debug; 
    493                         next; 
    494                 } 
    495  
    496                 if ($ps->{$plug}->{'capability'}->{'autoconf'}) 
    497                 { 
    498                         my $fork = open (PLUG, "-|"); 
    499  
    500                         if ($fork == -1) 
    501                         { 
    502                                 die "ERROR: Unable to fork: $!" 
    503                         } 
    504                         elsif ($fork == 0) # Child 
    505                         { 
    506                                 close (STDERR); 
    507                                 open (STDERR, ">&STDOUT"); 
    508                                 exec ("$bindir/munin-run", "--servicedir", $libdir, $plug, "autoconf"); 
    509                         } 
    510                         else 
    511                         { 
    512                                 $ps->{$plug}->{'defaultreason'} = join (' ', map {chomp; $_} <PLUG>); 
    513                         } 
    514                         close (PLUG); 
    515                         if ($?) 
    516                         { 
    517                                 $ps->{$plug}->{'default'} = "no"; 
    518                         } 
    519                         else 
    520                         { 
    521                                 $ps->{$plug}->{'default'} = "yes"; 
    522                         } 
    523                         print $ps->{$plug}->{'default'}, ":", $ps->{$plug}->{'defaultreason'}, "..." if $debug; 
    524                 } 
    525  
    526                 if ($ps->{$plug}->{'capability'}->{'suggest'}) 
    527                 { 
    528                         if (exists $ps->{$plug}->{'default'} and 
    529                                         $ps->{$plug}->{'default'} eq "yes") 
    530                         { 
    531                                 my $fork = open (PLUG, "-|"); 
    532  
    533                                 if ($fork == -1) 
    534                                 { 
    535                                         die "ERROR: Unable to fork: $!" 
    536                                 } 
    537                                 elsif ($fork == 0) # Child 
    538                                 { 
    539                                         exec ("$bindir/munin-run", "--servicedir", $libdir, $plug, "suggest"); 
    540                                 } 
    541                                 else 
    542                                 { 
    543                                         push (@{$ps->{$plug}->{'suggest'}}, split (/\s+/, join (' ', map {chomp; $_} <PLUG>))); 
    544                                 } 
    545                                 close (PLUG); 
    546                                 if ($?) 
    547                                 { 
    548                                         $ps->{$plug}->{'suggest'} = ""; 
    549                                 } 
    550                                 print join (' ', @{$ps->{$plug}->{'suggest'}}) if $debug; 
    551  
    552                         } 
    553                 } 
    554  
    555                 print "\n" if $debug; 
    556         } 
    557         return $ps; 
     632                    } 
     633                } 
     634                close (PLUG); 
     635                if ($?) { 
     636                    @sugg = (); 
     637                    print "# Plugin exit code: $? - voiding suggestions\n" 
     638                        if $debug; 
     639                } 
     640 
     641                @{$ps->{$plug}->{'suggest'}} = @sugg; 
     642 
     643                if ($debug) { 
     644                    print "# Suggested: ", 
     645                      join (' ', @{$ps->{$plug}->{'suggest'}}),"\n"; 
     646                     
     647                    print "# ERROR: empty suggest from $plug\n" 
     648                        if !@sugg; 
     649                } 
     650 
     651                push(@errors,"ERROR: empty suggest from $plug") 
     652                    unless @sugg; 
     653            } 
     654        } 
     655        print "\n" if $debug; 
     656    } 
     657    #   print Dumper $ps; 
     658    return $ps; 
    558659} 
    559660 
     
    582683=item B<< --debug >> 
    583684 
    584 View debug information (very verbose) 
     685Print debug information (very verbose).  All debugging output is 
     686printed on STDOUT but each line is prefixed with '#'.  Only errors are 
     687printed on STDERR. 
    585688 
    586689=item B<< --config <file> >> 
     
    653756=head1 AUTHORS 
    654757 
    655 Jimmy Olsen. 
     758Jimmy Olsen, Nicolai Langfeldt 
    656759 
    657760=head1 BUGS 
     
    661764=head1 COPYRIGHT 
    662765 
    663 Copyright © 2003 Jimmy Olsen 
     766Copyright (C) 2003-2006 Jimmy Olsen, Nicolai Langfeldt. 
    664767 
    665768This is free software; see the source for copying conditions. There is 
  • people/ilmari/modularisation-branch/node/munin-node-simple.in

    r1045 r1265  
    2929$| = 1; 
    3030 
    31 my $clientdir = "@@CONFIDR@@/node.d"; 
    32 my $conffile  = "@@CONFIDR@@/node-simple.conf"; 
     31my $clientdir = "@@CONFDIR@@/node.d"; 
     32my $conffile  = "@@CONFDIR@@/node-simple.conf"; 
    3333my $version   = "@@VERSION@@"; 
    3434 
  • people/ilmari/modularisation-branch/node/munin-node.conf.in

    r864 r1265  
    3636allow ^127\.0\.0\.1$ 
    3737 
     38# uncomment this to only listen on the loopback/localhost interface 
     39# 
     40# host 127.0.0.1 
     41 
  • people/ilmari/modularisation-branch/node/munin-node.conf.pod

    r864 r1265  
    1515by using the module. 
    1616 
    17 Additional options: 
     17The following options are of special interest: 
     18 
     19=over 5 
     20 
     21=item B<< allow RE >> 
     22 
     23IP based access list is implemented through this. The statement may be 
     24repeated many times.  It's important to note that it's actually a 
     25regular expression after the keyword so to allow localhost it must be 
     26written like this: 
     27 
     28      allow ^127\.0\.0\.1$ 
     29 
     30=item B<< host IP >> 
     31 
     32The IP number of the interface munin-node should listen on.  By 
     33default munin-node listens to all interfaces.  To make munin-node 
     34listen only on the localhost interface - making it unavailable from 
     35the network do this: 
     36 
     37      host 127.0.0.1 
     38 
     39=back 
     40 
     41=head2 Additional options: 
    1842 
    1943=over 5 
     
    7094=head1 COPYRIGHT 
    7195 
    72 Copyright © 2002-2004 Audun Ytterdal and Jimmy Olsen / Linpro AS. 
     96Copyright (C) 2002-2006 Audun Ytterdal, Jimmy Olsen, Dagfin Ilmari 
     97Mansåker, Nicolai Langfeldt 
    7398 
    7499This is free software; see the source for copying conditions. There is NO 
  • people/ilmari/modularisation-branch/node/munin-node.in

    r1045 r1265  
    11#!@@PERL@@ -wT 
     2# -*- cperl -*- 
    23# 
    34# Copyright (C) 2002-2006 Audun Ytterdal, Jimmy Olsen, Tore Anderson, 
     
    4546$0 = $1; 
    4647 
     48# Make configuration settings available at runtime. 
     49$ENV{'MUNIN_PREFIX'}     = '@@PREFIX@@'; 
     50$ENV{'MUNIN_CONFDIR'}    = '@@CONFDIR@@';   # /etc/munin,/etc/opt/munin or such 
     51$ENV{'MUNIN_BINDIR'}     = '@@BINDIR@@'; 
     52$ENV{'MUNIN_SBINDIR'}    = '@@SBINDIR@@'; 
     53$ENV{'MUNIN_DOCDIR'}     = '@@DOCDIR@@'; 
     54$ENV{'MUNIN_LIBDIR'}     = '@@LIBDIR@@';    # LIBDIR/plugins contains plugin.sh 
     55$ENV{'MUNIN_HTMLDIR'}    = '@@HTMLDIR@@'; 
     56$ENV{'MUNIN_CGIDIR'}     = '@@CGIDIR@@'; 
     57$ENV{'MUNIN_DBDIR'}      = '@@DBDIR@@'; 
     58$ENV{'MUNIN_PLUGSTATE'}  = '@@PLUGSTATE@@'; # Put plugin state files here! 
     59$ENV{'MUNIN_MANDIR'}     = '@@MANDIR@@'; 
     60$ENV{'MUNIN_LOGDIR'}     = '@@LOGDIR@@'; 
     61$ENV{'MUNIN_STATEDIR'}   = '@@STATEDIR@@';  # This is for .pid files 
     62$ENV{'MUNIN_USER'}       = '@@USER@@';      # User munin runs as (mostly) 
     63$ENV{'MUNIN_GROUP'}      = '@@GROUP@@';     # Group ditto 
     64$ENV{'MUNIN_PLUGINUSER'} = '@@PLUGINUSER@@';# Default user for plugin running 
     65$ENV{'MUNIN_VERSION'}    = '@@VERSION@@'; 
     66$ENV{'MUNIN_PERL'}       = '@@PERL@@'; 
     67$ENV{'MUNIN_PERLLIB'}    = '@@PERLLIB@@'; 
     68$ENV{'MUNIN_GOODSH'}     = '@@GOODSH@@'; 
     69$ENV{'MUNIN_BASH'}       = '@@BASH@@'; 
     70$ENV{'MUNIN_PYTHON'}     = '@@PYTHON@@'; 
     71$ENV{'MUNIN_OSTYPE'}     = '@@OSTYPE@@'; 
     72$ENV{'MUNIN_HOSTNAME'}   = '@@HOSTNAME@@'; 
     73$ENV{'MUNIN_MKTEMP'}     = '@@MKTEMP@@'; 
     74 
    4775@ISA = qw(Net::Server::Fork); 
    4876my @ORIG_ARGV = @ARGV; 
    4977my %services; 
    5078my %nodes; 
    51 my $servicedir="$CONFDIR/plugins"; 
    52 my $sconfdir="$CONFDIR/plugin-conf.d"; 
    53 my $conffile="$CONFDIR/munin-node.conf"; 
     79my $servicedir="@@CONFDIR@@/plugins"; 
     80my $sconfdir="@@CONFDIR@@/plugin-conf.d"; 
     81my $conffile="@@CONFDIR@@/munin-node.conf"; 
    5482my $FQDN=""; 
    5583my $do_usage = 0; 
     
    5785my $do_version = 0; 
    5886my $VERSION=$Muninnode::VERSION; 
    59 my $defuser = getpwnam ($PLUGINUSER); 
    60 my $defgroup= getgrnam ($GROUP); 
     87my $defuser = getpwnam ("@@PLUGINUSER@@"); 
     88my $defgroup= getgrnam ("@@GROUP@@"); 
    6189my $paranoia= 0; 
    6290my @ignores = (); 
     
    184212 
    185213MyPackage->run(conf_file => $conffile, 
    186                pid_file => "$STATEDIR/munin-node.pid"); 
     214               pid_file => "@@STATEDIR@@/munin-node.pid"); 
    187215exit; 
    188216 
     
    213241    my $hostname; 
    214242    eval { 
    215         require Net::Domain
    216         $hostname = Net::Domain::hostfqdn()
     243        require Sys::Hostname
     244        $hostname = (gethostbyname(Sys::Hostname::hostname()))[0]
    217245    }; 
    218246    return $hostname if $hostname; 
     
    285313sub list_services { 
    286314    my $node = $_[0] || $FQDN; 
    287     net_write join " ", grep { &has_access ($_); } keys %{$nodes{$node}} if exists $nodes{$node}; 
     315    net_write( join( " ", 
     316                     grep( { &has_access ($_); } keys %{$nodes{$node}} ) 
     317                     ) ) 
     318      if exists $nodes{$node}; 
    288319    #print join " ", keys %{$nodes{$node}}; 
    289320    net_write ("\n"); 
     
    542573      $key = &get_var (\%sconf, "tls_private_key") 
    543574          unless defined $key; 
    544       $key = "$CONFDIR/munin-node.pem" unless defined $key; 
     575      $key = "@@CONFDIR@@/munin-node.pem" unless defined $key; 
    545576      $cert = &get_var (\%sconf, "tls_certificate") 
    546577          unless defined $cert; 
    547       $cert = "$CONFDIR/munin-node.pem" unless defined $cert; 
     578      $cert = "@@CONFDIR@@/munin-node.pem" unless defined $cert; 
    548579      $mode = &get_var (\%sconf, 'tls'); 
    549580      $mode = "auto" unless defined $mode and length $mode; 
     
    927958        elsif (/^\s*env\s+([^=\s]+)\s*=\s*(.+)$/) 
    928959        { 
     960            # $sconf->{$service}{'env'}{$1} = $2; 
     961            # net_write ("Saving $service->env->$1 = $2...\n") if $DEBUG; 
     962            warn "Warning: Deprecated format in \"$dir/$file\" under \"[$service]\" (\"env $1=$2\" should be rewritten to \"env.$1 $2. Ignored.\")."; 
     963        } 
     964        elsif (/^\s*env\.(\S+)\s+(.+)$/) 
     965        { 
    929966            $sconf->{$service}{'env'}{$1} = $2; 
    930967            net_write ("Saving $service->env->$1 = $2...\n") if $DEBUG; 
    931             warn "Warning: Deprecated format in \"$dir/$file\" under \"[$service]\" (\"env $1=$2\" should be rewritten to \"env.$1 $2\")."; 
    932         } 
    933         elsif (/^\s*env\.(\S+)\s+(.+)$/) 
    934         { 
    935             $sconf->{$service}{'env'}{$1} = $2; 
    936             net_write ("Saving $service->env->$1 = $2...\n") if $DEBUG; 
    937968        } 
    938969        elsif (/^\s*(\w+)\s+(.+)$/) 
    939970        { 
    940             $sconf->{$service}{'env'}{"lrrd_$1"} = $2; 
    941             net_write ("Saving $service->env->lrrd_$1 = $2...\n") if $DEBUG; 
    942             warn "Warning: Deprecated format in \"$dir/$file\" under \"[$service]\" (\"$1 $2\" should be rewritten to \"env lrrd_$1=$2\")."; 
     971            # $sconf->{$service}{'env'}{"lrrd_$1"} = $2; 
     972            # net_write ("Saving $service->env->lrrd_$1 = $2...\n") if $DEBUG; 
     973            warn "Warning: Deprecated format in \"$dir/$file\" under \"[$service]\" (\"$1 $2\" should be rewritten to \"env.$1 $2. Ignored.\")."; 
    943974        } 
    944975        elsif (/\S/) 
  • people/ilmari/modularisation-branch/node/munin-run.in

    r1264 r1265  
    11#!@@PERL@@ -wT 
    2 
    3 # Copyright (C) 2004 Jimmy Olsen 
     2# -*- perl -*- 
     3 
     4# Copyright (C) 2004-2006 
    45# 
    56# This program is free software; you can redistribute it and/or 
     
    1617# along with this program; if not, write to the Free Software 
    1718# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
    18 # 
    1919# 
    2020# $Id$ 
     
    2929foreach my $key (keys %ENV) 
    3030{ 
    31         if ($ENV{$key} =~ /^(.*)$/) 
    32         { 
     31        if ($ENV{$key} =~ /^(.*)$/) { 
    3332            $ENV{$key} = $1; 
    34         } 
    35         else  
    36         { 
     33        } else { 
    3734            delete $ENV{$key}; 
    3835        } 
     
    5148               help)) 
    5249  or $config->{help} = 1; 
     50 
     51$0 =~ /^(.*)$/; # for some strange reason won't "$0 = $0;" work. 
     52$0 = $1; 
     53 
     54# Make configuration settings available at runtime. 
     55$ENV{'MUNIN_PREFIX'}     = '@@PREFIX@@'; 
     56$ENV{'MUNIN_CONFDIR'}    = '@@CONFDIR@@';   # /etc/munin,/etc/opt/munin or such 
     57$ENV{'MUNIN_BINDIR'}     = '@@BINDIR@@'; 
     58$ENV{'MUNIN_SBINDIR'}    = '@@SBINDIR@@'; 
     59$ENV{'MUNIN_DOCDIR'}     = '@@DOCDIR@@'; 
     60$ENV{'MUNIN_LIBDIR'}     = '@@LIBDIR@@';    # LIBDIR/plugins contains plugin.sh 
     61$ENV{'MUNIN_HTMLDIR'}    = '@@HTMLDIR@@'; 
     62$ENV{'MUNIN_CGIDIR'}     = '@@CGIDIR@@'; 
     63$ENV{'MUNIN_DBDIR'}      = '@@DBDIR@@'; 
     64$ENV{'MUNIN_PLUGSTATE'}  = '@@PLUGSTATE@@'; # Put plugin state files here! 
     65$ENV{'MUNIN_MANDIR'}     = '@@MANDIR@@'; 
     66$ENV{'MUNIN_LOGDIR'}     = '@@LOGDIR@@'; 
     67$ENV{'MUNIN_STATEDIR'}   = '@@STATEDIR@@';  # This is for .pid files 
     68$ENV{'MUNIN_USER'}       = '@@USER@@';      # User munin runs as (mostly) 
     69$ENV{'MUNIN_GROUP'}      = '@@GROUP@@';     # Group ditto 
     70$ENV{'MUNIN_PLUGINUSER'} = '@@PLUGINUSER@@';# Default user for plugin running 
     71$ENV{'MUNIN_VERSION'}    = '@@VERSION@@'; 
     72$ENV{'MUNIN_PERL'}       = '@@PERL@@'; 
     73$ENV{'MUNIN_PERLLIB'}    = '@@PERLLIB@@'; 
     74$ENV{'MUNIN_GOODSH'}     = '@@GOODSH@@'; 
     75$ENV{'MUNIN_BASH'}       = '@@BASH@@'; 
     76$ENV{'MUNIN_PYTHON'}     = '@@PYTHON@@'; 
     77$ENV{'MUNIN_OSTYPE'}     = '@@OSTYPE@@'; 
     78$ENV{'MUNIN_HOSTNAME'}   = '@@HOSTNAME@@'; 
     79$ENV{'MUNIN_MKTEMP'}     = '@@MKTEMP@@'; 
     80 
    5381 
    5482if ($config->{help}) 
     
    137165=item B< --debug > 
    138166 
    139 View debug messages. 
     167Print debug messages.  Debug messages are sent to both STDOUT and are 
     168prefixed with "#" (this makes it easier for other parts of munin to 
     169use munin-run and still have --debug on).  Only errors go to STDERR. 
    140170 
    141171=item B< --version > 
     
    147177=head1 DESCRIPTION 
    148178 
    149 Munin's node is a daemon that Munin connects to fetch data. This data is 
    150 stored in .rrd-files, and later graphed and htmlified. It's designed to 
    151 let it be very easy to graph new datasources. 
    152  
    153 munin-run is a small perlscript to run the plugins used by the munin-node 
    154 daemon from the command line. 
    155  
    156 For more information, see the documentation section at L<http://munin.sf.net/>. 
     179Munin-node is a daemon that Munin connects to fetch data.  This data 
     180is stored in .rrd-files on the central server , and later graphed and 
     181htmlified. 
     182 
     183munin-run is a perlscript to run the plugins used by the munin-node 
     184daemon from the command line.  It's helpful to debug plugins as they 
     185are run the same way with the same user and same environment settings 
     186as within the munin-node. 
     187 
     188For more information, see the documentation section at 
     189L<http://munin.sf.net/>. 
    157190 
    158191=head1 FILES 
     
    170203=head1 AUTHORS 
    171204 
    172 Audun Ytterdal, Jimmy Olsen, and Tore Anderson. 
     205Audun Ytterdal, Jimmy Olsen, Tore Anderson, Nicolai Langfeldt, 
     206Dagfinn Ilmari MannsÃ¥ker. 
    173207 
    174208=head1 BUGS 
     
    180214=head1 COPYRIGHT 
    181215 
    182 Copyright © 2002 Audun Ytterdal, Jimmy Olsen, and Tore Anderson / Linpro AS. 
     216Copyright (C) 2002-2006 Audun Ytterdal, Jimmy Olsen, Tore Anderson, 
     217Nicolai Langfeldt, Dagfinn Ilmari MannsÃ¥ker / Linpro AS. 
    183218 
    184219This is free software; see the source for copying conditions. There is 
  • people/ilmari/modularisation-branch/node/node.d.aix/cpu.in

    r1012 r1265  
    6161    print "graph_vlabel %\n"; 
    6262    print "graph_scale no\n"; 
     63    print "graph_category system\n"; 
    6364    print "system.label system\n"; 
    6465    print "system.type GAUGE\n"; 
  • people/ilmari/modularisation-branch/node/node.d.aix/df.in

    r1012 r1265  
    2424#%# capabilities=autoconf 
    2525 
    26  
    27  
    28  
    2926if [ "$1" = "autoconf" ]; then 
    3027        echo yes 
     
    3734        echo 'graph_args --upper-limit 100 -l 0' 
    3835        echo 'graph_vlabel %' 
     36        echo 'graph_category disk' 
     37        echo 'graph_scale no' 
    3938        df -P -k | sed 1d | grep -v "//" | grep -v "nfs" | while read i; do 
    4039                name=`echo $i | sed 's/[\/.-]/_/g'| awk '{ print $6 }'` 
  • people/ilmari/modularisation-branch/node/node.d.aix/iostat.in

    r1012 r1265  
    6161    print "graph_args --base 1024 -l 0\n"; 
    6262    print "graph_vlabel KB / \${graph_period}\n"; 
     63    print "graph_category disk\n"; 
    6364    my(@info) = getDiskIO("disk only"); 
    6465    my($line); 
  • people/ilmari/modularisation-branch/node/node.d.aix/memory.in

    r1012 r1265  
    6262    print "graph_title Memory usage\n"; 
    6363    print "graph_order inuse free pinned swap\n"; 
     64    print "graph_category system\n"; 
    6465    print "inuse.label inuse\n"; 
    6566    print "inuse.draw AREA\n"; 
  • people/ilmari/modularisation-branch/node/node.d.aix/netstat.in

    r1012 r1265  
    4646    print "graph_args -l 0 --base 1000\n"; 
    4747    print "graph_vlabel requests connections per \${graph_period}\n"; 
     48    print "graph_category network\n"; 
    4849    print "requests.label requests\n"; 
    4950    print "requests.type COUNTER\n"; 
  • people/ilmari/modularisation-branch/node/node.d.aix/processes.in

    r1012 r1265  
    5555    print "graph_args --base 1000 -l 0 \n"; 
    5656    print "graph_vlabel number of processes\n"; 
     57    print "graph_category processes\n"; 
    5758    print "global.label global\n"; 
    5859    print "global.draw LINE2\n"; 
  • people/ilmari/modularisation-branch/node/node.d.aix/swap.in

    r1012 r1265  
    5151    print "graph_title Swap usage\n"; 
    5252    print "graph_order used total\n"; 
     53    print "graph_category system\n"; 
    5354    print "used.label used\n"; 
    5455    print "used.draw STACK\n"; 
  • people/ilmari/modularisation-branch/node/node.d.freebsd/df.in

    r1012 r1265  
    1414#%# capabilities=autoconf 
    1515 
    16 MAXLABEL=20 
    17  
    1816if [ "$1" = "autoconf" ]; then 
    1917        echo yes 
     
    2725        echo 'graph_vlabel %' 
    2826        echo 'graph_category disk' 
     27        echo 'graph_scale no' 
    2928        echo 'graph_info This graph shows disk usage on the machine.' 
    3029        mfs=0 
     
    3534                esac 
    3635                echo -n "$name.label " 
    37                 echo $i | awk "{ 
    38                         dir=\$6; 
    39                         if (length(dir) <= $MAXLABEL) 
    40                                 print dir 
    41                         else 
    42                                 printf (\"...%s\n\", substr (dir, length(dir)-$MAXLABEL+4, $MAXLABEL-3)) 
    43                         print \"$name.info \" \$6 \" -> \" \$1; 
    44                         }" 
     36                echo $i | awk '{ print $6 }' 
    4537                echo "$name.warning 92" 
    4638                echo "$name.critical 98" 
  • people/ilmari/modularisation-branch/node/node.d.freebsd/df_inode.in

    r1012 r1265  
    1313#%# family=auto 
    1414#%# capabilities=autoconf 
    15  
    16 MAXLABEL=20 
    1715 
    1816print_values() { 
     
    4341        echo 'graph_vlabel %' 
    4442        echo 'graph_category disk' 
     43        echo 'graph_scale no' 
    4544        echo 'graph_info This graph shows the inode usage for the partitions of types that use inodes.' 
    4645        /bin/df -P -i -t noprocfs,devfs,fdescfs,linprocfs,nfs | tail +2 | grep -v "//" | awk " 
     
    5756                                gsub(/[^a-zA-Z0-9_]/, \"_\", name) 
    5857                        } 
    59                         if (length(dir) <= $MAXLABEL) 
    60                                 print name \".label \" dir 
    61                         else 
    62                                 printf (\"%s.label ...%s\n\", name, substr (dir, length(dir)-$MAXLABEL+4, $MAXLABEL-3)) 
     58                        print name \".label \" dir 
    6359                        print name \".info \" dir \" -> \" \$1 
    6460                        print name \".warning 92\" 
  • people/ilmari/modularisation-branch/node/node.d.freebsd/if_.in

    r1012 r1265  
    77# 
    88# ...will monitor eth0. 
     9# 
     10# To aggregate all network interfaces on the system (except lo0),  
     11# link if_aggregated to this file. 
    912# 
    1013# Any device found in /usr/bin/netstat can be monitored. 
     
    5659        echo "obytes.info Traffic sent (+) and received (-) on the $INTERFACE network interface." 
    5760        exit 0 
    58 fi; 
     61fi 
    5962 
    60 /usr/bin/netstat -i -b -I $INTERFACE | awk ' 
     63if [ "$INTERFACE" = "aggregated" ]; then 
     64        /usr/bin/netstat -i -b | grep -v '^lo' | awk ' 
     65BEGIN { rsum = 0; osum = 0; } 
     66/<Link#[0-9]*>/ { 
     67        if (NF == 10) {  
     68                rsum += $6; osum += $9; 
     69        } else { 
     70                rsum += $7; osum += $10; 
     71        } 
     72
     73END { 
     74        printf "rbytes.value %i\n", rsum; 
     75        printf "obytes.value %i\n", osum; 
     76}' 
     77   
     78else 
     79        /usr/bin/netstat -i -b -I $INTERFACE | awk ' 
    6180/<Link#[0-9]*>/ { 
    6281        if (NF == 10) {  
     
    6887        } 
    6988}' 
     89fi 
  • people/ilmari/modularisation-branch/node/node.d.linux/apt.in

    r1012 r1265  
    163163                } 
    164164        } 
    165         if (/^\d+\s(?:packages )?upgraded,\s\d+\snewly installed, \d+ to remove and (\d+)\s+not upgraded/) 
    166         { 
     165        if (/^\d+\supgraded,\s\d+\snewly installed, \d+ to remove and (\d+) not upgraded/) { 
    167166                $hold = $1; 
    168167        } 
  • people/ilmari/modularisation-branch/node/node.d.linux/apt_all.in

    r1012 r1265  
    119119                            } 
    120120                    } 
    121                     if (/^\d+\spackages upgraded,\s\d+\snewly installed, \d+ to remove and (\d+) not upgraded/) 
     121                    if (/^\d+\supgraded,\s\d+\snewly installed, \d+ to remove and (\d+) not upgraded/) 
    122122                    { 
    123123                            $hold = $1; 
  • people/ilmari/modularisation-branch/node/node.d.linux/cpu.in

    r1045 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to monitor CPU usage. 
     
    2727# 
    2828# $Id$ 
    29  
    3029 
    3130if [ "$1" = "autoconf" ]; then 
     
    108107                echo "iowait.max $MAX" 
    109108                echo 'iowait.type DERIVE' 
    110                 echo 'iowait.info CPU time spent waiting for I/O operations to finish
     109                echo 'iowait.info CPU time spent waiting for I/O operations to finish when there is nothing else to do.
    111110                echo 'irq.label irq' 
    112111                echo 'irq.draw STACK' 
     
    130129fi 
    131130 
     131# Note: Counters/derive need to report integer values.  Also we need 
     132# to avoid 10e+09 and the like %.0f should do this. 
    132133 
    133134if [ ! -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 
     135        awk -v hz=$HZ '/^cpu / { printf "user.value %.0f\nnice.value %.0f\nsystem.value %.0f\nidle.value %.0f\niowait.value %.0f\nirq.value %.0f\nsoftirq.value %.0f\n", $2*100/hz, $3*100/hz, $4*100/hz, $5*100/hz, $6*100/hz, $7*100/hz, $8*100/hz }' < /proc/stat 
    135136else 
    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 
     137        awk -v hz=$HZ '/^cpu / { printf "user.value %.0f\nnice.value %.0f\nsystem.value %.0f\nidle.value %.0f\n", $2*100/hz, $3*100/hz, $4*100/hz, $5*100/hz }' < /proc/stat 
    137138fi 
  • people/ilmari/modularisation-branch/node/node.d.linux/cpuspeed.in

    r1045 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to monitor CPU speed 
     
    2929if [ "$1" = "config" ]; then 
    3030    cat <<EOF 
    31 graph_title CPU frequency scaling' 
     31graph_title CPU frequency scaling 
    3232graph_args --base 1000 -r --lower-limit 0 
    3333graph_vlabel Hz 
    3434graph_scale yes 
    35 This graph shows at what speeds the CPUs are running 
     35graph_info This graph shows at what speeds the CPUs are running 
    3636graph_category system 
    3737EOF 
     
    3939for c in /sys/devices/system/cpu/cpu*; do 
    4040    N=${c##*/cpu} 
    41     MAXHZ=$(<$c/cpufreq/cpuinfo_max_freq) 
     41    MAXHZ=$(cat $c/cpufreq/cpuinfo_max_freq) 
    4242    cat <<EOF 
    4343cpu$N.label CPU $N 
    4444cpu$N.max $MAXHZ 
    45 cpu$N.min $(<$c/cpufreq/cpuinfo_min_freq) 
     45cpu$N.min $(cat $c/cpufreq/cpuinfo_min_freq) 
    4646cpu$N.type GAUGE 
    4747EOF 
     
    5656for c in /sys/devices/system/cpu/cpu*; do 
    5757    N=${c##*/cpu} 
    58     echo "cpu$N.value $(<$c/cpufreq/scaling_cur_freq)" 
     58    echo "cpu$N.value $(cat $c/cpufreq/scaling_cur_freq)" 
    5959done 
  • people/ilmari/modularisation-branch/node/node.d.linux/df.in

    r1045 r1265  
    1 #!/usr/bin/perl 
     1#!@@PERL@@ 
     2# -*- perl -*- 
    23# 
    34# Plugin to monitor disk usage. Rewrite based on original shell-based version 
    4 #  
     5# 
    56# Parameters understood: 
    67# 
     
    89#       autoconf (optional - used by munin-config) 
    910# 
    10 # $Log$ 
     11# Environment 
     12#       exclude: space separated list if fs types to exclude. 
     13#                iso9660 by default 
     14
     15# $Id$ 
    1116# 
    1217# Magic markers (optional - used by munin-config and installation 
     
    1722 
    1823use strict; 
     24use Munin::Plugin; 
    1925 
    20 my $MAXLABEL=25
     26my %mounts
    2127 
    22 # Read /proc/mounts 
    23 my %mounts; 
    2428open (MOUNTS,"/proc/mounts") or die "Could not /proc/mounts for reading."; 
    2529while (<MOUNTS>) { 
     
    3135close MOUNTS; 
    3236 
     37my $exclude=$ENV{'exclude'} || 'iso9660'; 
     38my $dfopts = "-P -l ".join(' -x ',('',split('\s+',$exclude))); 
     39 
    3340sub print_values() { 
    34      
     41 
    3542    # Read from df 
    36     open (DF,"/bin/df -P -l |") or die "Could not open pipe from /bin/df, $!"; 
     43    open (DF,"df $dfopts |") or die "Could not open pipe from df, $!"; 
    3744    <DF>; # Skip the header 
    3845    while (<DF>) { 
     
    4350            my $fs=$mounts{$6}; 
    4451            my $ps=$5; 
    45             my $name=$1
    46              
     52            my $name=clean_fieldname($1)
     53 
    4754            $ps =~ s/\%//; 
    48             $name =~ s/\//_/g; 
    49             print $name .  ".value  " . $ps . "\n"; 
     55            print $name, ".value ", $ps, "\n"; 
    5056        } 
    5157    } 
    5258    close DF; 
     59    die "Error executing df. Exit code $?\n" if $?; 
    5360} 
    54      
     61 
    5562if ( $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   } 
     63    if (`@@PERL@@ $0` eq "" ) { 
     64        print "no\n"; 
     65        exit 1; 
     66    } else { 
     67        print "yes\n"; 
     68        exit 0; 
     69    } 
    6870} 
    6971 
     
    7476    print "graph_args --upper-limit 100 -l 0\n"; 
    7577    print "graph_vlabel %\n"; 
    76      
     78    print "graph_scale no\n"; 
     79    print "graph_category disk\n"; 
     80 
    7781    # Read from df 
    78     open (DF,"/bin/df -P -l |") or die "Unable to open pipe from /bin/df"; 
     82    open (DF,"df $dfopts |") or die "Unable to open pipe from df: $!"; 
    7983    <DF>; # Skip the header 
    8084    while (<DF>) { 
     
    8589            my $fs=$mounts{$6}; 
    8690            my $dir=$6; 
    87             my $name=$1;  
    88              
     91            my $name=clean_fieldname($1); 
     92 
    8993            # 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              
     94            print $name, ".label ", $dir, "\n"; 
     95 
     96            # FIXME: These ought to be tunable 
    9997            print "$name.warning 92\n"; 
    10098            print "$name.critical 98\n"; 
     
    102100    } 
    103101    close DF; 
     102    die "Error executing df. Exit code $?\n" if $?; 
    104103    exit 0; 
    105104} 
  • people/ilmari/modularisation-branch/node/node.d.linux/df_abs.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Script to monitor absolute disk usage. 
     
    88#       autoconf (optional - used by munin-config) 
    99# 
     10# Environment 
     11#       exclude: space separated list if fs types to exclude. 
     12#                iso9660 by default 
     13# 
    1014# Magic markers (optional - used by munin-config and installation 
    1115# scripts): 
     16# 
     17# $Id$ 
    1218# 
    1319#%# family=manual 
    1420#%# capabilities=autoconf 
    1521 
    16 MAXLABEL=20 
    17 MAXNAME=15 
     22. $MUNIN_LIBDIR/plugins/plugin.sh 
    1823 
    1924if [ "$1" = "autoconf" ]; then 
     
    2227fi 
    2328 
    24 clean_name() { 
    25     echo $1 | sed 's/[\/.-]/_/g; s/^_dev\(_mapper\)\?_//'| awk "{  
    26         if (length(\$1) > $MAXNAME) 
    27                 print substr(\$1, length(\$1)-$MAXNAME+1) 
    28         else 
    29                 print \$1 
    30         }" 
    31 
     29exclude=${exclude:-iso9660} 
     30 
     31exclude=$(echo $exclude | sed -e 's/ +/ -x /g' -e 's/^/-x /') 
    3232 
    3333if [ "$1" = "config" ]; then 
     
    3838        echo 'graph_category disk' 
    3939        echo 'graph_total Total' 
    40         df -P -l -x none -x unknown | sed 1d | grep -v "//" | while read i; do 
    41                 name=`clean_name $i` 
    42                 echo -n "$name.label " 
    43                 echo $i | awk "{  
    44                         dir=\$6 
    45                         if (length(dir) <= $MAXLABEL) 
    46                                 print dir 
    47                         else 
    48                                 printf (\"...%s\n\", substr (dir, length(dir)-$MAXLABEL+4, $MAXLABEL-3))  
    49                 }" 
    50                 echo "$name.cdef $name,1024,*" 
    51                 size=`echo $i | awk '{print $2}'` 
    52                 echo "$name.warning $((size / 100 * 92))" 
    53                 echo "$name.critical $((size / 100 * 98))" 
     40        df -P -l $exclude | sed 1d | grep -v "//" |  
     41           while read dev size used avail cap mnt; do 
     42               name="$(clean_fieldname $dev)" 
     43               echo "$name.label $mnt" 
     44               echo "$name.cdef $name,1024,*" 
     45               echo "$name.warning $((size * 92 / 100))" 
     46               echo "$name.critical $((size * 98 / 100))" 
    5447        done 
    5548        exit 0 
    5649fi 
    5750 
    58 df -P -l -x unknown  -x none| sed 1d | grep -v "//" | while read i; do 
    59         name=`clean_name $i` 
    60         echo -n "$name.value " 
    61         echo $i | awk '{ print $3 }' 
     51df -P -l $exclude | sed 1d | grep -v "//" |  
     52   while read dev size used avail cap mnt; do 
     53        echo "$(clean_fieldname $dev).value $used" 
    6254done 
  • people/ilmari/modularisation-branch/node/node.d.linux/df_inode.in

    r1045 r1265  
    1 #!/usr/bin/perl 
     1#!@@PERL@@ 
     2# -*- perl -*- 
    23# 
    3 # Plugin to monitor inode-usage. Rewrite based on original shell-based version 
    4 #  
     4# Plugin to monitor inode-usage. Rewrite based on original shell-based 
     5# version 
     6
    57# Parameters understood: 
    68# 
     
    810#       autoconf (optional - used by munin-config) 
    911# 
    10 # $Log$ 
     12# Environment 
     13#       exclude: space separated list if fs types to exclude. 
     14#                iso9660 by default 
     15
     16# $Id$ 
    1117# 
    1218# Magic markers (optional - used by munin-config and installation 
     
    1723 
    1824use strict; 
    19  
    20 my $MAXLABEL=25; 
     25use Munin::Plugin; 
    2126 
    2227# Read /proc/mounts 
     
    3136close MOUNTS; 
    3237 
     38my $exclude=$ENV{'exclude'} || 'iso9660'; 
     39my $dfopts = "-P -l -i ".join(' -x ',('',split('\s+',$exclude))); 
     40 
    3341sub print_values() { 
    34      
     42 
    3543    # Read from df 
    36     open (DF,"/bin/df -P -l -i |") or die "Could not open pipe from /bin/df, $!"; 
     44    open (DF,"df $dfopts |") or die "Could not open pipe from df: $!"; 
    3745    <DF>; # Skip the header 
    3846    while (<DF>) { 
     
    4250        if ( /^(\S+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\S+)\s+(\S+)/ ) { 
    4351            my $fs=$mounts{$6}; 
     52            next if $fs eq "reiserfs"; 
     53 
    4454            my $ps=$5; 
    45             my $name=$1; 
    46             next if $fs eq "reiserfs"; 
    47              
     55            my $name=clean_fieldname($1); 
     56 
    4857            $ps =~ s/\%//; 
    49             $name =~ s/\//_/g; 
     58 
    5059            print $name .  ".value  " . $ps . "\n"; 
    5160        } 
    5261    } 
    5362    close DF; 
     63    die "Error executing df. Exit code $?\n" if $?; 
    5464} 
    55      
     65 
    5666if ( $ARGV[0] eq "autoconf" ) { 
    57   if (`perl $0` eq "" ) { 
     67  if (`@@PERL@@ $0` eq "" ) { 
    5868    print "no\n"; 
    5969    exit 1; 
    60   } 
    61   elsif ( `uname -s` eq "SunOS\n" ) { 
    62     print "no\n"; 
    63     exit 1; 
    64   } 
    65   else { 
     70  } else { 
    6671    print "yes\n"; 
    6772    exit 0; 
     
    7580    print "graph_args --upper-limit 100 -l 0\n"; 
    7681    print "graph_vlabel %\n"; 
    77      
     82    print "graph_scale no\n"; 
     83    print "graph_category disk\n"; 
     84 
    7885    # Read from df 
    79     open (DF,"/bin/df -P -l -i  |") or die "Unable to open pipe from /bin/df"; 
     86    open (DF,"df $dfopts |") or die "Unable to open pipe from df: $!"; 
    8087    <DF>; # Skip the header 
    8188    while (<DF>) { 
     
    8592        if ( /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/ ) { 
    8693            my $fs=$mounts{$6}; 
     94            next if $fs eq "reiserfs"; 
     95 
    8796            my $dir=$6; 
    88             my $name=$1;  
    89              
     97            my $name=clean_fieldname($1); 
     98 
    9099            # 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              
     100            print "$name.label $dir\n"; 
    101101            print "$name.warning 92\n"; 
    102102            print "$name.critical 98\n"; 
     
    104104    } 
    105105    close DF; 
     106    die "Error executing df. Exit code $?\n" if $?; 
    106107    exit 0; 
    107108} 
  • people/ilmari/modularisation-branch/node/node.d.linux/entropy.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22#  
    33# Plugin to monitor available entropy 
     
    1111#%# capabilities=autoconf 
    1212 
    13  
    14  
    1513if [ "$1" = "autoconf" ]; then 
    1614        if [ -r /proc/sys/kernel/random/entropy_avail ]; then 
     
    2220        fi 
    2321fi 
    24  
    2522  
    2623if [ "$1" = "config" ]; then 
  • people/ilmari/modularisation-branch/node/node.d.linux/files_.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22#  
    33# Plugin to monitor the number of open files in the system. 
     
    1414#%# capabilities=autoconf 
    1515 
    16  
    17 PROC=`basename $0 | sed 's/^files_//g'` 
    18 TMPFILE="@@PLUGSTATE@@/munin-files_${PROC}.state" 
     16PROC=${0##*/files_} 
     17TMPFILE="$MUNIN_PLUGSTATE/munin-files_${PROC}.state" 
    1918 
    2019if [ "$1" = "autoconf" ]; then 
     
    2322                exit 0 
    2423        else 
    25                 echo no 
     24                echo "no (no lsof)" 
    2625                exit 1 
    2726        fi 
  • people/ilmari/modularisation-branch/node/node.d.linux/forks.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to monitor the number of forks per second on the machine. 
     
    1212#%# family=auto 
    1313#%# capabilities=autoconf 
    14  
    15  
    1614 
    1715if [ "$1" = "autoconf" ]; then 
  • people/ilmari/modularisation-branch/node/node.d.linux/fw_conntrack.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# fw_conntrack: Plugin to monitor the number of tracked connections 
     
    1010#    config 
    1111#    autoconf 
     12# 
     13# NOTE: MUST RUN AS ROOT. 
     14# @@CONFDIR@@/plugin-conf.d/global or other file in that dir must contain: 
     15# [fw*] 
     16#      user root 
    1217# 
    1318# Bugs: 
     
    3136# 
    3237# Magic markers? 
    33 #%# family=manual 
     38#%# family=auto 
    3439#%# capabilities=autoconf 
    3540 
  • people/ilmari/modularisation-branch/node/node.d.linux/fw_forwarded_local.in

    r1045 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to monitor network connections. 
     
    1313# Magic markers (optional - used by munin-config and some installation 
    1414# scripts): 
    15 #%# family=manual 
     15#%# family=auto 
    1616#%# capabilities=autoconf 
    17  
     17
     18# NOTE: MUST RUN AS ROOT. 
     19# @@CONFDIR@@/plugin-conf.d/global or other file in that dir must contain: 
     20# [fw*] 
     21#      user root 
    1822 
    1923 
     
    4246        echo 'forward.label forward' 
    4347        echo 'forward.type GAUGE' 
    44         echo 'forward.max 500''' 
    4548        echo 'local.label local' 
    4649        echo 'local.type GAUGE' 
    47         echo 'local.max 500''' 
    4850        exit 0 
    4951fi 
  • people/ilmari/modularisation-branch/node/node.d.linux/fw_packets.in

    r1012 r1265  
    11#!@@PERL@@ -w 
     2# -*- perl -*- 
    23# 
    34# Plugin to monitor the throuhgput of a firewall. 
     
    1011#       autoconf (optional - used by munin-config) 
    1112# 
     13# NOTE: MUST RUN AS ROOT. 
     14# @@CONFDIR@@/plugin-conf.d/global or other file in that dir must contain: 
     15# [fw*] 
     16#      user root 
     17# 
    1218# Config variables: 
    1319# 
     
    1521# scripts): 
    1622# 
    17 #%# family=manual 
     23#%# family=auto 
    1824#%# capabilities=autoconf 
    1925 
  • people/ilmari/modularisation-branch/node/node.d.linux/if_.in

    r1012 r1265  
    1 #!/bin/sh 
    2 
    3 # Wildcard-plugin to monitor network interfaces. To monitor an 
    4 # interface, link if_<interface> to this file. E.g. 
    5 
     1#!/bin/bash 
     2 
     3# Wildcard-plugin to monitor traffic and errors on network 
     4# interfaces. To monitor an interface, link if_<interface> to this 
     5# file. E.g. 
     6 
    67#    ln -s /usr/share/node/node/plugins-auto/if_ /etc/munin/node.d/if_eth0 
    7 
     8 
    89# ...will monitor eth0. 
    9 
     10 
    1011# Any device found in /proc/net/dev can be monitored. Examples include 
    1112# ipsec*, eth*, irda* and lo. Please note that aliases cannot be 
    1213# monitored with this plugin. 
    13 
     14 
    1415# Magic markers (optional - used by munin-config and some installation 
    1516# scripts): 
    16 
     17 
    1718#%# family=auto 
    1819#%# capabilities=autoconf suggest 
    1920 
     21INTERFACE=${0##*if_} 
    2022 
    21 INTERFACE=`basename $0 | sed 's/^if_//g'` 
     23findspeed () { 
    2224 
    23 if [ "$1" = "autoconf" ]; then 
     25    # Who whould have thought it's so much work to determine the 
     26    # maximum speed of a network interface.  Buckle up! 
     27 
     28    IWLIST="$(type -p iwlist)" 
     29 
     30    WIRELESS=0 
     31    # Do not use interface name to guess technology.  Many many 
     32    # wifi drivers use "eth*" names. 
     33    case $IWLIST in 
     34 
     35        '') 
     36            # Used to use iwconfig to look for "no wireless 
     37            # extentions" message - but this seemed un-needed.  If we 
     38            # don't have iwlist we can't find out if # the interface 
     39            # is wireless 
     40            :;; 
     41        *)  IWO="$($IWLIST $INTERFACE rate 2>&1)" 
     42            case $IWO in 
     43                *no*) :;; 
     44                *) WIRELESS=1;; 
     45            esac 
     46            ;; 
     47    esac 
     48 
     49    SPEED=U 
     50    # Find speed in Mbps. - or not 
     51    case $WIRELESS:$IWLIST in 
     52        0:*) 
     53            ETHTOOL="$(type -p ethtool)" 
     54            if [ -x "$ETHTOOL" ]; then 
     55                SPEED="$($ETHTOOL $INTERFACE | 
     56                         awk '/Speed:/ { gsub(/[^0-9]*/,"",$2); print $2; }')" 
     57                case $SPEED in 
     58                    [0-9]*) :;; # OK 
     59                    *)      SPEED=U;; # Could be "unknown" 
     60                esac 
     61            else 
     62                INSTALL="ethtool" 
     63            fi 
     64            ;; 
     65        1:/*) 
     66            # Current bit rate is not very interesting, it varies too often 
     67            SPEED=$(echo "$IWO" | 
     68                    awk 'BEGIN { RATE=U } 
     69                               { if ($2 == "Mb/s") RATE=$1; }  
     70                         END   { print RATE; }') 
     71 
     72            ;; 
     73        *) 
     74            # Wireless interface, cannot find iwlist 
     75            INSTALL="wireless-tools" 
     76            ;; 
     77    esac 
     78 
     79    MIITOOL="$(type -p mii-tool)" 
     80    case $SPEED:$MIITOOL in 
     81        U:/*) 
     82            SPEED="$($MIITOOL $INTERFACE 2>&1)" 
     83            case $SPEED in 
     84                *1000base*) SPEED=1000;; # as if... 
     85                *100base*)  SPEED=100;; 
     86                *10base*)   SPEED=10;; 
     87                *)          SPEED=U;; 
     88            esac 
     89            ;; 
     90    esac 
     91 
     92    case $SPEED in 
     93        U) echo "up.info Traffic of the $INTERFACE interface. Unable to determine interface speed.  Please install ethtool, wireless-tools (or mii-tool), whatever is apropriate for the interface." 
     94           return;; 
     95    esac 
     96 
     97    BPS=$(( $SPEED * 1000 * 1000 )) 
     98 
     99    cat <<EOF 
     100up.max $BPS 
     101up.info Traffic of the $INTERFACE interface. Maximum speed is $SPEED Mbps. 
     102down.max $BPS 
     103EOF 
     104 
     105    return 
     106
     107 
     108 
     109case $1 in 
     110    autoconf) 
    24111        if [ -r /proc/net/dev ]; then 
    25                echo yes 
    26                exit 0 
     112            echo yes 
     113            exit 0 
    27114        else 
    28                echo "no (/proc/net/dev not found)" 
    29                exit 1 
     115            echo "no (/proc/net/dev not found)" 
     116            exit 1 
    30117        fi 
    31 fi 
     118        ;; 
     119    suggest) 
     120        if [ -r /proc/net/dev ]; then 
     121            awk ' 
     122                /^ *(eth|tap|bond|wlan|ath|ra|sw)[0-9]+:/ { 
     123                   split($0, a, /: */); 
     124                   gsub(/^ +/,"",a[1]); 
     125                   if (($2 > 0) || ($10 > 0)) print a[1]; }' /proc/net/dev 
    32126 
    33 if [ "$1" = "suggest" ]; then 
    34         if [ -r /proc/net/dev ]; then 
    35                 egrep '^ *(eth|wlan|ath|ra)[0-9]+:' /proc/net/dev | cut -f1 -d: | sed 's/ //g' 
    36                 exit 0 
    37         else 
    38                 exit 1 
     127#           egrep '^ *(eth|tap|bond|wlan|ath|ra|sw)[0-9]+:' /proc/net/dev | cut -f1 -d: | sed 's/ //g' 
    39128        fi 
    40 fi 
    41  
    42 if [ "$1" = "config" ]; then 
    43  
     129        exit 0 
     130        ;; 
     131    config) 
     132                        
    44133        echo "graph_order down up"  
    45134        echo "graph_title $INTERFACE traffic" 
     
    56145        echo 'up.negative down' 
    57146        echo 'up.cdef up,8,*' 
    58         case "$INTERFACE" in 
    59                 ath*|wlan*|ra*) 
    60                         echo -n "up.info Traffic of the $INTERFACE interface. Maximum speed is " 
    61                         which iwlist >/dev/null 2>/dev/null || echo "undeterminable (please install iwlist)." 
    62                         iwlist $INTERFACE rate 2>/dev/null | awk '/Current Bit Rate/ { split ($0, arr, "[=:]"); split (arr[2], arr2, "M"); print (arr2[1]*1000000) " bits per second.\nup.max " (arr2[1]*1000000) "\ndown.max "(arr2[1]*1000000); }' 
    63                         ;; 
    64                 *) 
    65                         echo -n "up.info Traffic of the $INTERFACE interface. Maximum speed is " 
    66                         which ethtool >/dev/null 2>/dev/null || echo "undeterminable (please install ethtool)." 
    67                         ethtool $INTERFACE 2>/dev/null | awk '/Speed/ { split ($2, arr2, "M"); print (arr2[1]*1000000) " bits per second.\nup.max " (arr2[1]*1000000) "\ndown.max "(arr2[1]*1000000); }' 
    68                         ;; 
    69         esac 
     147 
     148        findspeed 
     149 
    70150        exit 0 
    71 fi; 
     151        ;; 
     152esac 
    72153 
    73 awk -F '[: \t]+' -v interface="$INTERFACE" \ 
    74     '$1 == interface { print "down.value " $2 "\nup.value " $10; exit } 
    75      $2 == interface { print "down.value " $3 "\nup.value " $11; exit }' \ 
     154# Escape dots in the interface name (eg. vlans) before using it as a regex 
     155awk -v interface="$INTERFACE" \ 
     156    'BEGIN { gsub(/\./, "\\.", interface) } \ 
     157    $1 ~ "^" interface ":" { 
     158        split($0, a, /: */); $0 = a[2]; \ 
     159        print "down.value " $1 "\nup.value " $9 \ 
     160    }' \ 
    76161    /proc/net/dev 
    77162 
  • people/ilmari/modularisation-branch/node/node.d.linux/if_err_.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Wildcard-plugin to monitor network interfaces. To monitor an 
     
    1818#%# capabilities=autoconf suggest 
    1919 
    20 INTERFACE=`basename $0 | sed 's/^if_err_//g'` 
     20INTERFACE=${0##*/if_err_} 
    2121 
    2222if [ "$1" = "autoconf" ]; then 
     
    3131 
    3232if [ "$1" = "suggest" ]; then 
    33         if [ -r /proc/net/dev ]; then 
    34                 egrep '^ *(eth|wlan|ath|ra)[0-9]+:' /proc/net/dev | cut -f1 -d: | sed 's/ //g' 
    35                 exit 0 
    36         else 
    37                 exit 1 
    38         fi 
     33    if [ -r /proc/net/dev ]; then 
     34        awk ' 
     35            /^ *(eth|tap|bond|wlan|ath|ra|sw)[0-9]+:/ { 
     36                 split($0, a, /: */); 
     37                 gsub(/^ +/,"",a[1]); 
     38                 if (($2 > 0) || ($10 > 0)) print a[1]; }' /proc/net/dev 
     39    fi 
     40    exit 0 
    3941fi 
    4042 
  • people/ilmari/modularisation-branch/node/node.d.linux/interrupts.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22#  
    33# Plugin to monitor the number of interrupts and context switches on a system.  
  • people/ilmari/modularisation-branch/node/node.d.linux/ip_.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Wildcard-plugin to monitor IP addresses through iptables. To monitor an 
     
    2424 
    2525 
    26 IP=`basename $0 | sed 's/^ip_//g'` 
     26IP=${0##*/ip_} 
    2727 
    2828if [ "$1" = "autoconf" ]; then 
  • people/ilmari/modularisation-branch/node/node.d.linux/irqstats.in

    r1012 r1265  
    11#!@@PERL@@ -w 
     2# -*- cperl -*- 
    23#  
    34# Plugin to monitor individual interrupts 
     
    1617    } 
    1718} 
    18 open my $in, '<', '/proc/interrupts' 
    19   or die "Can't open /proc/interrupts: $!\n"; 
    2019 
    21 my @cpus = split(' ', <$in>); 
    22 my $cpus = scalar @cpus; 
     20my $sun; 
     21$sun = 1 if (`uname -m` =~ /sparc/); 
     22 
     23my $in; 
     24my @cpus; 
     25my $cpus; 
     26 
     27if ($sun) { 
     28    @cpus = grep (/^cpu\d+/, `cat /proc/stat`); 
     29    $cpus = scalar @cpus; 
     30} else { 
     31    open $in, '<', '/proc/interrupts' 
     32      or die "Can't open /proc/interrupts: $!\n"; 
     33    @cpus = split(' ', <$in>); 
     34    $cpus = scalar @cpus; 
     35
     36 
    2337my $cpu; 
    2438 
     
    4054while (my $line = <$in>) { 
    4155    my ($irq, $label, $type); 
    42     my @data = split(' ', $line, $cpus + 3); 
     56    my @data; 
     57    if ($sun) { 
     58        @data = split (' ', $line, $cpus + 2); 
     59    } else { 
     60        @data = split(' ', $line, $cpus + 3); 
     61    } 
    4362    chomp @data; 
    4463    $irq = shift @data; 
  • people/ilmari/modularisation-branch/node/node.d.linux/load.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22#  
    33# Plugin to monitor the load average on a system. 
    44# 
    55# Usage: Link or copy into /etc/munin/node.d/ 
     6# 
     7# Parameters 
     8#     env.load_warn <warning load> 
     9#     env.load_crit <critical load> 
    610# 
    711# Magic markers (optional - only used by munin-config and some 
     
    1014#%# family=auto 
    1115#%# capabilities=autoconf 
    12  
    13  
    1416 
    1517# If run with the "autoconf"-parameter, give our opinion on wether we 
     
    2729  
    2830if [ "$1" = "config" ]; then 
     31        LOAD_WARN=${load_warn:-10} 
     32        LOAD_CRIT=${load_crit:-120} 
     33 
    2934        # The host name this plugin is for. (Can be overridden to have 
    3035        # one machine answer for several) 
     
    4853        # configured your munin to tell a Nagios-server about any 
    4954        # problems 
    50         echo 'load.warning 10
    51         echo 'load.critical 120
     55        echo 'load.warning $LOAD_WARN
     56        echo 'load.critical $LOAD_CRIT
    5257        # This one is purely to add an explanation to the web page. The first 
    5358        # one is for the graph itself, while the second one is for the field 
     
    6772echo -n "load.value " 
    6873cut -f2 -d' ' < /proc/loadavg 
    69  
    70 # How could this plugin have been written in its simplest form? 
    71 # Something like this: 
    72 # 
    73 # --------------------- 
    74 # #!/bin/sh 
    75  
    76 # 
    77 # if [ "$1" = "config" ]; then 
    78  
    79 #       echo "graph_title Load average" 
    80 #       echo 'graph_args --base 1000 -l 0' 
    81 #       echo 'graph_vlabel load' 
    82 #       echo "load.label load" 
    83 #       exit 0 
    84 # fi 
    85 # echo -n "load.value " 
    86 # cut -f1 -d' ' < /proc/loadavg 
    87 # --------------------- 
    88 # 
    89 # Except for the Nagios-warnings (which most people don't have any need 
    90 # for) and things used by installation scripts and munin-config (which 
    91 # you don't need if you don't plan on submitting your plugin to the 
    92 # pacakge), and the scaling (no milliload numbers) the two versions will 
    93 # work identically. 
  • people/ilmari/modularisation-branch/node/node.d.linux/memory.in

    r1012 r1265  
    11#!@@PERL@@ -w 
     2# -*- perl -*- 
    23# 
    34# Plugin to monitor memory usage. 
     
    56# Origional Author: Jimmy Olsen 
    67# Contributors: 
    7 # Mike Fedyk: Slab, SwapCached, PageTables, VmallocUsed, Mapped, Active, Inactive, 2.4 Rmap & 2.6 
     8#     Mike Fedyk: Slab, SwapCached, PageTables, VmallocUsed, Mapped,  
     9#                 Active, Inactive, 2.4 Rmap & 2.6 
     10#     Juha-Matti Tapio: Input on swap_cache and VMalloc Used on 64 bit 
     11#                 machines. 
     12#     Nicolai Langfeldt: Editor. 
    813# 
    914# Parameters: 
     
    1217#       autoconf (optional - only used by munin-config) 
    1318# 
    14 # Magic markers (optional - only used by munin-config and some 
     19# Magic markers (optional - used by munin-config and some 
    1520# installation scripts): 
     21# 
     22# $Id$ 
     23# 
    1624#%# family=auto 
    1725#%# capabilities=autoconf 
    1826 
    19  
    20 if ($ARGV[0] and $ARGV[0] eq "autoconf") 
    21 
    22         if (-r "/proc/meminfo") 
    23         { 
    24                 print "yes\n"; 
    25                 exit 0; 
    26         } 
    27         else 
    28         { 
    29                 print "/proc/meminfo not found\n"; 
    30                 exit 1; 
    31         } 
     27if ($ARGV[0] and $ARGV[0] eq "autoconf") { 
     28    if (-r "/proc/meminfo") { 
     29        print "yes\n"; 
     30        exit 0; 
     31    } else { 
     32        print "no (/proc/meminfo not found)\n"; 
     33        exit 1; 
     34    } 
    3235} 
    3336 
     
    3538&fetch_meminfo; 
    3639 
    37 if ($ARGV[0] and $ARGV[0] eq "config") 
    38 
    39         print "graph_args --base 1024 -l 0 --vertical-label Bytes --upper-limit ", $mems{'MemTotal'}, "\n"; 
    40         print "graph_title Memory usage\n"; 
    41         print "graph_category system\n"; 
    42         print "graph_info This graph shows what the machine uses its memory for.\n"; 
    43         print "graph_order ", 
    44                 "apps "; 
    45                 if (exists $mems{'PageTables'}) 
    46                 { 
    47                         print "page_tables "; 
    48                 } 
    49                 if (exists $mems{'SwapCached'}) 
    50                 { 
    51                         print "swap_cache "; 
    52                 } 
    53                 if (exists $mems{'VmallocUsed'}) 
    54                 { 
    55                         print "vmalloc_used "; 
    56                 } 
    57                 if (exists $mems{'Slab'}) 
    58                 { 
    59                         print "slab "; 
    60                 } 
    61                 print "cached ", 
    62                 "buffers ", 
    63                 "free ", 
    64                 "swap ", 
    65                 "\n"; 
    66         print "apps.label apps\n"; 
    67         print "apps.draw AREA\n"; 
    68         print "apps.info Memory used by user-space applications.\n"; 
    69         print "buffers.label buffers\n"; 
    70         print "buffers.draw STACK\n"; 
    71         print "buffers.info Block device (e.g. harddisk) cache. Also where \"dirty\" blocks are stored until written.\n"; 
    72         print "swap.label swap\n"; 
    73         print "swap.draw STACK\n"; 
    74         print "swap.info Swap space used.\n"; 
    75         print "cached.label cache\n"; 
    76         print "cached.draw STACK\n"; 
    77         print "cached.info Parked file data (file content) cache.\n"; 
    78         print "free.label unused\n"; 
    79         print "free.draw STACK\n"; 
    80         print "free.info Wasted memory. Memory that is not used for anything at all.\n"; 
    81         if (exists $mems{'Slab'}) 
    82         { 
    83                 print "slab.label slab_cache\n"; 
    84                 print "slab.draw STACK\n"; 
    85                 print "slab.info Memory used by the kernel (major users are caches like inode, dentry, etc).\n"; 
    86         } 
    87         if (exists $mems{'SwapCached'}) 
    88         { 
    89                 print "swap_cache.label swap_cache\n"; 
    90                 print "swap_cache.draw STACK\n"; 
    91                 print "swap_cache.info A piece of memory that keeps track of pages that have been fetched from swap but not yet been modified.\n"; 
    92         } 
    93         if (exists $mems{'PageTables'}) 
    94         { 
    95                 print "page_tables.label page_tables\n"; 
    96                 print "page_tables.draw STACK\n"; 
    97                 print "page_tables.info Memory used to map between virtual and physical memory addresses.\n" 
    98         } 
    99         if (exists $mems{'VmallocUsed'}) 
    100         { 
    101                 print "vmalloc_used.label vmalloc_used\n"; 
    102                 print "vmalloc_used.draw STACK\n"; 
    103                 print "vmalloc_used.info Virtual memory used by the kernel (used when the memory does not have to be physically contigious).\n"; 
    104         } 
    105         if (exists $mems{'Committed_AS'}) 
    106         { 
    107                 print "committed.label committed\n"; 
    108                 print "committed.draw LINE2\n"; 
    109                 print "committed.warn ", $mems{'SwapTotal'} + $mems{'MemTotal'}, "\n"; 
    110                 print "committed.info The amount of memory that would be used if all the memory that's been allocated were to be used.\n"; 
    111         } 
    112         if (exists $mems{'Mapped'}) 
    113         { 
    114                 print "mapped.label mapped\n"; 
    115                 print "mapped.draw LINE2\n"; 
    116                 print "mapped.info All mmap()ed pages.\n"; 
    117         } 
    118         if (exists $mems{'Active'}) 
    119         { 
    120                 print "active.label active\n"; 
    121                 print "active.draw LINE2\n"; 
    122                 print "active.info Memory recently used. Not reclaimed unless absolutely necessary.\n"; 
    123         } 
    124         if (exists $mems{'ActiveAnon'}) 
    125         { 
    126                 print "active_anon.label active_anon\n"; 
    127                 print "active_anon.draw LINE1\n"; 
    128         } 
    129         if (exists $mems{'ActiveCache'}) 
    130         { 
    131                 print "active_cache.label active_cache\n"; 
    132                 print "active_cache.draw LINE1\n"; 
    133         } 
    134         if (exists $mems{'Inactive'}) 
    135         { 
    136                 print "inactive.label inactive\n"; 
    137                 print "inactive.draw LINE2\n"; 
    138                 print "inactive.info Memory not currently used.\n"; 
    139         } 
    140         if (exists $mems{'Inact_dirty'}) 
    141         { 
    142                 print "inact_dirty.label inactive_dirty\n"; 
    143                 print "inact_dirty.draw LINE1\n"; 
    144                 print "inact_dirty.info Memory not currently used, but in need of being written to disk.\n"; 
    145         } 
    146         if (exists $mems{'Inact_laundry'}) 
    147         { 
    148                 print "inact_laundry.label inactive_laundry\n"; 
    149                 print "inact_laundry.draw LINE1\n"; 
    150         } 
    151         if (exists $mems{'Inact_clean'}) 
    152         { 
    153                 print "inact_clean.label inactive_clean\n"; 
    154                 print "inact_clean.draw LINE1\n"; 
    155                 print "inact_clean.info Memory not currently used.\n"; 
    156         } 
    157         exit 0; 
     40if ($ARGV[0] and $ARGV[0] eq "config") { 
     41    print "graph_args --base 1024 -l 0 --upper-limit ",$mems{'MemTotal'},"\n"; 
     42    print "graph_vlabel Bytes\n"; 
     43    print "graph_title Memory usage\n"; 
     44    print "graph_category system\n"; 
     45    print "graph_info This graph shows what the machine uses memory for.\n"; 
     46    print "graph_order ", 
     47      "apps "; 
     48    print "page_tables " if exists $mems{'PageTables'}; 
     49 
     50    print "swap_cache " if exists $mems{'SwapCached'}; 
     51 
     52    #print "vmalloc_used " if exists $mems{'VmallocUsed'}; 
     53 
     54    print "slab " if exists $mems{'Slab'}; 
     55 
     56    print "cached ", 
     57      "buffers ", 
     58        "free ", 
     59          "swap ", 
     60            "\n"; 
     61 
     62    print "apps.label apps\n"; 
     63    print "apps.draw AREA\n"; 
     64    print "apps.info Memory used by user-space applications.\n"; 
     65    print "buffers.label buffers\n"; 
     66    print "buffers.draw STACK\n"; 
     67    print "buffers.info Block device (e.g. harddisk) cache. ", 
     68      "Also where \"dirty\" blocks are stored until written.\n"; 
     69    print "swap.label swap\n"; 
     70    print "swap.draw STACK\n"; 
     71    print "swap.info Swap space used.\n"; 
     72    print "cached.label cache\n"; 
     73    print "cached.draw STACK\n"; 
     74    print "cached.info Parked file data (file content) cache.\n"; 
     75    print "free.label unused\n"; 
     76    print "free.draw STACK\n"; 
     77    print "free.info Wasted memory. Memory that is not ", 
     78      "used for anything at all.\n"; 
     79    if (exists $mems{'Slab'}) { 
     80        print "slab.label slab_cache\n"; 
     81        print "slab.draw STACK\n"; 
     82        print "slab.info Memory used by the kernel (major users ", 
     83          " are caches like inode, dentry, etc).\n"; 
     84    } 
     85    if (exists $mems{'SwapCached'}) { 
     86        print "swap_cache.label swap_cache\n"; 
     87        print "swap_cache.draw STACK\n"; 
     88        print "swap_cache.info A piece of memory that keeps track of pages ", 
     89          "that have been fetched from swap but not yet been modified.\n"; 
     90    } 
     91    if (exists $mems{'PageTables'}) { 
     92        print "page_tables.label page_tables\n"; 
     93        print "page_tables.draw STACK\n"; 
     94        print "page_tables.info Memory used to map between virtual and ", 
     95          "physical memory addresses.\n" 
     96    } 
     97    if (exists $mems{'VmallocUsed'}) { 
     98        print "vmalloc_used.label vmalloc_used\n"; 
     99        # print "vmalloc_used.draw STACK\n"; 
     100        print "vmalloc_used.draw LINE2\n"; 
     101        print "vmalloc_used.info 'VMalloc' (kernel) memory used\n" 
     102    } 
     103    if (exists $mems{'Committed_AS'}) { 
     104        print "committed.label committed\n"; 
     105        print "committed.draw LINE2\n"; 
     106 
     107        # Linux machines frequently overcommit - this is not a error 
     108        # condition or even worrying.  But sometimes overcommit shows 
     109        # memory leaks so we want to graph it. 
     110 
     111        # print "committed.warning ", $mems{'SwapTotal'} + $mems{'MemTotal'}, "\n"; 
     112        print "committed.info The amount of memory allocated to programs. ", 
     113          "Overcommitting is normal, but may indicate memory leaks.\n"; 
     114    } 
     115    if (exists $mems{'Mapped'}) { 
     116        print "mapped.label mapped\n"; 
     117        print "mapped.draw LINE2\n"; 
     118        print "mapped.info All mmap()ed pages.\n"; 
     119    } 
     120    if (exists $mems{'Active'}) { 
     121        print "active.label active\n"; 
     122        print "active.draw LINE2\n"; 
     123        print "active.info Memory recently used. Not reclaimed unless ", 
     124          "absolutely necessary.\n"; 
     125    } 
     126    if (exists $mems{'ActiveAnon'}) { 
     127        print "active_anon.label active_anon\n"; 
     128        print "active_anon.draw LINE1\n"; 
     129    } 
     130    if (exists $mems{'ActiveCache'}) { 
     131        print "active_cache.label active_cache\n"; 
     132        print "active_cache.draw LINE1\n"; 
     133    } 
     134    if (exists $mems{'Inactive'}) { 
     135        print "inactive.label inactive\n"; 
     136        print "inactive.draw LINE2\n"; 
     137        print "inactive.info Memory not currently used.\n"; 
     138    } 
     139    if (exists $mems{'Inact_dirty'}) { 
     140        print "inact_dirty.label inactive_dirty\n"; 
     141        print "inact_dirty.draw LINE1\n"; 
     142        print "inact_dirty.info Memory not currently used, but in need of ", 
     143          "being written to disk.\n"; 
     144    } 
     145    if (exists $mems{'Inact_laundry'}) { 
     146        print "inact_laundry.label inactive_laundry\n"; 
     147        print "inact_laundry.draw LINE1\n"; 
     148    } 
     149    if (exists $mems{'Inact_clean'}) { 
     150        print "inact_clean.label inactive_clean\n"; 
     151        print "inact_clean.draw LINE1\n"; 
     152        print "inact_clean.info Memory not currently used.\n"; 
     153    } 
     154    exit 0; 
    158155} 
    159156 
     
    161158# and is has not been set by &fetch_meminfo 
    162159 
    163 if (exists $mems{'Slab'}) 
    164 
    165         print "slab.value ", $mems{'Slab'}, "\n"; 
    166 
    167 else 
    168 
    169         $mems{'Slab'} = 0; 
    170 
    171 if (exists $mems{'SwapCached'}) 
    172 
    173         print "swap_cache.value ", $mems{'SwapCached'}, "\n"; 
    174 
    175 else 
    176 
    177         $mems{'SwapCached'} = 0; 
    178 
    179 if (exists $mems{'PageTables'}) 
    180 
    181         print "page_tables.value ", $mems{'PageTables'}, "\n"; 
    182 
    183 else 
    184 
    185         $mems{'PageTables'} = 0; 
    186 
    187 if (exists $mems{'VmallocUsed'}) 
    188 
    189         print "vmalloc_used.value ", $mems{'VmallocUsed'}, "\n"; 
    190 
    191 else 
    192 
    193         $mems{'VmallocUsed'} = 0; 
     160if (exists $mems{'Slab'}) { 
     161    print "slab.value ", $mems{'Slab'}, "\n"; 
     162} else { 
     163    $mems{'Slab'} = 0; 
     164
     165 
     166if (exists $mems{'SwapCached'}) { 
     167    print "swap_cache.value ", $mems{'SwapCached'}, "\n"; 
     168} else { 
     169    $mems{'SwapCached'} = 0; 
     170
     171 
     172if (exists $mems{'PageTables'}) { 
     173    print "page_tables.value ", $mems{'PageTables'}, "\n"; 
     174} else { 
     175    $mems{'PageTables'} = 0; 
     176
     177 
     178if (exists $mems{'VmallocUsed'}) { 
     179    print "vmalloc_used.value ", $mems{'VmallocUsed'}, "\n"; 
     180} else { 
     181    $mems{'VmallocUsed'} = 0; 
    194182} 
    195183 
     
    198186        -$mems{'Buffers'} 
    199187        -$mems{'Cached'} 
    200         -$mems{'SwapCached'} 
    201188        -$mems{'Slab'} 
    202189        -$mems{'PageTables'} 
    203        -$mems{'VmallocUsed'} 
     190        -$mems{'SwapCached'} 
    204191        ,"\n"; 
     192 
    205193print "free.value ", $mems{'MemFree'}, "\n"; 
    206194print "buffers.value ", $mems{'Buffers'}, "\n"; 
     
    208196print "swap.value ", $mems{'SwapTotal'} - $mems{'SwapFree'}, "\n"; 
    209197 
    210 if (exists $mems{'Committed_AS'}) 
    211 
    212         print "committed.value ", $mems{'Committed_AS'}, "\n"; 
    213 
    214 if (exists $mems{'Mapped'}) 
    215 
    216         print "mapped.value ", $mems{'Mapped'}, "\n"; 
    217 
    218 if (exists $mems{'Active'}) 
    219 
    220         print "active.value ", $mems{'Active'}, "\n"; 
    221 
    222 if (exists $mems{'ActiveAnon'}) 
    223 
    224         print "active_anon.value ", $mems{'ActiveAnon'}, "\n"; 
    225 
    226 if (exists $mems{'ActiveCache'}) 
    227 
    228         print "active_cache.value ", $mems{'ActiveCache'}, "\n"; 
    229 
    230 if (exists $mems{'Inactive'}) 
    231 
    232         print "inactive.value ", $mems{'Inactive'}, "\n"; 
    233 
    234 if (exists $mems{'Inact_dirty'}) 
    235 
    236         print "inact_dirty.value ", $mems{'Inact_dirty'}, "\n"; 
    237 
    238 if (exists $mems{'Inact_laundry'}) 
    239 
    240         print "inact_laundry.value ", $mems{'Inact_laundry'}, "\n"; 
    241 
    242 if (exists $mems{'Inact_clean'}) 
    243 
    244         print "inact_clean.value ", $mems{'Inact_clean'}, "\n"; 
    245 
    246  
    247 sub fetch_meminfo 
    248 
    249         open (IN, "/proc/meminfo") || die "Could not open /proc/meminfo for reading: $!"; 
    250         while (<IN>) 
    251         { 
    252                 if (/^(\w+):\s*(\d+)\s+kb/i) 
    253                 { 
    254                         $mems{"$1"} = $2 * 1024; 
    255                 } 
     198print "committed.value ", $mems{'Committed_AS'}, "\n" 
     199  if exists $mems{'Committed_AS'}; 
     200 
     201print "mapped.value ", $mems{'Mapped'}, "\n" 
     202  if exists $mems{'Mapped'}; 
     203 
     204print "active.value ", $mems{'Active'}, "\n" 
     205  if exists $mems{'Active'}; 
     206 
     207print "active_anon.value ", $mems{'ActiveAnon'}, "\n" 
     208  if exists $mems{'ActiveAnon'}; 
     209 
     210print "active_cache.value ", $mems{'ActiveCache'}, "\n" 
     211  if exists $mems{'ActiveCache'}; 
     212 
     213print "inactive.value ", $mems{'Inactive'}, "\n" 
     214  if exists $mems{'Inactive'}; 
     215 
     216print "inact_dirty.value ", $mems{'Inact_dirty'}, "\n" 
     217  if exists $mems{'Inact_dirty'}; 
     218 
     219print "inact_laundry.value ", $mems{'Inact_laundry'}, "\n" 
     220  if exists $mems{'Inact_laundry'}; 
     221 
     222print "inact_clean.value ", $mems{'Inact_clean'}, "\n" 
     223  if exists $mems{'Inact_clean'}; 
     224 
     225exit 0; 
     226 
     227sub fetch_meminfo { 
     228    open (IN, "/proc/meminfo") || 
     229      die "Could not open /proc/meminfo for reading: $!"; 
     230    while (<IN>) { 
     231        if (/^(\w+):\s*(\d+)\s+kb/i) { 
     232            $mems{"$1"} = $2 * 1024; 
    256233        } 
    257         close (IN); 
    258         # Only 2.6 and above has slab reported in meminfo, so read slabinfo if it isn't in meminfo 
    259         if (!$mems{Slab}) 
    260         { 
    261                 &fetch_slabinfo; 
     234    } 
     235    close (IN); 
     236 
     237    # Only 2.6 and above has slab reported in meminfo, so read 
     238    # slabinfo if it isn't in meminfo 
     239    if (!$mems{Slab}) { 
     240        &fetch_slabinfo; 
     241    } 
     242    # Support 2.4 Rmap VM based kernels 
     243    if (!$mems{'Inactive'} && $mems{'Inact_dirty'} && 
     244      $mems{'Inact_laundry'} && $mems{'Inact_clean'}) { 
     245        $mems{'Inactive'} = $mems{'Inact_dirty'} + 
     246          $mems{'Inact_laundry'} + $mems{'Inact_clean'}; 
     247    } 
     248
     249 
     250sub fetch_slabinfo { 
     251    # In 2.0 there is no slabinfo file, so return if the file doesn't open 
     252    open (IN, "/proc/slabinfo") || return; 
     253    my @slabinfo; 
     254    my $tot_slab_pages = 0; 
     255    my $slab_version = <IN>; 
     256    if ($slab_version =~ /^slabinfo - version: 1.1/) { 
     257        while (<IN>) { 
     258            if (!/^slabinfo/) { 
     259                @slabinfo = split; 
     260                $tot_slab_pages += $slabinfo[5]; 
     261            } 
    262262        } 
    263         # Support 2.4 Rmap VM based kernels 
    264         if (!$mems{'Inactive'} && $mems{'Inact_dirty'} && $mems{'Inact_laundry'} && $mems{'Inact_clean'}) 
    265         { 
    266                 $mems{'Inactive'} = $mems{'Inact_dirty'} + $mems{'Inact_laundry'} + $mems{'Inact_clean'} 
    267         } 
    268 
    269  
    270 sub fetch_slabinfo 
    271 
    272         # In 2.0 there is no slabinfo file, so return if the file doesn't open 
    273         open (IN, "/proc/slabinfo") || return; 
    274         my @slabinfo; 
    275         my $tot_slab_pages = 0; 
    276         my $slab_version = <IN>; 
    277         if ($slab_version =~ /^slabinfo - version: 1.1/) 
    278         { 
    279                 while (<IN>) 
    280                 { 
    281                         if (!/^slabinfo/) 
    282                         { 
    283                                 @slabinfo = split; 
    284                                 $tot_slab_pages += $slabinfo[5]; 
    285                         } 
    286                 } 
    287         } 
    288         close (IN); 
    289         if ($tot_slab_pages gt 0) 
    290         { 
    291                 $mems{'Slab'} = $tot_slab_pages * 4096; 
    292         } 
     263    } 
     264    close (IN); 
     265 
     266    $mems{'Slab'} = $tot_slab_pages * 4096 if $tot_slab_pages gt 0; 
    293267} 
    294268 
  • people/ilmari/modularisation-branch/node/node.d.linux/netstat.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
     2# -*- sh -*- 
    23# 
    34# Plugin to monitor network connections. 
  • people/ilmari/modularisation-branch/node/node.d.linux/nfs4_client.in

    r1045 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to monitor NFSv4 client traffic 
  • people/ilmari/modularisation-branch/node/node.d.linux/nfs_client.in

    r1045 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
     2# -*- sh -*- 
    23# 
    34# Plugin to monitor NFS client traffic 
  • people/ilmari/modularisation-branch/node/node.d.linux/nfsd.in

    r1045 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin created by Alexandre Dupouy, with the assistance of Mike Fedyk 
    44# 
    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 
     5# $Id$ 
    366# 
    377#%# family=auto 
  • people/ilmari/modularisation-branch/node/node.d.linux/open_files.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22#  
    33# Plugin to monitor the number of open files in the system. 
     
    1313#%# family=auto 
    1414#%# capabilities=autoconf 
    15  
    16  
    1715 
    1816if [ "$1" = "autoconf" ]; then 
  • people/ilmari/modularisation-branch/node/node.d.linux/open_inodes.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22#  
    33# Plugin to monitor the number of open files in the system. 
     
    1313#%# family=auto 
    1414#%# capabilities=autoconf 
    15  
    16  
    1715 
    1816if [ "$1" = "autoconf" ]; then 
  • people/ilmari/modularisation-branch/node/node.d.linux/port_.in

    r1012 r1265  
    3131    my ($fd, $file) = @_; 
    3232 
    33     my $cache_dir = "/var/run/munin/plugin-state"; 
     33    my $cache_dir = "@@PLUGSTATE@@"; 
    3434    my $cache = $file; 
    3535    $cache =~ s:/:_:g; 
  • people/ilmari/modularisation-branch/node/node.d.linux/processes.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to monitor the number of processes on the machine. Much linke 
     
    1313#%# family=auto 
    1414#%# capabilities=autoconf 
    15  
    16  
    1715 
    1816if [ "$1" = "autoconf" ]; then 
  • people/ilmari/modularisation-branch/node/node.d.linux/swap.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to monitor swap IO in number of blocks per second. 
  • people/ilmari/modularisation-branch/node/node.d.linux/uptime.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to measure uptime. Especially the average and max values on the 
     
    2727fi 
    2828 
    29 env LC_ALL=C awk '{printf "uptime.value %.2f\n",$1/86400}' /proc/uptime 
     29awk '{printf "uptime.value %.2f\n",$1/86400}' /proc/uptime 
  • people/ilmari/modularisation-branch/node/node.d.linux/vlan_.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Wildcard-script to monitor network interfaces. To monitor an 
     
    1717#%# capabilities=autoconf suggest 
    1818 
    19 INTERFACE=`basename $0 | sed 's/^vlan_//g' | tr '_' '.'`  
     19INTERFACE=$(basename $0 | sed 's/^vlan_//g' | tr '_' '.') 
    2020 
    2121if [ "$1" = "autoconf" ]; then 
    22         if [ -d /proc/net/vlan -a -r /proc/net/vlan -a -x /proc/net/vlan ] 
    23         then 
    24                 echo yes 
    25                 exit 0 
    26         else 
    27                 echo no 
    28                 exit 1 
    29         fi 
     22    if [ ! -d /proc/net/vlan ] ; then  
     23        echo "no (no vlan support)" 
     24        exit 1 
     25    fi 
     26    if [ ! -d -r /proc/net/vlan ] ; then 
     27        echo "no (cannot not read /proc/net/vlan)" 
     28        exit 1 
     29    fi 
     30    if [ ! -x /proc/net/vlan ] ; then 
     31        echo "no (cannot cd to /proc/net/vlan)" 
     32        exit 1 
     33    fi 
     34 
     35    echo yes 
     36    exit 0 
    3037fi 
    3138 
    3239if [ "$1" = "suggest" ]; then 
    33         if [ -d /proc/net/vlan -a -r /proc/net/vlan -a -x /proc/net/vlan ] 
    34         then 
    35                 for file in /proc/net/vlan/* 
    36                 do 
    37                         if [ ! "$file" = "/proc/net/vlan/config" ] 
    38                         then 
    39                                 basename $file | tr '.' '_' 
    40                         fi 
    41                 done 
     40    for file in /proc/net/vlan/*; do 
     41        if [ ! "$file" = "/proc/net/vlan/config" ]; then 
     42            basename $file | tr '.' '_' 
    4243        fi 
    43         exit 0 
     44    done 
     45    exit 0 
    4446fi 
    4547 
     
    6365        echo 'transmitted.draw AREA' 
    6466        exit 0 
    65 fi; 
     67fi 
    6668 
    6769awk "/bytes received/ { print \"received.value \" \$4 } /bytes transmitted/ { print \"transmitted.value \" \$4 }" < /proc/net/vlan/$INTERFACE 
  • people/ilmari/modularisation-branch/node/node.d.sunos/if_.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
     2# -*- sh -*- 
    23# 
    34# Wildcard-plugin to monitor network interfaces. To monitor an 
     
    1617#%# capabilities=autoconf suggest 
    1718 
    18  
    19 INTERFACE=`basename $0 | sed 's/^if_//g'` 
     19INTERFACE=${0##*/if_} 
    2020 
    2121if [ "$1" = "autoconf" ]; then 
  • people/ilmari/modularisation-branch/node/node.d.sunos/if_errcoll_.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Wildcard-plugin to monitor network interfaces. To monitor an 
     
    1616#%# capabilities=autoconf suggest 
    1717 
    18  
    19 INTERFACE=`basename $0 | sed 's/^if_errcoll_//g'` 
     18INTERFACE=${0##*/if_errcoll_} 
    2019 
    2120if [ "$1" = "autoconf" ]; then 
  • people/ilmari/modularisation-branch/node/node.d.sunos/io_busy_.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Wildcard-plugin to monitor disks. To monitor a disk, 
  • people/ilmari/modularisation-branch/node/node.d.sunos/io_bytes_.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Wildcard-plugin to monitor disks. To monitor a disk, 
  • people/ilmari/modularisation-branch/node/node.d.sunos/io_ops_.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Wildcard-plugin to monitor disks. To monitor a disk, 
  • people/ilmari/modularisation-branch/node/node.d.sunos/load.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22 
    33#%# family=auto 
  • people/ilmari/modularisation-branch/node/node.d.sunos/memory.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    3 #%# family=manual 
     3#%# family=auto 
     4#%# capabilities=autoconf 
     5
     6# Show memory stats based on top output 
     7
     8# Parameters 
     9#   env.top /path/to/top 
     10
     11# FIXME1: Reporting size in MB is Wrong. Report bytes and let rrd scale units 
     12# FIXME2: Using kstat would be much better! 
    413 
     14TOP=${top:-/usr/local/bin/top} 
    515 
    6 TOP=/usr/local/bin/top 
     16if [ "$1" = "autoconf" ]; then 
     17    if [ -x $TOP ] ; then 
     18        echo yes 
     19        exit 0 
     20    else 
     21        echo "no (no executable: $TOP)" 
     22        exit 1 
     23    fi 
     24fi 
    725 
    826if [ "$1" = "config" ]; then 
    9  
    1027        echo "graph_title Memory usage (in MB)" 
    1128                echo 'graph_category system' 
  • people/ilmari/modularisation-branch/node/node.d.sunos/paging_in.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to monitor CPU usage. 
  • people/ilmari/modularisation-branch/node/node.d.sunos/paging_out.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to monitor CPU usage. 
  • people/ilmari/modularisation-branch/node/node.d.sunos/processes.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33#%# family=auto 
  • people/ilmari/modularisation-branch/node/node.d/amavis.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to monitor the amavis mail filter. 
     
    1414#       amavislog    - file where amavis logs are written 
    1515# 
     16# #%# family=auto 
     17# #%# capabilities=autoconf 
    1618 
    1719mktempfile () { 
    18 @@MKTEMP@@ 
     20    $MUNIN_MKTEMP 
    1921} 
    2022 
    21 AMAVIS_LOG=${logfile:-/var/log/mail/mail.info} 
     23AMAVIS_LOG=${amavislog:-/var/log/mail/mail.info} 
    2224LOGTAIL=${logtail:-`which logtail`} 
    23 STATEFILE=@@PLUGSTATE@@/amavis.offset 
    24  
    25 if [ "$amavislog"  ]; then AMAVIS_LOG=$amavislog ; fi 
     25STATEFILE=$MUNIN_PLUGSTATE/amavis.offset 
    2626 
    2727if [ "$1" = "autoconf" ]; then 
  • people/ilmari/modularisation-branch/node/node.d/apc_envunit_.in

    r1045 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to monitor APC environmental units (temperature/humidity) 
     
    1616#       community - Community to use to access the APC unit 
    1717# 
    18  
     18# #%# family=auto 
     19# #%# capabilities=autoconf 
    1920# 
    2021# Configuration for temperature or humidity probes  
     22# 
     23# FIXME: Candidate to be snmp__apc 
    2124# 
    2225 
     
    5053if [ "$1" = "autoconf" ]; then 
    5154  if [ -z "${UNITS}" -o -z "${SNMPGET}" ] ; then echo "no" ; exit 1 ; fi 
     55  if [ ! -x "$SNMPGET" ] ; then echo "no (no snmpget executable)"; exit 1; fi 
    5256  for m in ${UNITS} ; do 
    5357    if ping -c1 -q $m  >/dev/null 2>&1 ; then continue ; fi 
  • people/ilmari/modularisation-branch/node/node.d/courier_.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to graph number of courier login/logouts 
     
    2727# courierpop3login: 
    2828# Jan 22 06:28:24 raven courierpop3login: Connection, ip=[::ffff:192.168.0.1] 
    29 5B 
    3029# Jan 22 06:48:22 raven courierpop3login: DISCONNECTED, user=someuser, ip=[::ffff:192.168.0.1], top=0, retr=0, time=21 
    3130# Jan 22 06:28:24 raven courierpop3login: LOGIN, user=someuser, ip=[::ffff:192.168.0.1] 
     
    4746    if [ -f ${COURIER_LOG} -a -x ${LOGTAIL} ]  
    4847    then 
    49         echo yes 
     48        # Makes no sense for wildcard plugin to autoconf to yes 
     49        # unless you can provide suggestions. 
     50        echo no 
    5051        exit 0 
    5152    else 
  • people/ilmari/modularisation-branch/node/node.d/courier_mta_mailqueue.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22#  
    33# Plugin to monitor courier-mta mail spools 
  • people/ilmari/modularisation-branch/node/node.d/cupsys_pages.in

    r1045 r1265  
    1 # 
    21#!@@PERL@@ -w 
    32# 
     
    2524use strict; 
    2625# use Muninnode; 
     26use Munin::Plugin; 
    2727 
    2828my $statefile = "@@PLUGSTATE@@/munin-cupsys-pages.state"; 
     
    7171 
    7272if (-f $statefile) { 
    73     open(IN, $statefile) or exit 4
     73    open(IN, $statefile) or die "Could not open $statefile for reading: $!\n"
    7474    if(<IN> =~ /^(\d+)$/) { 
    7575        $pos = $1; 
     
    103103 
    104104# Write back to state file 
    105 print "Foo! $statefile\n"; 
    106 open (STATFILE, ">$statefile") or exit 4
     105open (STATFILE, ">$statefile") or 
     106  die "Could not open $statefile for writing: $!\n"
    107107print STATFILE "$pos\n"; 
    108108foreach my $printer (sort(keys %printers)) { 
     
    116116    print "graph_args --base 1000 -l 0\n"; 
    117117    print "graph_vlabel pages/\${graph_period}\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"; 
    123118    foreach my $printer (sort(keys %printers)) { 
    124119        # Convert printername to something legal 
    125120        my $p = $printer; 
    126         $printer =~ s/^[^a-zA-Z_]*//; 
    127         $printer =~ s/[^a-zA-Z0-9_]/_/g; 
     121        $printer = clean_fieldname($printer); 
    128122        print "$printer.label $p\n"; 
    129123        print "$printer.type DERIVE\n"; 
     
    134128    foreach my $printer (sort(keys %printers)) { 
    135129        my $p = $printer; 
    136         $printer =~ s/^[^a-zA-Z_]*//; 
    137         $printer =~ s/[^a-zA-Z0-9_]/_/g; 
     130        $printer = clean_fieldname($printer); 
    138131        print "$printer.value ".$printers{$p}."\n"; 
    139132    } 
     133    exit 0; 
    140134} 
    141135 
    142136sub parselogfile { 
    143137    my ($fname, $start, $stop) = @_; 
    144     open (LOGFILE, $fname) or exit 3
    145     seek (LOGFILE, $start, 0) or exit 2
     138    open (LOGFILE, $fname) or die "No logfile $fname: $!\n"
     139    seek (LOGFILE, $start, 0) or die "Could not seek in logfile $fname: $!\n"
    146140    while (tell(LOGFILE) < $stop) { 
    147141        my $line = <LOGFILE>; 
     
    157151    close(LOGFILE); 
    158152} 
    159  
    160  
  • people/ilmari/modularisation-branch/node/node.d/df.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
     2# -*- sh -*- 
    23# 
    34# Script to monitor disk usage. 
     
    1415#%# capabilities=autoconf 
    1516 
    16 MAXLABEL=20 
     17. $MUNIN_LIBDIR/plugins/plugin.sh 
     18 
     19print_values () { 
     20    df -P -l 2>/dev/null | sed -e 1d -e '/\/\//d' -e 's/%//' |  
     21    while read dev size used free pct fs; do 
     22        echo "$(clean_fieldname $dev).value $pct" 
     23    done 
     24
     25 
    1726 
    1827if [ "$1" = "autoconf" ]; then 
    19        if [ `uname -s` = SunOS ]; then 
    20                echo no 
    21                exit 1 
    22        else 
    23                echo yes 
    24                exit 0 
    25        fi 
     28    if [ -z "$(print_values)" ] ; then 
     29        echo no 
     30        exit 1 
     31    else 
     32        echo yes 
     33        exit 0 
     34    fi 
    2635fi 
    2736 
    2837if [ "$1" = "config" ]; then 
    29  
    30         echo 'graph_title Filesystem usage (in %)' 
    31         echo 'graph_args --upper-limit 100 -l 0' 
    32         echo 'graph_vlabel %' 
    33         df -P -l  | sed 1d | grep -v "//" | sort | while read i; do 
    34                 name=`echo $i | sed 's/[\/.-]/_/g'| awk '{ print $1 }'` 
    35                 printf "$name.label " 
    36                 echo $i | awk "{  
    37                         dir=\$6 
    38                         if (length(dir) <= $MAXLABEL) 
    39                                 print dir 
    40                         else 
    41                                 printf (\"...%s\n\", substr (dir, length(dir)-$MAXLABEL+4, $MAXLABEL-3))  
    42                 }" 
    43                 echo "$name.warning 92" 
    44                 echo "$name.critical 98" 
    45         done 
    46         exit 0 
     38    echo 'graph_title Filesystem usage (in %)' 
     39    echo 'graph_args --upper-limit 100 -l 0' 
     40    echo 'graph_vlabel %' 
     41    echo 'graph_scale no' 
     42    df -P -l  | sed -e 1d -e '/\/\//d' -e 's/%//' | sort |  
     43    while read dev size used free pct fs; do 
     44        name=$(clean_fieldname $dev) 
     45        echo "$name.label $fs" 
     46        echo "$name.warning 92" 
     47        echo "$name.critical 98" 
     48    done 
     49    exit 0 
    4750fi 
    4851 
    49 df -P -l | sed 1d | grep -v "//" | while read i; do 
    50         name=`echo $i | sed 's/[\/.-]/_/g'| awk '{ print $1 ".value " }'` 
    51         printf "$name " 
    52         echo $i | awk '{ print $5 }' | cut -f1 -d% 
    53 done 
     52print_values 
     53 
  • people/ilmari/modularisation-branch/node/node.d/df_inode.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
     2# -*- sh -*- 
    23# 
    3 # Plugin to monitor inode-usage. 
     4 
     5# Plugin to monitor inode-usage.  This plugin is meant to be generic 
     6# unix but there will be specific kinks on each platform that may 
     7# justify custom versions.  It does not work on SunOS/Solaris. 
     8 
    49# 
    510# Parameters understood: 
     
    1419#%# capabilities=autoconf 
    1520 
    16 MAXLABEL=20 
    17  
    18 fs() { 
    19         local escaped_mntpt=`echo "$*" | awk '{ print $NF }' | sed 's|/|\\\\/|g'` 
    20         awk "/^[^ ]* $escaped_mntpt / { print \$3 }" /proc/mounts | grep -v rootfs 
    21 
     21. $MUNIN_LIBDIR/plugins/plugin.sh 
    2222 
    2323print_values() { 
    24         df -P -l -i | sed 1d | grep -v "//" | while read i; do 
    25                 if [ "`fs $i`" = "reiserfs" ] ; then continue ; fi 
    26                 name=`echo $i | sed 's/[\/.]/_/g'| awk '{ print $1 ".value " }'` 
    27                 printf "$name " 
    28                 echo $i | awk '{ print $5 }' | cut -f1 -d% 
    29         done 
     24    df -P -l -i 2>/dev/null | sed -e '1d' -e '/\/\//d' -e 's/%//' | 
     25    while read dev avail used free pct fs; do 
     26        echo "$(clean_fieldname $dev).value $pct" 
     27    done 
    3028} 
    3129 
    3230if [ "$1" = "autoconf" ]; then 
    33         if [ "`print_values`" = "" ] ; then 
    34                 echo no 
    35                 exit 1 
    36         else 
    37                 if [ `uname -s` = SunOS ]; then 
    38                         echo no 
    39                         exit 1 
    40                 else 
    41                         echo yes 
    42                         exit 0 
    43                 fi 
    44         fi 
     31    if [ -z "$(print_values)" ] ; then 
     32        echo no 
     33        exit 1 
     34    else 
     35        echo yes 
    4536        exit 0 
     37    fi 
    4638fi 
    4739 
    4840if [ "$1" = "config" ]; then 
    49  
    50         echo 'graph_title Inode usage (in %)' 
    51         echo 'graph_args --upper-limit 100 -l 0' 
    52         echo 'graph_vlabel %' 
    53         df -P -l -i  | sed 1d | grep -v "//" | sort | while read i; do 
    54                 if [ "`fs $i`" = "reiserfs" ] ; then continue ; fi 
    55                 name=`echo $i | sed 's/[\/.]/_/g'| awk '{ print $1 }'` 
    56                 printf "$name.label " 
    57                 echo $i | awk "{ 
    58                         dir=\$6 
    59                         if (length(dir) <= $MAXLABEL) 
    60                                 print dir 
    61                         else 
    62                                 printf (\"...%s\n\", substr (dir, length(dir)-$MAXLABEL+4, $MAXLABEL-3)) 
    63                 }" 
    64                 echo "$name.warning 92" 
    65                 echo "$name.critical 98"  
    66         done 
    67         exit 0 
     41    echo 'graph_title Inode usage (in %)' 
     42    echo 'graph_args --upper-limit 100 -l 0' 
     43    echo 'graph_vlabel %' 
     44    echo 'graph_scale no' 
     45    df -P -l -i  | sed -e '1d' -e '/\/\//d' -e 's/%//' | sort | 
     46    while read dev avail used free pct fs; do 
     47        name=$(clean_fieldname $dev) 
     48        echo "$name.label $fs" 
     49        echo "$name.warning 92" 
     50        echo "$name.critical 98"  
     51    done 
     52    exit 0 
    6853fi 
    6954 
  • people/ilmari/modularisation-branch/node/node.d/exim_mailqueue.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to monitor exim queue size 
     
    2525DIRNAME=`dirname $0` 
    2626SPOOLDIR="unset" 
    27 EXIM=`which exim 2>/dev/null || which exim4 2>/dev/null` 
    28 QUEUEWARN=100 
    29 QUEUECRIT=200 
     27# You cannot trust the exit status of which 
     28EXIM=$(which exim 2>/dev/null) 
     29case $EXIM:$? in 
     30    *:1|no*) EXIM=$(which exim4 2>/dev/null) 
     31esac 
     32case $EXIM:$? in 
     33    *:1|no*) EXIM='' 
     34esac 
     35 
    3036GRAPHTITLE='Exim Mailqueue' 
    3137 
    32 if [ "$spooldir"  ]; then  SPOOLDIR=$spooldir ; fi 
    33 if [ "$exim"      ]; then      EXIM=$exim     ; fi 
    34 if [ "$queuewarn" ]; then QUEUEWARN=$queuewarn; fi 
    35 if [ "$queuecrit" ]; then QUEUECRIT=$queuecrit; fi 
    36 if [ "$graphtitle" ]; then GRAPHTITLE=$graphtitle; fi 
     38SPOOLDIR=${spooldir:-unset} 
     39EXIM=${exim:-unset} 
     40QUEUEWARN=${queuewarn:-100} 
     41QUEUECRIT=${queuecrit:-200} 
     42GRAPHTITLE=${graphtitle:-$GRAPHTITLE} 
    3743 
    3844if [ "$SPOOLDIR" = "unset" ] 
    3945then 
    40         SPOOLDIR=`($EXIM -bP spool_directory | awk '{ print $3 "/input" }') 2>/dev/null` 
     46        SPOOLDIR=$( ($EXIM -bP spool_directory | awk '{ print $3 "/input" }') 2>/dev/null) 
    4147fi 
    4248 
    4349if [ "$1" = "autoconf" ]; then 
    44         if ( $EXIM -bV 2>/dev/null >/dev/null ); then 
     50    if [ -z "$EXIM" ]; then 
     51        echo no 
     52        exit 1 
     53    fi 
     54         
     55        if $EXIM -bV 2>/dev/null >/dev/null; then 
    4556                if ( /usr/bin/find $SPOOLDIR -iname "*-H" -print 2>/dev/null >/dev/null ); then 
    4657                        echo yes 
  • people/ilmari/modularisation-branch/node/node.d/exim_mailqueue_alt.in

    r1012 r1265  
    1 #!/bin/bash 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to monitor Exim's mail queue 
     
    2424 
    2525PATH='/bin:/sbin:/usr/bin:/usr/sbin' 
    26 EXIM=`which exim 2>/dev/null || which exim4 2>/dev/null` 
    27 QUEUEWARN=100 
     26# You cannot trust the exit status of which 
     27EXIM=$(which exim 2>/dev/null) 
     28case $EXIM:$? in 
     29    *:1|no*) EXIM=$(which exim4 2>/dev/null) 
     30esac 
     31case $EXIM:$? in 
     32    *:1|no*) EXIM='' 
     33esac 
     34 
    2835QUEUECRIT=200 
    2936 
    30 [ "$exim" ] && EXIM=$exim 
    31 [ "$queuewarn" ] && QUEUEWARN=$queuewarn 
    32 [ "$queuecrit" ] && QUEUECRIT=$queuecrit 
     37EXIM=${exim:-$EXIM} 
     38QUEUEWARN=${queuewarn:-100} 
     39QUEUECRIT=${queuecrit:-200} 
    3340 
    3441if [ "$1" == "config" ]; then 
  • people/ilmari/modularisation-branch/node/node.d/exim_mailstats.in

    r1012 r1265  
    3434        my $ts = sprintf("%04d%02d%02d",$t[5]+1900, $t[4]+1, $t[3]); 
    3535        $logfile =~ s/\%D/$ts/g; 
    36     }         
     36    } 
    3737    my @lfiles = split(/\s?:\s?/, $logfile); 
    3838    foreach (@lfiles) { 
     
    5757{ 
    5858    my $logfile; 
    59      
     59 
    6060    if(defined($LOGDIR)) { 
    6161        if(! -d $LOGDIR) { 
  • people/ilmari/modularisation-branch/node/node.d/foldingathome.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Folding@Home 
  • people/ilmari/modularisation-branch/node/node.d/foldingathome_rank.in

    r864 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Folding@Home Rank 
     
    1313#%# capabilities=autoconf 
    1414 
    15 statefile=@@PLUGSTATE@@/plugin-fah_rank.state 
     15statefile=$MUNIN_PLUGSTATE/plugin-fah_rank.state 
    1616 
    1717if [ "$1" = "autoconf" ]; then 
    18     echo yes 
    19     exit 0 
     18    # No real check of anything 
     19    # echo yes 
     20    echo no 
     21    exit 1 
    2022fi 
    2123 
  • people/ilmari/modularisation-branch/node/node.d/foldingathome_wu.in

    r864 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Folding@Home WU submited 
     
    1313#%# capabilities=autoconf 
    1414 
    15 statefile=@@PLUGSTATE@@/plugin-fah_wu.state 
     15statefile=$MUNIN_PLUGSTATE/plugin-fah_wu.state 
    1616 
    1717if [ "$1" = "autoconf" ]; then 
    18     echo yes 
    19     exit 0 
     18    # Didn't check anything, which is meaningless in this case. 
     19    # echo yes 
     20    echo no 
     21    exit 1 
    2022fi 
    2123 
     
    3032fi 
    3133 
    32 wu=`wget "http://vspx27.stanford.edu/cgi-bin/main.py?qtype=userpage&username=8d" -q -t 1 -T 5 -O - | egrep -A 2 "<TD> WU</TD>" | grep "<b>" | sed 's/.*<b> \([0-9]*\) .*/\1/'` 
     34wu=$(wget "http://vspx27.stanford.edu/cgi-bin/main.py?qtype=userpage&username=8d" -q -t 1 -T 5 -O - | egrep -A 2 "<TD> WU</TD>" | grep "<b>" | sed 's/.*<b> \([0-9]*\) .*/\1/') 
    3335 
    3436if [ "$wu" == "" ]; then 
  • people/ilmari/modularisation-branch/node/node.d/hddtemp.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to monitor harddrive temperatures through SMART. 
  • people/ilmari/modularisation-branch/node/node.d/id.in

    r1015 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Copyright (C) 2006 Dagfinn Ilmari Mannsaaker <ilmari@ilmari.org> 
  • people/ilmari/modularisation-branch/node/node.d/ipac-ng.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Skeleton-plugin to monitor ipac-ng rules. To monitor an 
  • people/ilmari/modularisation-branch/node/node.d/mbmon_.in

    r864 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to monitor Motherboard temparature using mbmon 
     
    2121#%# capabilities=autoconf suggest 
    2222 
    23  
    24  
    2523what=`basename $0 | sed 's/^mbmon_//g'` 
    26  
    2724 
    2825if [ "$1" = "suggest" ]; then 
  • people/ilmari/modularisation-branch/node/node.d/multips.in

    r1045 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
     2# -*- sh -*- 
    23# 
    34# Script to monitor number of processes. Programs are configured 
     
    4647 
    4748        eval REGEX='"${regex_'$name'-\<'$name'\>}"' 
    48         PGREP=`which pgrep` 
    49         if [ -n "$PGREP" ]; then 
     49        PGREP=$(which pgrep) 
     50        if [ -n "$PGREP" -a -x "$PGREP" ]; then 
    5051                $PGREP -f -l "$name" | grep "$REGEX" | wc -l 
    5152        elif [ -x /usr/ucb/ps ]; then 
  • people/ilmari/modularisation-branch/node/node.d/munin_graph.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
     2# -*- sh -*- 
    23# 
    34# Script to monitor munin-graph 
     
    1112# scripts): 
    1213# 
    13 #%# family=manual 
     14#%# family=auto 
    1415#%# capabilities=autoconf 
    1516 
    1617if [ ! "$GRAPH_STATSFILE" ] ; then 
    17         GRAPH_STATSFILE=@@DBDIR@@/munin-graph.stats 
     18        GRAPH_STATSFILE=$MUNIN_DBDIR/munin-graph.stats 
    1819fi 
    1920 
    2021if [ "$1" = "autoconf" ]; then 
    21         if [ -f $GRAPH_STATSFILE ]; then 
     22        if [ -r $GRAPH_STATSFILE ]; then 
    2223            echo "yes" 
    2324            exit 0 
  • people/ilmari/modularisation-branch/node/node.d/munin_update.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
     2# -*- sh -*- 
    23# 
    34# Script to monitor Munin-update 
     
    1112# scripts): 
    1213# 
    13 #%# family=manual 
     14#%# family=auto 
    1415#%# capabilities=autoconf 
    1516 
    1617if [ ! "$UPDATE_STATSFILE" ]; then 
    17         UPDATE_STATSFILE=@@DBDIR@@/munin-update.stats 
     18        UPDATE_STATSFILE=$MUNIN_DBDIR/munin-update.stats 
    1819fi 
    1920 
    2021if [ "$1" = "autoconf" ]; then 
    21         if [ -f $UPDATE_STATSFILE ]; then 
     22        if [ -r $UPDATE_STATSFILE ]; then 
    2223            echo "yes" 
    2324            exit 0 
  • people/ilmari/modularisation-branch/node/node.d/mysql_bytes.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to monitor the number of bytes sent from and received by mysql. 
  • people/ilmari/modularisation-branch/node/node.d/mysql_isam_space_.in

    r1012 r1265  
    11#!@@PERL@@ -w 
     2# -*- perl -*- 
    23# 
    34# Plugin to monitor the percent of table space used on isam and myisam 
     
    2425my $STATEFILE = $ENV{'statefile'} || "@@PLUGSTATE@@/plugin-mysql_isam_space.state"; 
    2526my $MYSQLSHOW = $ENV{'mysqlshow'} || 'mysqlshow'; 
     27my $ABSOLUTE  = $ENV{'absolute'} || 0; 
    2628my @mysql_opts = (); 
    2729 
     
    193195                        if (! $headerseen and $fields[1] eq "Name") 
    194196                        { # Header line, grab field names 
    195                                 %index = map {($field[$_], $_)} 0..$#fields; 
     197                                %index = map {($fields[$_], $_)} 0..$#fields; 
    196198                        } 
    197199                        else 
  • people/ilmari/modularisation-branch/node/node.d/mysql_queries.in

    r1045 r1265  
    105105    else 
    106106    { 
    107         print "no (mysqadmin not found)\n"; 
     107        print "no (mysqladmin not found)\n"; 
    108108    } 
    109109    exit $return; 
  • people/ilmari/modularisation-branch/node/node.d/mysql_slowqueries.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22#  
    33# Plugin to monitor the number of slow queries on a mysql-server 
  • people/ilmari/modularisation-branch/node/node.d/mysql_threads.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to monitor the number of threads on a mysql-server. Faster than 
  • people/ilmari/modularisation-branch/node/node.d/named.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Munin plugin for named.  This is a bit experimental, we will have to see 
     
    130130 
    131131do_stats 
    132  
  • people/ilmari/modularisation-branch/node/node.d/ntp_.in

    r1012 r1265  
    11#!@@PERL@@ -w 
     2# -*- perl -*- 
    23# 
    34# Plugin to monitor NTP statistics 
     
    7677        } 
    7778        print "graph_args --base 1000 --vertical-label seconds --lower-limit 0\n"; 
     79        print "graph_category time\n"; 
    7880        print "delay.label Delay\n"; 
    7981        print "delay.draw LINE2\n"; 
  • people/ilmari/modularisation-branch/node/node.d/ntp_states.in

    r1012 r1265  
    11#!@@PERL@@ -w 
     2# -*- perl -*- 
    23# 
    34# Plugin to monitor NTP states 
     
    5354        print "graph_title NTP states\n"; 
    5455        print "graph_args --base 1000 --vertical-label msec --lower-limit 0\n"; 
     56        print "graph_category time\n"; 
    5557        foreach (`ntpq -c "hostnames no" -c peers`) { 
    5658                next unless /^.(\d+\.\d+\.\d+\.\d+)/; 
  • people/ilmari/modularisation-branch/node/node.d/perdition.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to graph perdition connections and errors  
     
    5757fatal.label Fatal Errors 
    5858EOF 
     59    # Echo warnnig and critical attributes if set in the plugin config 
     60    for i in imap imaps pop pops fatal connection disconnected; do 
     61        warn=\$${i}_warn; eval val=$warn 
     62        [ "$val" ] && echo "$i.warning ${val}" 
     63        crit=\$${i}_crit; eval val=$crit 
     64        [ "$val" ] && echo "$i.critical ${val}" 
     65    done 
    5966    exit 0 
    6067    ;; 
  • people/ilmari/modularisation-branch/node/node.d/ping_.in

    r864 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Copyright (C) 2004 Jimmy Olsen 
     
    2626#       ping           - Ping program to use 
    2727#       host           - Host to ping 
     28#       ping_warn      - Warning limit for nagios notification 
     29#       ping_crit      - Critical limit for nagios notification 
     30#       packetloss_warn- Warning limit for nagios notification 
     31#       packetloss_crit- Critical limit for nagios notification 
    2832# 
    2933# Arguments for Solaris: 
     
    4751        echo 'packetloss.label packet loss' 
    4852        echo 'packetloss.graph no' 
     53        [ -n "$ping_warn" ] && echo "ping.warning $ping_warn" 
     54        [ -n "$ping_crit" ] && echo "ping.critical $ping_crit" 
     55        [ -n "$packetloss_warn" ] && echo "packetloss.warning $packetloss_warn" 
     56        [ -n "$packetloss_crit" ] && echo "packetloss.critical $packetloss_crit" 
    4957        exit 0 
    5058fi 
  • people/ilmari/modularisation-branch/node/node.d/postfix_mailqueue.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22#  
    33# Plugin to monitor postfix mail spools 
  • people/ilmari/modularisation-branch/node/node.d/postfix_mailstats.in

    r1012 r1265  
    109109{ 
    110110    print "delivered.value U\n"; 
    111     foreach my $i (keys %{$rejects}) 
     111    foreach my $i (sort keys %{$rejects}) 
    112112    { 
    113113        print "r$i.value U\n"; 
     
    147147    print "delivered.draw AREA\n"; 
    148148    print "delivered.min 0\n"; 
    149     foreach my $i (keys %{$rejects}) 
     149    foreach my $i (sort keys %{$rejects}) 
    150150    { 
    151151            print "r$i.label reject $i\n"; 
     
    158158 
    159159print "delivered.value $delivered\n"; 
    160 foreach my $i (keys %{$rejects}) 
     160foreach my $i (sort keys %{$rejects}) 
    161161{ 
    162162        print "r$i.value ", $rejects->{$i}, "\n"; 
     
    168168open (OUT, ">$statefile") or exit 4; 
    169169print OUT "$pos:$delivered\n"; 
    170 foreach my $i (keys %{$rejects}) 
     170foreach my $i (sort keys %{$rejects}) 
    171171{ 
    172172        print OUT "$i:", $rejects->{$i}, "\n"; 
  • people/ilmari/modularisation-branch/node/node.d/ps_.in

    r1045 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Wildcard-script to monitor number of processes. To monitor a 
     
    2222#%# capabilities=autoconf suggest 
    2323 
     24. $MUNIN_LIBDIR/plugins/plugin.sh 
    2425 
    2526myname=`basename $0 | sed 's/^ps_//g'` 
     
    2930 
    3031if [ "$1" = "autoconf" ]; then 
    31         echo yes 
    32         exit 0 
     32    # Makes little sense to autoconf if you can't suggest 
     33    echo no 
     34    exit 0 
    3335fi 
    3436 
     
    4345        echo 'graph_category processes' 
    4446        echo "count.label $myname" 
    45         echo 'processes.draw LINE2' 
    4647        exit 0 
    4748fi 
  • people/ilmari/modularisation-branch/node/node.d/psu_.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Wildcard-script to monitor number of processes running as a given user. 
     
    1717#%# family=manual 
    1818#%# capabilities=autoconf suggest 
    19  
    20  
    2119 
    2220name=`basename $0 | sed 's/^psu_//g'` 
  • people/ilmari/modularisation-branch/node/node.d/samba.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22#  
    33# Plugin to monitor the number of open files in the system. 
  • people/ilmari/modularisation-branch/node/node.d/sendmail_mailqueue.in

    r1045 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to monitor sendmail queue size. 
  • people/ilmari/modularisation-branch/node/node.d/sendmail_mailstats.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to monitor sendmail statistics. 
     
    2121 
    2222if [ "$1" = "autoconf" ]; then 
    23         if [ -n "$MAILSTATS" -a -x $MAILSTATS ]; then 
     23        if [ -n "$MAILSTATS" -a -x "$MAILSTATS" ]; then 
    2424                echo yes 
    2525                exit 0 
  • people/ilmari/modularisation-branch/node/node.d/sendmail_mailtraffic.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to monitor sendmail statistics. 
     
    2121 
    2222if [ "$1" = "autoconf" ]; then 
    23         if [ -n "$MAILSTATS" -a -x $MAILSTATS ]; then 
     23        if [ -n "$MAILSTATS" -a -x "$MAILSTATS" ]; then 
    2424                echo yes 
    2525                exit 0 
  • people/ilmari/modularisation-branch/node/node.d/snmp__if_.in

    r1012 r1265  
    2727 
    2828my $response; 
     29 
     30# This is the snmpwalk: 
     31# .1.3.6.1.2.1.2.1.0 = INTEGER: 2 
     32# .1.3.6.1.2.1.2.2.1.1.1 = INTEGER: 1 
     33# .1.3.6.1.2.1.2.2.1.1.65539 = INTEGER: 65539 
     34# .1.3.6.1.2.1.2.2.1.2.1 = STRING: MS TCP Loopback interface 
     35# .1.3.6.1.2.1.2.2.1.2.65539 = STRING: Broadcom NetXtreme Gigabit Ethernet 
     36# .1.3.6.1.2.1.2.2.1.3.1 = INTEGER: softwareLoopback(24) 
     37# .1.3.6.1.2.1.2.2.1.3.65539 = INTEGER: ethernetCsmacd(6) 
     38# .1.3.6.1.2.1.2.2.1.4.1 = INTEGER: 1520 
     39# .1.3.6.1.2.1.2.2.1.4.65539 = INTEGER: 1500 
     40# .1.3.6.1.2.1.2.2.1.5.1 = Gauge32: 10000000 
     41# .1.3.6.1.2.1.2.2.1.5.65539 = Gauge32: 1000000000 
     42# .1.3.6.1.2.1.2.2.1.6.1 = STRING: 
     43# .1.3.6.1.2.1.2.2.1.6.65539 = STRING: 0:30:48:75:65:5e 
     44# .1.3.6.1.2.1.2.2.1.7.1 = INTEGER: up(1) 
     45# .1.3.6.1.2.1.2.2.1.7.65539 = INTEGER: up(1) 
     46# .1.3.6.1.2.1.2.2.1.8.1 = INTEGER: up(1) 
     47# .1.3.6.1.2.1.2.2.1.8.65539 = INTEGER: up(1) 
    2948 
    3049if (defined $ARGV[0] and $ARGV[0] eq "snmpconf") 
  • people/ilmari/modularisation-branch/node/node.d/spamstats.in

    r1012 r1265  
    7373{ 
    7474    # Log rotated 
    75     parselogfile ($rotlogfile, $pos, (stat $rotlogfile)[7]); 
     75    if (-f $rotlogfile) { 
     76        parselogfile ($rotlogfile, $pos, (stat $rotlogfile)[7]); 
     77    } 
    7678    $pos = 0; 
    7779} 
  • people/ilmari/modularisation-branch/node/node.d/squid_cache.in

    r1012 r1265  
    6868    my $cachemgr = IO::Socket::INET->new(PeerAddr => $host, 
    6969                                        PeerPort => $port, 
    70                                         Proto    => 'tcp'); 
     70                                        Proto    => 'tcp', 
     71                                        Timeout  => 5); 
    7172 
    7273    if (!$cachemgr) 
  • people/ilmari/modularisation-branch/node/node.d/squid_icp.in

    r1012 r1265  
    7373    my $cachemgr = IO::Socket::INET->new(PeerAddr => $host, 
    7474                                        PeerPort => $port, 
    75                                         Proto    => 'tcp'); 
     75                                        Proto    => 'tcp', 
     76                                        Timeout  => 5); 
    7677 
    7778    if (!$cachemgr) 
  • people/ilmari/modularisation-branch/node/node.d/squid_requests.in

    r1012 r1265  
    6969    my $cachemgr = IO::Socket::INET->new(PeerAddr => $host, 
    7070                                        PeerPort => $port, 
    71                                         Proto    => 'tcp'); 
     71                                        Proto    => 'tcp', 
     72                                        Timeout  => 5); 
    7273 
    7374    if (!$cachemgr) 
  • people/ilmari/modularisation-branch/node/node.d/squid_traffic.in

    r1012 r1265  
    7070    my $cachemgr = IO::Socket::INET->new(PeerAddr => $host, 
    7171                                        PeerPort => $port, 
    72                                         Proto    => 'tcp'); 
     72                                        Proto    => 'tcp', 
     73                                        Timeout  => 5); 
    7374 
    7475    if (!$cachemgr) 
  • people/ilmari/modularisation-branch/node/node.d/vmstat.in

    r1012 r1265  
    1 #!/bin/sh 
     1#!@@GOODSH@@ 
    22# 
    33# Plugin to monitor the number of procs in io-sleep and other wait 
  • people/ilmari/modularisation-branch/node/plugins.history.in

    r1012 r1265  
     1 
    12# 
    23# This file contains plugin history. It only contains history for plugins in 
     
    120121[1.3.1] 
    121122[1.3.2] 
     123linux/yum 
     124digitemp_ 
     125[1.3.3] 
     126aix/load 
     127digitemp_ 
     128env 
     129freebsd/uptime 
     130id 
     131linux/acpi 
     132linux/cpuspeed 
     133linux/nfs4_client 
     134linux/proc_pri 
     135linux/quota_usage_ 
     136linux/threads 
     137linux/yum 
     138lpstat 
     139multiping 
     140netbsd 
     141netbsd/cpu 
     142netbsd/df 
     143netbsd/df_inode 
     144netbsd/forks 
     145netbsd/if_ 
     146netbsd/if_errcoll_ 
     147netbsd/interrupts 
     148netbsd/iostat 
     149netbsd/iostat_ops 
     150netbsd/irqstats 
     151netbsd/load 
     152netbsd/memory 
     153netbsd/memory_pools 
     154netbsd/memory_types 
     155netbsd/netstat 
     156netbsd/nfs_client 
     157netbsd/nfsd 
     158netbsd/open_files 
     159netbsd/processes 
     160netbsd/sensors_ 
     161netbsd/swap 
     162netbsd/uptime 
     163netbsd/vmstat 
     164netopia 
     165ntp_kernel_err 
     166ntp_kernel_pll_freq 
     167ntp_kernel_pll_off 
     168nutups_ 
     169qmailscan 
     170qmailscan-simple 
     171snmp__rdp_users 
     172snmp__uptime 
     173snmp__winmem 
     174sunos/df 
     175sunos/df_inode 
     176sunos/uptime 
     177tomcat_access 
     178tomcat_jvm 
     179tomcat_threads 
     180tomcat_volume 
     181users 
  • people/ilmari/modularisation-branch/server/munin-cgi-graph.in

    r1012 r1265  
    11#!@@PERL@@  -Tw 
    2 # 
    32# 
    43# Copyright (C) 2004 Jimmy Olsen 
     
    5049my $serv  = ""; 
    5150my $dom   = ""; 
     51my $lock  = ""; 
    5252 
    5353my $config = &munin_readconfig ($conffile); 
     
    103103print "\n"; 
    104104 
     105# Try to police the number of concurrent rrdgraph instances.  The 
     106# third value is the default maximum. 
     107 
     108# NOTE: The munin_*lock functions are not exactly ideal for race prone 
     109# locking, they're a bit fuzzy.  A better solution, which would not 
     110# imply a "sleep 1" would be to use semaphores.  See "perldoc perlipc" 
     111# and "man semop". 
     112 
     113my $max_cgi_graph_jobs = &munin_get ($config, "max_cgi_graph_jobs" , 6, $dom); 
     114 
     115until ( $lock ) { 
     116    foreach my $n ( 1 .. $max_cgi_graph_jobs ) { 
     117       if (&munin_getlock ("$config->{rundir}/munin-cgi-graph-$n.lock")) { 
     118           $lock = "munin-cgi-graph-$n.lock"; 
     119           last; 
     120       } 
     121    } 
     122    sleep 1; 
     123} 
    105124 
    106125&graph ($filename); 
     126 
     127munin_removelock($lock); 
    107128 
    108129sub graph 
  • people/ilmari/modularisation-branch/server/munin-cron.pod

    r864 r1265  
    3636so only use parameters that are understood by all the other programs. 
    3737 
    38 =head1 VERSION 
    39  
    40 This is munin-cron version 0.9.2-3 
    41  
    4238=head1 AUTHORS 
    4339 
     
    4642=head1 COPYRIGHT 
    4743 
    48 Copyright © 2002-2004 Audun Ytterdal and Jimmy Olsen / Linpro AS. 
     44Copyright © 2002-2006 Audun Ytterdal and Jimmy Olsen / Linpro AS. 
    4945 
    5046This is free software; see the source for copying conditions. There is 
  • people/ilmari/modularisation-branch/server/munin-graph.in

    r1012 r1265  
    11#!@@PERL@@ -w 
     2# -*- cperl -*- 
    23# 
    3 # Copyright (C) 2002-2004 Jimmy Olsen, Audun Ytterdal 
     4# Copyright (C) 2002-2006 Jimmy Olsen, Audun Ytterdal, 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$ 
    21 
     21 
    2222$|=1; 
    2323 
     
    3333my $graph_time= Time::HiRes::time; 
    3434my $DEBUG = 0; 
    35 my $VERSION = "@@VERSION@@"
     35my $VERSION = '@@VERSION@@'
    3636 
    3737# Limit graphing to certain hosts and/or services 
     
    4242my $RRDkludge = $RRDs::VERSION < 1.2 ? '' : '\\'; 
    4343 
    44 # Force drawing of "graph no".  
     44# And RRDtool 1.2 and later has draws lines with crayons so we hack 
     45# the LINE* options a bit. 
     46my $LINEkluge=0; 
     47if ($RRDs::VERSION >= 1.2) { 
     48    $LINEkluge=1; 
     49
     50 
     51# Force drawing of "graph no". 
    4552my $force_graphing = 0; 
    4653my $force_lazy = 1; 
     
    514521{ 
    515522    my $name = shift; 
    516      
     523 
    517524    $name = substr (Digest::MD5::md5_hex ($name), -15) 
    518525        if (length $name > 15); 
     
    544551        my @added = (); 
    545552 
    546         # See if we should skip the service  
     553        # See if we should skip the service 
    547554        next if (&skip_service ($node, $service)); 
    548555 
     
    553560        my $force_single_value; 
    554561 
    555         @field_order =  @{&munin_get_field_order ($node, $config, $domain, $name, $service, \$force_single_value)}; 
     562        # munin_set_context($node,$config,$domain,$name,$service); 
     563 
     564        @field_order =  
     565          @{&munin_get_field_order($node, $config, $domain, $name, 
     566                                   $service, \$force_single_value)}; 
    556567 
    557568        # Array to keep 'preprocess'ed fields. 
    558569        my @rrd_preprocess = (); 
    559         print "DEBUG: Expanding specials \"", join "\",\"", @field_order, "\".\n" if $DEBUG; 
    560         @added = @{&expand_specials ($node, $config, $domain, $name, $service, \@rrd_preprocess, \@field_order)}; 
     570        print "DEBUG: Expanding specials \"", 
     571          join("\",\"", @field_order), "\".\n" 
     572            if $DEBUG; 
     573 
     574        @added =  
     575          @{&expand_specials ($node, $config, $domain, $name, 
     576                              $service, \@rrd_preprocess, \@field_order)}; 
    561577 
    562578        @field_order = (@rrd_preprocess, @field_order); 
    563         print "DEBUG: Checking field lengths \"", join "\",\"", (@rrd_preprocess, @field_order), "\".\n" if $DEBUG; 
     579        print "DEBUG: Checking field lengths \"", 
     580          join("\",\"", @rrd_preprocess), "\".\n" 
     581            if $DEBUG; 
    564582 
    565583        # Get max label length 
    566         $max_field_len = &munin_get_max_label_length ($node, $config, $domain, $name, $service, \@field_order); 
    567         my $global_headers = ($max_field_len > 20); 
     584        $max_field_len = 
     585          &munin_get_max_label_length ($node, $config, $domain, $name, 
     586                                       $service, \@field_order); 
     587        # my $global_headers = ($max_field_len >= 16); 
     588        # Global headers makes the value tables easier to read no matter how 
     589        # wide the labels are. 
     590        my $global_headers = 1; 
     591 
     592        # Default format for printing under graph. 
     593        my $avgformat; 
     594        my $rrdformat=$avgformat="%6.2lf"; 
     595 
     596        if (exists $node->{client}->{$service}->{graph_args} and 
     597            $node->{client}->{$service}->{graph_args} =~ /--base\s+1024/) { 
     598            # If the base unit is 1024 then 1012.56 is a valid 
     599            # number to show.  That's 7 positions, not 6. 
     600            $rrdformat=$avgformat="%7.2lf"; 
     601        } 
     602 
     603        if (exists $node->{client}->{$service}->{graph_printf} ) { 
     604            # Plugin specified complete printf format 
     605            $rrdformat=$node->{client}->{$service}->{graph_printf}; 
     606        } 
     607 
     608        my $rrdscale = ''; 
     609        $rrdscale = '%s' 
     610          if munin_get_bool_val ($node->{client}->{$service}->{graph_scale},1); 
    568611 
    569612        # Array to keep negative data until we're finished with positive. 
     
    572615        my %total_pos; 
    573616        my %total_neg; 
     617        my $autostacking=0; 
    574618        print "DEBUG: Treating fields \"", join "\",\"", @field_order, "\".\n" if $DEBUG; 
    575619        for my $field (@field_order) { 
    576620            my $path  = undef; 
    577             if ($field =~ s/=(.+)//) 
    578             { 
     621            if ($field =~ s/=(.+)//) { 
    579622                $path = $1; 
    580623            } 
     
    583626            print "DEBUG: Processing field \"$field\".\n" if $DEBUG; 
    584627 
    585             if ($field_count == 0 and munin_get ($config, "draw", "LINE2", $domain, $name, $service, $field) eq "STACK") 
    586             { # Illegal -- first field is a STACK 
    587                 logger ("ERROR: First field (\"$field\") of graph \"$domain\" :: \"$name\" :: \"$service\" is STACK. STACK can only be drawn after a LINEx or AREA."); 
    588             } 
    589                  
     628            my $fielddraw = munin_get ($config, "draw", "LINE2", $domain, 
     629                                       $name, $service, $field); 
     630 
     631            if ($field_count == 0 and $fielddraw eq 'STACK') { 
     632                # Illegal -- first field is a STACK 
     633                logger ("ERROR: First field (\"$field\") of graph \"$domain\"". 
     634                        ":: \"$name\" :: \"$service\" is STACK. STACK can ". 
     635                        "only be drawn after a LINEx or AREA."); 
     636                $fielddraw = "LINE2"; 
     637            } 
     638 
     639            if ($fielddraw eq 'AREASTACK') { 
     640                if ($autostacking==0) { 
     641                    $fielddraw='AREA'; 
     642                    $autostacking=1; 
     643                } else { 
     644                    $fielddraw='STACK'; 
     645                } 
     646            } 
     647 
     648            if ($fielddraw =~ /LINESTACK(\d+(?:.\d+)?)/ ) { 
     649                if ($autostacking==0) { 
     650                    $fielddraw="LINE$1"; 
     651                    $autostacking=1; 
     652                } else { 
     653                    $fielddraw='STACK'; 
     654                } 
     655            } 
     656 
    590657            # Getting name of rrd file 
    591             $filename = &munin_get_rrd_filename ($node, $config, $domain, $name, $service, $field, $path); 
     658            $filename = &munin_get_rrd_filename ($node, $config, $domain, 
     659                                                 $name, $service, $field, 
     660                                                 $path); 
    592661 
    593662            my $update = RRDs::last ($filename); 
    594663            $update = 0 if ! defined $update; 
    595             if ($update > $lastupdate) 
    596             { 
     664            if ($update > $lastupdate) { 
    597665                $lastupdate = $update; 
    598666            } 
    599667 
    600             my $rrdfield = ($node->{client}->{$service}->{$field.".rrdfield"} || "42"); 
    601             my $single_value = $force_single_value || &single_value ($node, $config, $domain, $name, $service, $field, \@field_order); 
    602             my $has_negative = exists $node->{client}->{$service}->{$field.".negative"}; 
     668            # It does not look like $fieldname.rrdfield is possible to set 
     669            my $rrdfield = ($node->{client}->{$service}->{$field.".rrdfield"} 
     670                            || "42"); 
     671 
     672            my $single_value = $force_single_value || 
     673              &single_value ($node, $config, $domain, $name, 
     674                             $service, $field, \@field_order); 
     675 
     676            my $has_negative = 
     677              exists $node->{client}->{$service}->{$field.".negative"}; 
    603678 
    604679            # Trim the fieldname to make room for other field names. 
    605680            $rrdname = &get_field_name ($field); 
    606             if ($rrdname ne $field) # A change was made 
    607             { 
     681            if ($rrdname ne $field) { 
     682               # A change was made 
    608683                set_cdef_name ($node->{client}->{$service}, $field, $rrdname); 
    609684            } 
     
    615690            push (@rrd, "DEF:a$rrdname=" . 
    616691                  $filename . ":" . $rrdfield . ":MAX"); 
    617             if (exists $node->{client}->{$service}->{$field.".onlynullcdef"} and $node->{client}->{$service}->{$field.".onlynullcdef"}) 
    618             { 
    619                 push (@rrd, "CDEF:c$rrdname=g$rrdname" . (($now-$update)>900 ? ",POP,UNKN" : "")); 
    620             } 
    621             if (($node->{client}->{$service}->{$field.".type"}||"GAUGE") ne "GAUGE" and graph_by_minute ($config, $domain, $name, $service)) 
    622             { 
    623                 push (@rrd, &expand_cdef($node->{client}->{$service}, \$rrdname, "$field,60,*")); 
    624             } 
    625             if ($node->{client}->{$service}->{$field.".cdef"}) 
    626             { 
    627                 push (@rrd, &expand_cdef($node->{client}->{$service}, \$rrdname, $node->{client}->{$service}->{$field.".cdef"})); 
     692 
     693            if (exists $node->{client}->{$service}->{$field.".onlynullcdef"} 
     694                and 
     695                $node->{client}->{$service}->{$field.".onlynullcdef"}) { 
     696                push (@rrd, "CDEF:c$rrdname=g$rrdname" . 
     697                      (($now-$update)>900 ? ",POP,UNKN" : "")); 
     698            } 
     699 
     700            if (($node->{client}->{$service}->{$field.".type"}||"GAUGE") 
     701                ne "GAUGE" 
     702                and graph_by_minute ($config, $domain, $name, $service)) { 
     703                push (@rrd, &expand_cdef($node->{client}->{$service}, 
     704                                         \$rrdname, "$field,60,*")); 
     705            } 
     706 
     707            if ($node->{client}->{$service}->{$field.".cdef"}) { 
     708                push (@rrd,&expand_cdef($node->{client}->{$service}, 
     709                                        \$rrdname, 
     710                                        $node->{client}->{$service}->{$field.".cdef"})); 
    628711                push (@rrd, "CDEF:c$rrdname=g$rrdname"); 
    629712                print "DEBUG: Field name after cdef set to $rrdname\n" if $DEBUG; 
    630             } 
    631             elsif (!(exists $node->{client}->{$service}->{$field.".onlynullcdef"} and $node->{client}->{$service}->{$field.".onlynullcdef"})) 
    632             { 
     713            } elsif (!(exists $node->{client}->{$service}->{$field.".onlynullcdef"} 
     714                       and $node->{client}->{$service}->{$field.".onlynullcdef"})) { 
    633715                push (@rrd, "CDEF:c$rrdname=g$rrdname" . (($now-$update)>900 ? ",POP,UNKN" : "")); 
    634716            } 
     
    637719            print "DEBUG: Drawing field \"$field\".\n" if $DEBUG; 
    638720 
    639             if ($single_value) # Only one field. Do min/max range.      
    640             { 
     721            if ($single_value) { 
     722               # Only one field. Do min/max range.      
    641723                push (@rrd, "CDEF:min_max_diff=a$rrdname,i$rrdname,-"); 
    642724                push (@rrd, "CDEF:re_zero=min_max_diff,min_max_diff,-")  
     
    648730            } 
    649731 
    650             if ($has_negative and !@rrd_negatives) # Push "global" headers... 
    651             { 
     732            if ($has_negative and !@rrd_negatives) { # Push "global" headers... 
    652733                push (@rrd, "COMMENT:" . (" " x $max_field_len)); 
    653734                push (@rrd, "COMMENT:Cur (-/+)"); 
     
    655736                push (@rrd, "COMMENT:Avg (-/+)"); 
    656737                push (@rrd, "COMMENT:Max (-/+) \\j"); 
    657             } 
    658             elsif ($global_headers == 1) 
    659             { 
     738            } elsif ($global_headers == 1) { 
    660739                push (@rrd, "COMMENT:" . (" " x $max_field_len)); 
    661740                push (@rrd, "COMMENT: Cur$RRDkludge:"); 
     
    666745            } 
    667746 
    668             push (@rrd, ($node->{client}->{$service}->{$field.".draw"} || "LINE2") . 
    669                   ":g$rrdname" .  
    670                   ($single_value ? $single_colour : $COLOUR[$field_count++%@COLOUR]) . ":" . 
     747            my $colour; 
     748 
     749            if (exists $node->{client}->{$service}->{$field.".colour"}) { 
     750                $colour = "#". 
     751                  $node->{client}->{$service}->{$field.".colour"}; 
     752            } elsif ($single_value) { 
     753                $colour = $single_colour; 
     754            } else { 
     755                $colour = $COLOUR[$field_count%@COLOUR]; 
     756            } 
     757 
     758            $field_count++; 
     759 
     760            push (@rrd, $fielddraw . ":g$rrdname" . $colour . ":" . 
    671761                  (escape ($node->{client}->{$service}->{"$field.label"}) || escape ($field)) 
    672762                  . (" " x ($max_field_len + 1 - 
    673763                            length ($node->{client}->{$service}->{"$field.label"} || $field)))); 
    674764 
    675             # Check for negative fields (typically network traffic) 
    676             if ($has_negative) 
    677             { 
     765            # Check for negative fields (typically network (or disk) traffic) 
     766            if ($has_negative) { 
    678767                my $negfield = &orig_to_cdef ($node->{client}->{$service}, $node->{client}->{$service}->{$field.".negative"}); 
    679768                print "DEBUG: negfield = $negfield\n" if $DEBUG; 
    680                 if (exists $node->{client}->{$service}->{$negfield.".realname"}) 
    681                 { 
     769                if (exists $node->{client}->{$service}->{$negfield.".realname"}) { 
    682770                    $negfield = $node->{client}->{$service}->{$negfield.".realname"}; 
    683771                } 
    684772                 
    685                 if (!@rrd_negatives) # zero-line, to redraw zero afterwards. 
    686                 { 
     773                if (!@rrd_negatives) { 
     774                    # zero-line, to redraw zero afterwards. 
    687775                    push (@rrd_negatives, "CDEF:re_zero=g$negfield,UN,0,0,IF"); 
    688776                } 
     
    690778                push (@rrd_negatives, "CDEF:ng$negfield=g$negfield,-1,*"); 
    691779 
    692                 if ($single_value) # Only one field. Do min/max range.   
    693                 { 
    694                         push (@rrd, "CDEF:neg_min_max_diff=i$negfield,a$negfield,-"); 
    695                         push (@rrd, "CDEF:ni$negfield=i$negfield,-1,*"); 
    696                         push (@rrd, "AREA:ni$negfield#ffffff"); 
    697                         push (@rrd, "STACK:neg_min_max_diff$range_colour"); 
    698                 } 
    699  
    700                 push (@rrd_negatives, ($node->{client}->{$service}->{$negfield.".draw"} || "LINE2") . 
    701                     ":ng$negfield" .  
    702                     ((defined $single_value and $single_value) ? $single_colour : $COLOUR[($field_count-1)%@COLOUR])); 
     780                if ($single_value) { 
     781                    # Only one field. Do min/max range.  
     782                    push (@rrd, "CDEF:neg_min_max_diff=i$negfield,a$negfield,-"); 
     783                    push (@rrd, "CDEF:ni$negfield=i$negfield,-1,*"); 
     784                    push (@rrd, "AREA:ni$negfield#ffffff"); 
     785                    push (@rrd, "STACK:neg_min_max_diff$range_colour"); 
     786                } 
     787 
     788                push (@rrd_negatives, $fielddraw . ":ng$negfield" . $colour ); 
    703789 
    704790                # Draw HRULEs 
    705791                my $linedef = munin_get ($config, "line", undef, $domain, $name, $service, $node->{client}->{$service}->{$field.".negative"}); 
    706                 if ($linedef) 
    707                 { 
    708                     my ($number, $colour, $label) = split (/:/, $linedef, 3); 
     792                if ($linedef) { 
     793                    my ($number, $ldcolour, $label) = split (/:/, $linedef, 3); 
    709794                    push (@rrd_negatives, "HRULE:".$number. 
    710                         ($colour ? "#$colour" : 
    711                           ((defined $single_value and $single_value) ? "#ff0000" : $COLOUR[($field_count-1)%@COLOUR])) 
    712                         ); 
    713                 } 
    714                 elsif ($node->{client}->{$service}->{"$negfield.warn"}) 
    715                 { 
     795                        ($ldcolour ? "#$ldcolour" : $colour)); 
     796 
     797                } elsif ($node->{client}->{$service}->{"$negfield.warn"}) { 
    716798                    push (@rrd_negatives, "HRULE:".$node->{client}->{$service}->{$node->{client}->{$service}->{$field.".negative"}.".warn"}. 
    717                         ((defined $single_value and $single_value) ? "#ff0000" : $COLOUR[($field_count-1)%@COLOUR])); 
    718                 } 
    719  
    720                 push (@rrd, "GPRINT:c$negfield:LAST:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, 1)?"%s":"") . "/\\g"); 
    721                 push (@rrd, "GPRINT:c$rrdname:LAST:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, 1)?"%s":"") . ""); 
    722                 push (@rrd, "GPRINT:i$negfield:MIN:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, 1)?"%s":"") . "/\\g"); 
    723                 push (@rrd, "GPRINT:i$rrdname:MIN:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, 1)?"%s":"") . ""); 
    724                 push (@rrd, "GPRINT:g$negfield:AVERAGE:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, 1)?"%s":"") . "/\\g"); 
    725                 push (@rrd, "GPRINT:g$rrdname:AVERAGE:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, 1)?"%s":"") . ""); 
    726                 push (@rrd, "GPRINT:a$negfield:MAX:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, 1)?"%s":"") . "/\\g"); 
    727                 push (@rrd, "GPRINT:a$rrdname:MAX:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, 1)?"%s":"") . "\\j"); 
     799                          (defined $single_value and $single_value) ? "#ff0000" : $colour); 
     800                } 
     801 
     802                push (@rrd, "GPRINT:c$negfield:LAST:$rrdformat" . $rrdscale . "/\\g"); 
     803                push (@rrd, "GPRINT:c$rrdname:LAST:$rrdformat" . $rrdscale . ""); 
     804                push (@rrd, "GPRINT:i$negfield:MIN:$rrdformat" . $rrdscale . "/\\g"); 
     805                push (@rrd, "GPRINT:i$rrdname:MIN:$rrdformat" . $rrdscale . ""); 
     806                push (@rrd, "GPRINT:g$negfield:AVERAGE:$avgformat" . $rrdscale . "/\\g"); 
     807                push (@rrd, "GPRINT:g$rrdname:AVERAGE:$avgformat" . $rrdscale . ""); 
     808                push (@rrd, "GPRINT:a$negfield:MAX:$rrdformat" . $rrdscale . "/\\g"); 
     809                push (@rrd, "GPRINT:a$rrdname:MAX:$rrdformat" . $rrdscale . "\\j"); 
    728810                push (@{$total_pos{'min'}}, "i$rrdname"); 
    729811                push (@{$total_pos{'avg'}}, "g$rrdname"); 
     
    732814                push (@{$total_neg{'avg'}}, "g$negfield"); 
    733815                push (@{$total_neg{'max'}}, "a$negfield"); 
    734             } 
    735             else 
    736             { 
     816            } else { 
    737817                push (@rrd, "COMMENT: Cur$RRDkludge:") unless $global_headers; 
    738                 push (@rrd, "GPRINT:c$rrdname:LAST:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, "yes")?"%s":"") . ""); 
     818                push (@rrd, "GPRINT:c$rrdname:LAST:$rrdformat" . $rrdscale . ""); 
    739819                push (@rrd, "COMMENT: Min$RRDkludge:") unless $global_headers; 
    740                 push (@rrd, "GPRINT:i$rrdname:MIN:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, 1)?"%s":"") . ""); 
     820                push (@rrd, "GPRINT:i$rrdname:MIN:$rrdformat" . $rrdscale . ""); 
    741821                push (@rrd, "COMMENT: Avg$RRDkludge:") unless $global_headers; 
    742                 push (@rrd, "GPRINT:g$rrdname:AVERAGE:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, 1)?"%s":"") . ""); 
     822                push (@rrd, "GPRINT:g$rrdname:AVERAGE:$avgformat" . $rrdscale . ""); 
    743823                push (@rrd, "COMMENT: Max$RRDkludge:") unless $global_headers; 
    744                 push (@rrd, "GPRINT:a$rrdname:MAX:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, 1)?"%s":"") . "\\j"); 
     824                push (@rrd, "GPRINT:a$rrdname:MAX:$rrdformat" . $rrdscale . "\\j"); 
    745825                push (@{$total_pos{'min'}}, "i$rrdname"); 
    746826                push (@{$total_pos{'avg'}}, "g$rrdname"); 
     
    748828            } 
    749829 
    750  
    751830            # Draw HRULEs 
    752831            my $linedef = munin_get ($config, "line", undef, $domain, $name, $service, $field); 
    753             if ($linedef) 
    754             { 
    755                 my ($number, $colour, $label) = split (/:/, $linedef, 3); 
     832            if ($linedef) { 
     833                my ($number, $ldcolour, $label) = split (/:/, $linedef, 3); 
    756834                $label =~ s/:/\\:/g if defined $label; 
    757835                push (@rrd, "HRULE:".$number. 
    758                     ($colour ? "#$colour" : 
    759                       ((defined $single_value and $single_value) ? "#ff0000" : $COLOUR[($field_count-1)%@COLOUR])) . 
    760                       ((defined $label and length ($label)) ? ":$label" : ""),  
     836                    ($ldcolour ? "#$ldcolour" : 
     837                      ((defined $single_value and $single_value) ? 
     838                       "#ff0000" : $colour)). 
     839                      ((defined $label and length ($label)) ? ":$label" : ""), 
    761840                      "COMMENT: \\j" 
    762841                    ); 
    763             } 
    764             elsif ($node->{client}->{$service}->{"$field.warn"}) 
    765             { 
    766                 push (@rrd, "HRULE:".$node->{client}->{$service}->{"$field.warn"}.($single_value ? "#ff0000" : $COLOUR[($field_count-1)%@COLOUR])); 
    767             } 
    768         } 
    769  
    770         if (@rrd_negatives) 
    771         { 
     842            } elsif ($node->{client}->{$service}->{"$field.warn"}) { 
     843                push (@rrd,"HRULE:". 
     844                      $node->{client}->{$service}->{"$field.warn"}. 
     845                      ($single_value ? "#ff0000" : $colour)); 
     846            } 
     847        } 
     848 
     849        if (@rrd_negatives) { 
    772850            push (@rrd, @rrd_negatives); 
    773851            push (@rrd, "LINE2:re_zero#000000"); # Redraw zero. 
    774             if (exists $node->{client}->{$service}->{graph_total} and  
    775                     exists $total_pos{'min'} and exists $total_neg{'min'} and  
    776                     @{$total_pos{'min'}} and @{$total_neg{'min'}}) 
    777             { 
     852            if (exists $node->{client}->{$service}->{graph_total} and 
     853                exists $total_pos{'min'} and exists $total_neg{'min'} and 
     854                @{$total_pos{'min'}} and @{$total_neg{'min'}}) { 
     855 
    778856                push (@rrd, "CDEF:ipostotal=".join (",", map { "$_,UN,0,$_,IF" } @{$total_pos{'min'}}).(",+" x (@{$total_pos{'min'}}-1))); 
    779857                push (@rrd, "CDEF:gpostotal=".join (",", map { "$_,UN,0,$_,IF" } @{$total_pos{'avg'}}).(",+" x (@{$total_pos{'avg'}}-1))); 
     
    784862                push (@rrd, "CDEF:dpostotal=ipostotal,UN,ipostotal,UNKN,IF"); 
    785863                push (@rrd, "LINE1:dpostotal#000000:" . $node->{client}->{$service}->{graph_total} . (" " x ($max_field_len - length ($node->{client}->{$service}->{graph_total}) + 1))); 
    786                 push (@rrd, "GPRINT:gnegtotal:LAST:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, 1)?"%s":"") . "/\\g"); 
    787                 push (@rrd, "GPRINT:gpostotal:LAST:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, 1)?"%s":"") . ""); 
    788                 push (@rrd, "GPRINT:inegtotal:MIN:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, 1)?"%s":"") . "/\\g"); 
    789                 push (@rrd, "GPRINT:ipostotal:MIN:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, 1)?"%s":"") . ""); 
    790                 push (@rrd, "GPRINT:gnegtotal:AVERAGE:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, 1)?"%s":"") . "/\\g"); 
    791                 push (@rrd, "GPRINT:gpostotal:AVERAGE:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, 1)?"%s":"") . ""); 
    792                 push (@rrd, "GPRINT:anegtotal:MAX:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, 1)?"%s":"") . "/\\g"); 
    793                 push (@rrd, "GPRINT:apostotal:MAX:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, 1)?"%s":"") . "\\j"); 
    794             } 
    795         } 
    796         elsif (exists $node->{client}->{$service}->{graph_total} and exists $total_pos{'min'} and @{$total_pos{'min'}}) 
    797         { 
     864                push (@rrd, "GPRINT:gnegtotal:LAST:$rrdformat" . $rrdscale . "/\\g"); 
     865                push (@rrd, "GPRINT:gpostotal:LAST:$rrdformat" . $rrdscale . ""); 
     866                push (@rrd, "GPRINT:inegtotal:MIN:$rrdformat" . $rrdscale . "/\\g"); 
     867                push (@rrd, "GPRINT:ipostotal:MIN:$rrdformat" . $rrdscale . ""); 
     868                push (@rrd, "GPRINT:gnegtotal:AVERAGE:$avgformat" . $rrdscale . "/\\g"); 
     869                push (@rrd, "GPRINT:gpostotal:AVERAGE:$avgformat" . $rrdscale . ""); 
     870                push (@rrd, "GPRINT:anegtotal:MAX:$rrdformat" . $rrdscale . "/\\g"); 
     871                push (@rrd, "GPRINT:apostotal:MAX:$rrdformat" . $rrdscale . "\\j"); 
     872            } 
     873        } 
     874        elsif (exists $node->{client}->{$service}->{graph_total} and exists $total_pos{'min'} and @{$total_pos{'min'}}) { 
    798875            push (@rrd, "CDEF:ipostotal=".join (",", map { "$_,UN,0,$_,IF" } @{$total_pos{'min'}}).(",+" x (@{$total_pos{'min'}}-1))); 
    799876            push (@rrd, "CDEF:gpostotal=".join (",", map { "$_,UN,0,$_,IF" } @{$total_pos{'avg'}}).(",+" x (@{$total_pos{'avg'}}-1))); 
    800877            push (@rrd, "CDEF:apostotal=".join (",", map { "$_,UN,0,$_,IF" } @{$total_pos{'max'}}).(",+" x (@{$total_pos{'max'}}-1))); 
    801              
     878 
    802879            push (@rrd, "CDEF:dpostotal=ipostotal,UN,ipostotal,UNKN,IF"); 
    803880            push (@rrd, "LINE1:dpostotal#000000:" . $node->{client}->{$service}->{graph_total} . (" " x ($max_field_len - length ($node->{client}->{$service}->{graph_total}) + 1))); 
    804881            push (@rrd, "COMMENT: Cur$RRDkludge:") unless $global_headers; 
    805             push (@rrd, "GPRINT:gpostotal:LAST:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, 1)?"%s":"") . ""); 
     882            push (@rrd, "GPRINT:gpostotal:LAST:$rrdformat" . $rrdscale . ""); 
    806883            push (@rrd, "COMMENT: Min$RRDkludge:") unless $global_headers; 
    807             push (@rrd, "GPRINT:ipostotal:MIN:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, 1)?"%s":"") . ""); 
     884            push (@rrd, "GPRINT:ipostotal:MIN:$rrdformat" . $rrdscale . ""); 
    808885            push (@rrd, "COMMENT: Avg$RRDkludge:") unless $global_headers; 
    809             push (@rrd, "GPRINT:gpostotal:AVERAGE:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, 1)?"%s":"") . ""); 
     886            push (@rrd, "GPRINT:gpostotal:AVERAGE:$avgformat" . $rrdscale .""); 
    810887            push (@rrd, "COMMENT: Max$RRDkludge:") unless $global_headers; 
    811             push (@rrd, "GPRINT:apostotal:MAX:%6.2lf" . (munin_get_bool_val ($node->{client}->{$service}->{graph_scale}, 1)?"%s":"") . "\\j"); 
     888            push (@rrd, "GPRINT:apostotal:MAX:$rrdformat" . $rrdscale . "\\j"); 
    812889        } 
    813890 
    814891        for my $time (keys %times) { 
    815892            next unless ($draw{$time}); 
    816             my @complete; 
     893            my @complete = (); 
     894            if ($RRDkludge) { 
     895                push (@complete, 
     896                      '--font' ,'LEGEND:7:@@LIBDIR@@/VeraMono.ttf', 
     897                      '--font' ,'UNIT:7:@@LIBDIR@@/VeraMono.ttf', 
     898                      '--font' ,'AXIS:7:@@LIBDIR@@/VeraMono.ttf'); 
     899            } 
     900 
    817901            logger ("Processing $name -> $time") if $DEBUG; 
    818902 
    819903            # Do the header (title, vtitle, size, etc...) 
    820904            push @complete, @{&get_header ($node, $config, $domain, $name, $service, $time)}; 
     905            if ($LINEkluge) { 
     906                @rrd = map { s/LINE3:/LINE2.2:/; $_; } @rrd; 
     907                @rrd = map { s/LINE2:/LINE1.6:/; $_; } @rrd; 
     908                # LINE1 is thin enough. 
     909            } 
    821910            push @complete, @rrd; 
    822911 
    823             push (@complete, "COMMENT:Last update$RRDkludge: " . RRDescape(scalar localtime($lastupdate)) .  "\\r"); 
    824              
    825             if (time - 300 < $lastupdate) 
    826             { 
    827                     push @complete, "--end",(int($lastupdate/$resolutions{$time}))*$resolutions{$time}; 
    828             } 
    829             print "\n\nrrdtool \"graph\" \"", join ("\"\n\t\"",@complete), "\"\n" if $DEBUG; 
     912            push (@complete, "COMMENT:Last update$RRDkludge: " .  
     913                  RRDescape(scalar localtime($lastupdate)) .  "\\r"); 
     914 
     915            if (time - 300 < $lastupdate) { 
     916                push @complete, "--end", 
     917                  (int($lastupdate/$resolutions{$time}))*$resolutions{$time}; 
     918            } 
     919            print "\n\nrrdtool \"graph\" \"", 
     920              join ("\"\n\t\"",@complete), "\"\n" if $DEBUG; 
    830921            RRDs::graph (@complete); 
    831922            if (my $ERROR = RRDs::error) { 
    832923                logger ("Unable to graph $filename: $ERROR"); 
    833             } 
    834             elsif ($list_images) # Command-line option to list images created 
    835             { 
    836                 print &munin_get_picture_filename ($config, $domain, $name, $service, $time), "\n"; 
    837             } 
    838         } 
    839  
    840         if (&munin_get_bool_val ($node->{client}->{$service}->{"graph_sums"}, 0)) 
    841         { 
    842             foreach my $time (keys %sumtimes) 
    843             { 
     924            } elsif ($list_images) { 
     925                # Command-line option to list images created 
     926                print &munin_get_picture_filename ($config, $domain, $name, 
     927                                                   $service, $time),"\n"; 
     928            } 
     929        } 
     930 
     931        if (&munin_get_bool_val ($node->{client}->{$service}->{"graph_sums"}, 0)) { 
     932            foreach my $time (keys %sumtimes) { 
    844933                next unless ($draw{"sum".$time}); 
    845934                my @rrd_sum; 
    846935                push @rrd_sum, @{&get_header ($node, $config, $domain, $name, $service, $time, 1)}; 
    847936 
    848                 if (time - 300 < $lastupdate) 
    849                 { 
    850                         push @rrd_sum, "--end",(int($lastupdate/$resolutions{$time}))*$resolutions{$time}; 
     937                if (time - 300 < $lastupdate) { 
     938                    push @rrd_sum, "--end",(int($lastupdate/$resolutions{$time}))*$resolutions{$time}; 
    851939                } 
    852940                push @rrd_sum, @rrd; 
     
    855943                my $labelled = 0; 
    856944                my @defined = (); 
    857                 for (my $index = 0; $index <= $#rrd_sum; $index++) 
    858                 { 
    859                     if ($rrd_sum[$index] =~ /^(--vertical-label|-v)$/) 
    860                     { 
     945                for (my $index = 0; $index <= $#rrd_sum; $index++) { 
     946                    if ($rrd_sum[$index] =~ /^(--vertical-label|-v)$/) { 
    861947                        (my $label = $node->{client}->{$service}->{graph_vlabel}) =~ s/\$\{graph_period\}/$sumtimes{$time}[0]/g; 
    862948                        splice (@rrd_sum, $index, 2, ("--vertical-label", $label)); 
    863949                        $index++; 
    864950                        $labelled++; 
    865                     } 
    866                     elsif ($rrd_sum[$index] =~ /^(LINE[123]|STACK|AREA|GPRINT):([^#:]+)([#:].+)$/) 
    867                     { 
     951                    } elsif ($rrd_sum[$index] =~ /^(LINE[123]|STACK|AREA|GPRINT):([^#:]+)([#:].+)$/) { 
    868952                        my ($pre, $fname, $post) = ($1, $2, $3); 
    869953                        next if $fname eq "re_zero"; 
    870                         if ($post =~ /^:AVERAGE/) 
    871                         { 
     954                        if ($post =~ /^:AVERAGE/) { 
    872955                            splice (@rrd_sum, $index, 1, $pre . ":x$fname" . $post); 
    873956                            $index++; 
     
    878961                        my @replace; 
    879962 
    880                         if (!defined ($node->{client}->{$service}->{$fname.".type"}) or $node->{client}->{$service}->{$fname.".type"} ne "GAUGE") 
    881                        
    882                             if ($time eq "week") 
    883                             { # Every plot is half an hour. Add two plots and multiply, to get per hour 
    884                                 if (graph_by_minute ($config, $domain, $name, $service)) 
    885                                 { # Already multiplied by 60 
     963                        if (!defined ($node->{client}->{$service}->{$fname.".type"}) or 
     964                            $node->{client}->{$service}->{$fname.".type"} ne "GAUGE")
     965                            if ($time eq "week") { 
     966                               # Every plot is half an hour. Add two plots and multiply, to get per hour 
     967                                if (graph_by_minute ($config, $domain, $name, $service)) { 
     968                                    # Already multiplied by 60 
    886969                                    push @replace, "CDEF:x$fname=PREV($fname),UN,0,PREV($fname),IF,$fname,+,5,*,6,*"; 
    887                                 } 
    888                                 else 
    889                                 { 
     970                                } else { 
    890971                                    push @replace, "CDEF:x$fname=PREV($fname),UN,0,PREV($fname),IF,$fname,+,300,*,6,*"; 
    891972                                } 
    892                             } 
    893                             else 
    894                             { # Every plot is one day exactly. Just multiply. 
    895                                 if (graph_by_minute ($config, $domain, $name, $service)) 
    896                                 { # Already multiplied by 60 
     973                            } else { 
     974                                # Every plot is one day exactly. Just multiply. 
     975                                if (graph_by_minute ($config, $domain, $name, $service)) { 
     976                                    # Already multiplied by 60 
    897977                                    push @replace, "CDEF:x$fname=$fname,5,*,288,*"; 
    898                                 } 
    899                                 else 
    900                                 { 
     978                                } else { 
    901979                                    push @replace, "CDEF:x$fname=$fname,300,*,288,*"; 
    902980                                } 
     
    906984                        splice (@rrd_sum, $index, 1, @replace); 
    907985                        $index++; 
    908                     } 
    909                     elsif ($rrd_sum[$index] =~ /^(--lower-limit|--upper-limit|-l|-u)$/) 
    910                     { 
     986                    } elsif ($rrd_sum[$index] =~ /^(--lower-limit|--upper-limit|-l|-u)$/) { 
    911987                        $index++; 
    912988                        $rrd_sum[$index] = $rrd_sum[$index] * 300 * $sumtimes{$time}->[1]; 
    913989                    } 
    914990                } 
    915                 unless ($labelled) 
    916                
     991 
     992                unless ($labelled)
    917993                    my $label = $node->{client}->{$service}->{"graph_vlabel_sum_$time"} || $sumtimes{$time}->[0]; 
    918994                    unshift @rrd_sum, "--vertical-label", $label; 
     
    921997                print "\n\nrrdtool \"graph\" \"", join ("\"\n\t\"",@rrd_sum), "\"\n" if $DEBUG; 
    922998                RRDs::graph (@rrd_sum); 
     999 
    9231000                if (my $ERROR = RRDs::error) { 
    9241001                    logger ("Unable to graph $filename: $ERROR"); 
    925                 } 
    926                 elsif ($list_images) # Command-line option to list images created 
    927                 { 
     1002                } elsif ($list_images) { 
     1003                    # Command-line option to list images created 
    9281004                    print &munin_get_picture_filename ($config, $domain, $name, $service, $time, 1), "\n"; 
    9291005                } 
     
    9351011        print STATS "GS|$domain|$name|$service|$service_time\n" unless $skip_stats; 
    9361012 
    937         foreach (@added) 
    938         { 
    939             delete $node->{client}->{$service}->{$_} if exists $node->{client}->{$service}->{$_}; 
     1013        foreach (@added) { 
     1014            delete $node->{client}->{$service}->{$_} 
     1015            if exists $node->{client}->{$service}->{$_}; 
    9401016        } 
    9411017        @added = (); 
    9421018    } 
    943      
    944 
    945  
    946 sub graph_by_minute 
    947 
     1019
     1020 
     1021sub graph_by_minute { 
    9481022    my $config  = shift; 
    9491023    my $domain  = shift; 
     
    9541028} 
    9551029 
    956 sub orig_to_cdef 
    957 
     1030sub orig_to_cdef { 
    9581031    my $service = shift; 
    9591032    my $field   = shift; 
     
    9661039} 
    9671040 
    968 sub set_cdef_name 
    969 
     1041sub set_cdef_name { 
    9701042    my $service = shift; 
    9711043    my $field   = shift; 
     
    9761048} 
    9771049 
    978 sub skip_service 
    979 
     1050sub skip_service { 
    9801051    my $node = shift; 
    9811052    my $service = shift; 
     
    9961067} 
    9971068 
    998 sub expand_cdef 
    999 
     1069sub expand_cdef { 
    10001070    my $service     = shift; 
    10011071    my $cfield_ref  = shift; 
     
    11841254about any off-limit values. 
    11851255 
    1186 munin-graph does the graphing. It is usually only used from within munin-cron. 
     1256munin-graph does the graphing. It is usually only used from within 
     1257munin-cron.  If munin.conf sets "graph_strategy cgi" then munin-graph 
     1258does no work, instead munin-html generates references to the graphing 
     1259CGI.  Please see http://munin.projects.linpro.no/wiki/CgiHowto for 
     1260more information about CGI grpahing. 
    11871261 
    11881262It checks the rrd-files for updated values, and redraws the graphs if 
    11891263needed. To force redrawing of graphs (after setup-changes et alia), use 
    1190 '--nolazy'.  
     1264'--nolazy'. 
    11911265 
    11921266=head1 FILES 
     
    11971271        @@STATEDIR@@/* 
    11981272 
    1199 =head1 VERSION 
    1200  
    1201 This is munin-graph version 0.9.2-3 
    1202  
    12031273=head1 AUTHORS 
    12041274 
    1205 Audun Ytterdal and Jimmy Olsen
     1275Audun Ytterdal, Jimmy Olsen, Tore Anderson, Nicolai Langfeldt
    12061276 
    12071277=head1 BUGS 
     
    12131283=head1 COPYRIGHT 
    12141284 
    1215 Copyright © 2002-2004 Audun Ytterdal, Jimmy Olsen, and Tore Anderson / Linpro AS. 
     1285Copyright (C) 2002-2006 Audun Ytterdal, Jimmy Olsen, Tore Anderson, and Nicolai Langfeldt 
    12161286 
    12171287This is free software; see the source for copying conditions. There is 
  • people/ilmari/modularisation-branch/server/munin-html.in

    r1012 r1265  
    11#!@@PERL@@ 
     2# -*- perl -*- 
    23# 
    3 # Copyright (C) 2002-2004 Jimmy Olsen, Audun Ytterdal 
     4# Copyright (C) 2002-2006 Jimmy Olsen, Audun Ytterdal 
    45# 
    56# This program is free software; you can redistribute it and/or 
     
    2526use HTML::Template; 
    2627use Getopt::Long; 
     28use Time::HiRes; 
    2729use Munin; 
    2830use POSIX qw(strftime); 
    2931 
    3032my @times = ( "day", "week", "month", "year" ); 
    31  
    3233 
    3334my $DEBUG=0; 
     
    4142 
    4243# Get options 
    43 $do_usage=1  unless  
     44$do_usage=1  unless 
    4445GetOptions ( "host=s"       => \(), 
    4546             "force-root!"  => \$force_root, 
     
    7576Written by Knut Haugen, Audun Ytterdal, Jimmy Olsen, Tore Anderson / Linpro AS 
    7677 
    77 Copyright (C) 2002-2005 
     78Copyright (C) 2002-2006 
    7879 
    7980This is free software released under the GNU General Public License. There 
     
    9394    exit (1); 
    9495} 
     96 
     97my $update_time = Time::HiRes::time; 
    9598 
    9699my $config; 
     
    139142my @domainorder; 
    140143if ($config->{domain_order}) { 
    141     @domainorder = split / /, $config->{domain_order}; 
     144    @domainorder = split /\s+/, $config->{domain_order}; 
    142145} 
    143146foreach my $d (sort (keys %{$config->{domain}})) { 
     
    165168my $timestamp = strftime("%Y-%m-%d T %T", localtime); 
    166169for my $domain (@domainorder) { 
    167     logger("processing domain: $domain"); 
    168     my %domain; 
    169     $domain{domain}=$domain; 
    170     my @nodes; 
    171     my %comparisons; 
    172     my @nodeorder = (); 
    173     if ($config->{domain}->{$domain}->{node_order}) { 
    174         @nodeorder = split / /, $config->{domain}->{$domain}->{node_order}; 
    175     }  
    176     foreach my $n (sort (keys %{$config->{domain}->{$domain}->{node}})) 
    177     { 
    178         unless (grep (/^$n$/, @nodeorder)) 
    179         { 
    180             push @nodeorder, $n; 
    181         } 
    182     } 
    183     for my $node (@nodeorder) { 
    184         logger("processing node: $node"); 
    185         my %node; 
    186         $node{node}=$node; 
    187         $node{url}="$domain/$node.html"; 
    188         my @services; 
    189         my @categories; 
    190         my %categories; 
    191         my %tmp_cats; 
    192         my @serviceorder; 
    193         if ($config->{domain}->{$domain}->{node}->{$node}->{service_order}) { 
    194             @serviceorder = split / /, $config->{domain}->{$domain}->{node}->{$node}->{service_order}; 
     170  logger("processing domain: $domain"); 
     171  my %domain; 
     172  $domain{domain}=$domain; 
     173  my @nodes; 
     174  my %comparisons; 
     175  my @nodeorder = (); 
     176  if ($config->{domain}->{$domain}->{node_order}) { 
     177    @nodeorder = split /\s+/, $config->{domain}->{$domain}->{node_order}; 
     178  } 
     179  foreach my $n (sort (keys %{$config->{domain}->{$domain}->{node}})) { 
     180    unless (grep (/^$n$/, @nodeorder)) { 
     181      push @nodeorder, $n; 
     182    } 
     183  } 
     184  for my $node (@nodeorder) { 
     185    logger("processing node: $node"); 
     186    my %node; 
     187    $node{node}=$node; 
     188    $node{url}="$domain/$node.html"; 
     189    my @services; 
     190    my @categories; 
     191    my %categories; 
     192    my %tmp_cats; 
     193    my @serviceorder; 
     194    if ($config->{domain}->{$domain}->{node}->{$node}->{service_order}) { 
     195      @serviceorder = split /\s+/, 
     196        $config->{domain}->{$domain}->{node}->{$node}->{service_order}; 
     197    } else { 
     198      @serviceorder = sort 
     199        keys %{$config->{domain}->{$domain}->{node}->{$node}->{client}}; 
     200    } 
     201 
     202    for my $service (@serviceorder) { 
     203      logger("processing service: $service"); 
     204      next unless 
     205        defined($config->{domain}->{$domain}->{node}->{$node}->{client}->{$service} ) 
     206        &&  $config->{domain}->{$domain}->{node}->{$node}->{client}->{$service} ne ""; 
     207 
     208      next unless 
     209        munin_get_bool ($config, "graph", 1, $domain, $node, $service); 
     210 
     211      my @service; 
     212      my %service; 
     213      my $fieldnum = 0; 
     214      my @graph_info; 
     215      my @field_info; 
     216      $service{service}=$service; 
     217      $service{label}= 
     218        $config->{domain}->{$domain}->{node}->{$node}->{client}-> 
     219          {$service}->{graph_title}; 
     220 
     221      my $method = &munin_get ($config, "graph_strategy", "cron"); 
     222      if ($method eq "cgi") { 
     223        $service{imgday}=$config->{'cgiurl_graph'}. 
     224          "/$domain/$node/$service-day.png"; 
     225        $service{imgweek}=$config->{'cgiurl_graph'}. 
     226          "/$domain/$node/$service-week.png"; 
     227        $service{imgmonth}=$config->{'cgiurl_graph'}. 
     228          "/$domain/$node/$service-month.png"; 
     229        $service{imgyear}=$config->{'cgiurl_graph'}. 
     230          "/$domain/$node/$service-year.png"; 
     231 
     232        if (&munin_get_bool_val($config->{domain}->{$domain}-> 
     233                                {node}->{$node}-> 
     234                                {client}->{$service}->{"graph_sums"}, 0)) { 
     235          $service{imgweeksum} = 
     236            $config->{'cgiurl_graph'}."/$domain/$node/$service-week-sum.png"; 
     237          $service{imgyearsum} = 
     238            $config->{'cgiurl_graph'}."/$domain/$node/$service-year-sum.png"; 
     239        } 
     240 
     241# There is a disturbance in the force here, the sizes are off. 
     242#       if (my ($w, $h) = 
     243#           &calculate_png_size ($config, $domain, $node, $service)) { 
     244#         for my $scale (@times) { 
     245#           $service{"img".$scale."width"} = $w; 
     246#           $service{"img".$scale."height"} = $h; 
     247#         } 
     248#         if (&munin_get_bool_val($config->{domain}->{$domain}-> 
     249#                                 {node}->{$node}-> 
     250#                                 {client}->{$service}->{"graph_sums"}, 0)) { 
     251#           for my $scale (["week", "year"]) { 
     252#             $service{"img".$scale."sumwidth"} = $w; 
     253#             $service{"img".$scale."sumheight"} = $h; 
     254#           } 
     255#         } 
     256#       } 
     257      } else { 
     258        # graph strategy cron 
     259        $service{imgday}="$node-$service-day.png"; 
     260        $service{imgweek}="$node-$service-week.png"; 
     261        $service{imgmonth}="$node-$service-month.png"; 
     262        $service{imgyear}="$node-$service-year.png"; 
     263 
     264        for my $scale (@times) { 
     265          if (my ($w, $h) = 
     266              &get_png_size(&munin_get_picture_filename($config, $domain, 
     267                                                        $node, $service, 
     268                                                        $scale))) { 
     269            $service{"img".$scale."width"} = $w; 
     270            $service{"img".$scale."height"} = $h; 
     271          } 
     272        } 
     273 
     274        if (&munin_get_bool_val ($config->{domain}->{$domain}-> 
     275                                 {node}->{$node}->{client}-> 
     276                                 {$service}->{"graph_sums"}, 0)) { 
     277          $service{imgweeksum} = "$node-$service-week-sum.png"; 
     278          $service{imgyearsum} = "$node-$service-year-sum.png"; 
     279          for my $scale (["week", "year"]) { 
     280            if (my ($w, $h) = 
     281                &get_png_size (&munin_get_picture_filename($config,$domain, 
     282                                                           $node, $service, 
     283                                                           $scale, 1))) { 
     284              $service{"img".$scale."sumwidth"} = $w; 
     285              $service{"img".$scale."sumheight"} = $h; 
     286            } 
     287          } 
     288        } 
     289      } 
     290      $service{url}="$node-$service.html"; 
     291      $service{domain}="$domain"; 
     292      $service{node}=$node; 
     293      $service{category}= lc( $config->{domain}->{$domain}-> 
     294                              {node}->{$node}->{client}-> 
     295                              {$service}->{graph_category} || "other" ); 
     296 
     297      # Do "help" section 
     298      if (defined($config->{domain}->{$domain}-> 
     299                  {node}->{$node}-> 
     300                  {client}->{$service}->{graph_info})) { 
     301        my %graph_info; 
     302 
     303        $graph_info{info} = $config->{domain}->{$domain}-> 
     304          {node}->{$node}->{client}->{$service}->{graph_info}; 
     305 
     306        push @{$service{graphinfo}}, \%graph_info; 
     307      } 
     308 
     309      $service{fieldlist} .= "<tr><th align='left' valign='top'>Field</th><th align='left' valign='top'>Type</th><th align='left' valign='top'>Warn</th><th align='left' valign='top'>Crit</th><th></tr>"; 
     310      # foreach my $field (keys %{$config->{domain}->{$domain}->{node}->{$node}->{client}->{$service}}) 
     311      foreach my $f (@{&munin_get_field_order ($config->{domain}->{$domain}->{node}->{$node}, $config, $domain, $node, $service)}) { 
     312        $f =~ s/=(.*)$//; 
     313        my $path = $1; 
     314        next unless &munin_draw_field ($config->{domain}->{$domain}-> 
     315                                       {node}->{$node}, $service, $f); 
     316 
     317        print "DEBUG: single_value: Checking field \"$f\" ($path).\n" 
     318          if $DEBUG; 
     319 
     320        if (defined $path) { 
     321          # HUH? Get the filename and then forget? Some side effect here? 
     322          munin_get_rrd_filename ($config->{domain}->{$domain}-> 
     323                                  {node}->{$node}, $config, $domain, 
     324                                  $node, $service, $f, $path); 
     325        } 
     326 
     327        my %field_info; 
     328        $fieldnum++; 
     329 
     330        $field_info{'hr'}    = 1 unless ($fieldnum % 3); 
     331        $field_info{'field'} = $f; 
     332        $field_info{'label'} = $config->{domain}->{$domain}-> 
     333          {node}->{$node}->{client}->{$service}->{$f.".label"} || $f; 
     334 
     335        $field_info{'type'}  = lc( $config->{domain}->{$domain}-> 
     336                                   {node}->{$node}->{client}->{$service}-> 
     337                                   {$f.".type"} || "GAUGE" ); 
     338 
     339        $field_info{'warn'}  = $config->{domain}->{$domain}-> 
     340          {node}->{$node}->{client}->{$service}->{$f.".warning"} || "None"; 
     341        $field_info{'crit'}  = $config->{domain}->{$domain}-> 
     342          {node}->{$node}->{client}->{$service}->{$f.".critical"} || "None"; 
     343        $field_info{'info'}  = $config->{domain}->{$domain}-> 
     344          {node}->{$node}->{client}->{$service}->{$f.".info"} || ""; 
     345 
     346        my $state = &munin_field_status ($config, $limits, $domain, 
     347                                         $node, $service, $f, 1); 
     348 
     349        if (defined $state) { 
     350          $field_info{'state_warning'}  = 1 if $state eq "warning"; 
     351          $field_info{'state_critical'} = 1 if $state eq "critical"; 
     352          $field_info{'state_unknown'}  = 1 if $state eq "unknown"; 
     353        } 
     354        push @{$service{fieldinfo}}, \%field_info; 
     355      } 
     356 
     357      { 
     358        my $state = &munin_service_status ($config, $limits, $domain, 
     359                                           $node, $service, 1); 
     360        if (defined $state) { 
     361          $service{'state_warning'}  = 1 if $state eq "warning"; 
     362          $service{'state_critical'} = 1 if $state eq "critical"; 
     363          $service{'state_unknown'}  = 1 if $state eq "unknown"; 
     364        } 
     365      } 
     366 
     367      push @services, \%service; 
     368      push @service, \%service; 
     369      push @{$tmp_cats{$service{'category'}}}, \%service; 
     370      $servicetemplate->param(SERVICES => \@service, 
     371                              SERVICE => $service, 
     372                              NODE => $node, 
     373                              DOMAIN => $domain,  
     374                              DOMAINS => \@domainlist,  
     375                              TIMESTAMP => $timestamp); 
     376      open (FILE, ">$config->{htmldir}/$domain/$node-$service.html") or 
     377        die "Cannot open $config->{htmldir}/$domain/$node-$service.html"; 
     378      print FILE $servicetemplate->output; 
     379      close FILE; 
     380    } 
     381    foreach my $key (keys %tmp_cats) { 
     382      next if $key eq "other"; 
     383      my %tmp; 
     384      my $state = &munin_category_status ($config, $limits, $domain, 
     385                                          $node, $key, 1); 
     386      print "DEBUG: Pushing category \"$node\" -> \"$key\"...\n" if $DEBUG; 
     387      if (defined $state) { 
     388        $tmp{'state_warning'}  = 1 if $state eq "warning"; 
     389        $tmp{'state_critical'} = 1 if $state eq "critical"; 
     390        $tmp{'state_unknown'}  = 1 if $state eq "unknown"; 
     391      } 
     392      $tmp{name} = ucfirst $key; 
     393      $tmp{services} = \@{$tmp_cats{$key}}; 
     394      $tmp{node} = $node; 
     395      $tmp{domain} = $domain; 
     396      $categories{ucfirst $key} = \%tmp; 
     397      $comparisons{$key}{$node} = \%tmp; 
     398    } 
     399    if (defined $tmp_cats{'other'}) { 
     400      my $key = 'other'; 
     401      my %tmp; 
     402      my $state = &munin_category_status ($config, $limits, $domain, 
     403                                          $node, $key, 1); 
     404      print "DEBUG: Pushing category \"$node\" -> \"$key\"...\n" if $DEBUG; 
     405      if (defined $state) { 
     406        $tmp{'state_warning'}  = 1 if $state eq "warning"; 
     407        $tmp{'state_critical'} = 1 if $state eq "critical"; 
     408        $tmp{'state_unknown'}  = 1 if $state eq "unknown"; 
     409      } 
     410      $tmp{name} = ucfirst $key; 
     411      $tmp{services} = \@{$tmp_cats{$key}}; 
     412      $tmp{node} = $node; 
     413      $tmp{domain} = $domain; 
     414      $categories{ucfirst $key} = \%tmp; 
     415      $comparisons{'other'}{$node} = \%tmp; 
     416    } 
     417    # Handle category_order 
     418    @categories = (); 
     419    if ($config->{domain}->{$domain}->{node}->{$node}->{category_order}) { 
     420      foreach my $cat (split /\s+/, 
     421                       $config->{domain}->{$domain}-> 
     422                       {node}->{$node}->{category_order}) { 
     423        push @categories, $categories{ucfirst $cat}; 
     424      } 
     425      foreach my $cat (sort keys %categories) { 
     426        push @categories, $categories{$cat} 
     427          unless (grep { $_->{name} eq $cat } @categories); 
     428      } 
     429    } else { 
     430      @categories = map { $categories{$_} } sort keys %categories; 
     431    } 
     432    $nodetemplate->param(SERVICES => \@services, 
     433                         NODE => $node, 
     434                         DOMAIN => $domain, 
     435                         DOMAINS => \@domainlist, 
     436                         TIMESTAMP => $timestamp, 
     437                         CATEGORIES => \@categories); 
     438    open (FILE, ">$config->{htmldir}/$domain/$node.html") or 
     439      die "Cannot open $config->{htmldir}/$domain/$node.html"; 
     440    print FILE $nodetemplate->output; 
     441    close FILE; 
     442    $node{services} = \@services; 
     443    $node{categories} = \@categories; 
     444    $node{domain} = $domain; 
     445    push @nodes,\%node; 
     446 
     447  } 
     448  $domaintemplate->param(NODES => \@nodes, 
     449                         DOMAIN => $domain,  
     450                         DOMAINS => \@domainlist,  
     451                         COMPARE => (&munin_get_bool ($config, "compare", 1, 
     452                                                      $domain) 
     453                                     and @nodeorder > 1), 
     454                         TIMESTAMP => $timestamp); 
     455  open (FILE, ">$config->{htmldir}/$domain/index.html") or 
     456    die "Cannot open $config->{htmldir}/index.html"; 
     457  print FILE $domaintemplate->output; 
     458  close FILE; 
     459 
     460  $domain{nodes} = \@nodes; 
     461  $domain{domain} = $domain; 
     462  $domain{compare} = (&munin_get_bool ($config, "compare", 1, $domain)  
     463                      and @nodeorder > 1); 
     464 
     465  my @cats = (); 
     466  foreach my $key (sort keys %comparisons) { 
     467    my %cat; 
     468    my %servlist; 
     469    my $nodewidth = 0; 
     470 
     471    foreach my $node (sort keys %{$comparisons{$key}}) { 
     472      foreach my $serv (@{$comparisons{$key}{$node}->{services}}) { 
     473        $servlist{$serv->{service}}{$node} = $serv; 
     474        $nodewidth = $serv->{imgdaywidth} 
     475          if (defined $serv->{imgdaywidth} 
     476              and $serv->{imgdaywidth} > $nodewidth); 
     477      } 
     478    } 
     479    foreach my $sname (sort keys %servlist) { 
     480      my %s; 
     481      foreach my $node (@nodeorder) { 
     482        if (defined $servlist{$sname}{$node}) { 
     483          $servlist{$sname}{$node}->{width} = $nodewidth; 
     484          push (@{$s{nodes}}, $servlist{$sname}{$node}); 
    195485        } else { 
    196             @serviceorder = sort (keys %{$config->{domain}->{$domain}->{node}->{$node}->{client}}); 
    197         } 
    198          
    199         for my $service (@serviceorder) { 
    200             logger("processing service: $service"); 
    201             next unless defined( $config->{domain}->{$domain}->{node}->{$node}->{client}->{$service} ) 
    202                             &&  $config->{domain}->{$domain}->{node}->{$node}->{client}->{$service} ne ""; 
    203             next unless (munin_get_bool ($config, "graph", 1, $domain, $node, $service)); 
    204             my @service; 
    205             my %service; 
    206             my $fieldnum = 0; 
    207             my @graph_info; 
    208             my @field_info; 
    209             $service{service}=$service; 
    210             $service{label}=$config->{domain}->{$domain}->{node}->{$node}->{client}->{$service}->{graph_title}; 
    211                  
    212             my $method = &munin_get ($config, "graph_strategy", "cron"); 
    213             if ($method eq "cgi") 
    214             { 
    215                 $service{imgday}=$config->{'cgiurl_graph'}."/$domain/$node/$service-day.png"; 
    216                 $service{imgweek}=$config->{'cgiurl_graph'}."/$domain/$node/$service-week.png"; 
    217                 $service{imgmonth}=$config->{'cgiurl_graph'}."/$domain/$node/$service-month.png"; 
    218                 $service{imgyear}=$config->{'cgiurl_graph'}."/$domain/$node/$service-year.png"; 
    219  
    220                 if (&munin_get_bool_val ($config->{domain}->{$domain}->{node}->{$node}->{client}->{$service}->{"graph_sums"}, 0)) 
    221                 { 
    222                     $service{imgweeksum} = $config->{'cgiurl_graph'}."/$domain/$node/$service-week-sum.png"; 
    223                     $service{imgyearsum} = $config->{'cgiurl_graph'}."/$domain/$node/$service-year-sum.png"; 
    224                 } 
    225          
    226                 if (my ($w, $h) = &calculate_png_size ($config, $domain, $node, $service)) 
    227                 { 
    228                     for my $scale (@times) 
    229                     { 
    230                         $service{"img".$scale."width"} = $w; 
    231                         $service{"img".$scale."height"} = $h; 
    232                     } 
    233                     if (&munin_get_bool_val ($config->{domain}->{$domain}->{node}->{$node}->{client}->{$service}->{"graph_sums"}, 0)) 
    234                     { 
    235                         for my $scale (["week", "year"]) 
    236                         { 
    237                             $service{"img".$scale."sumwidth"} = $w; 
    238                             $service{"img".$scale."sumheight"} = $h; 
    239                         } 
    240                     } 
    241                 } 
    242             } 
    243             else 
    244             { 
    245                     $service{imgday}="$node-$service-day.png"; 
    246                     $service{imgweek}="$node-$service-week.png"; 
    247                     $service{imgmonth}="$node-$service-month.png"; 
    248                     $service{imgyear}="$node-$service-year.png"; 
    249  
    250                     for my $scale (@times) 
    251                     { 
    252                             if (my ($w, $h) = &get_png_size (&munin_get_picture_filename ($config, $domain, $node, $service, $scale))) 
    253                             { 
    254                                     $service{"img".$scale."width"} = $w; 
    255                                     $service{"img".$scale."height"} = $h; 
    256                             } 
    257                     } 
    258  
    259                     if (&munin_get_bool_val ($config->{domain}->{$domain}->{node}->{$node}->{client}->{$service}->{"graph_sums"}, 0)) 
    260                     { 
    261                         $service{imgweeksum} = "$node-$service-week-sum.png"; 
    262                         $service{imgyearsum} = "$node-$service-year-sum.png"; 
    263                         for my $scale (["week", "year"]) 
    264                         { 
    265                                 if (my ($w, $h) = &get_png_size (&munin_get_picture_filename ($config, $domain, $node, $service, $scale, 1))) 
    266                                 { 
    267                                         $service{"img".$scale."sumwidth"} = $w; 
    268                                         $service{"img".$scale."sumheight"} = $h; 
    269                                 } 
    270                         } 
    271                     } 
    272             } 
    273             $service{url}="$node-$service.html"; 
    274             $service{domain}="$domain"; 
    275             $service{node}=$node; 
    276             $service{category}= $config->{domain}->{$domain}->{node}->{$node}->{client}->{$service}->{graph_category} || "other"; 
    277  
    278         # Do "help" section 
    279                 if (defined $config->{domain}->{$domain}->{node}->{$node}->{client}->{$service}->{graph_info}) 
    280                 { 
    281                         my %graph_info; 
    282                         $graph_info{info} = $config->{domain}->{$domain}->{node}->{$node}->{client}->{$service}->{graph_info}; 
    283                         push @{$service{graphinfo}}, \%graph_info; 
    284                 } 
    285                 $service{fieldlist} .= "<tr><th align='left' valign='top'>Field</th><th align='left' valign='top'>Type</th><th align='left' valign='top'>Warn</th><th align='left' valign='top'>Crit</th><th></tr>"; 
    286 #               foreach my $field (keys %{$config->{domain}->{$domain}->{node}->{$node}->{client}->{$service}}) 
    287                 foreach my $f (@{&munin_get_field_order ($config->{domain}->{$domain}->{node}->{$node}, $config, $domain, $node, $service)}) 
    288                 { 
    289                         $f =~ s/=(.*)$//; 
    290                         my $path = $1; 
    291                         next unless (&munin_draw_field ($config->{domain}->{$domain}->{node}->{$node}, $service, $f)); 
    292                         print "DEBUG: single_value: Checking field \"$f\" ($path).\n" if $DEBUG; 
    293  
    294                         if (defined $path) 
    295                         { 
    296                             munin_get_rrd_filename ($config->{domain}->{$domain}->{node}->{$node}, $config, $domain, $node, $service, $f, $path); 
    297                         } 
    298  
    299                         my %field_info; 
    300                         $fieldnum++; 
    301  
    302                         $field_info{'hr'}      = 1 unless ($fieldnum % 3); 
    303                         $field_info{'field'}   = $f; 
    304                         $field_info{'label'}   = $config->{domain}->{$domain}->{node}->{$node}->{client}->{$service}->{$f.".label"} || $f; 
    305                         $field_info{'type'}    = lc ($config->{domain}->{$domain}->{node}->{$node}->{client}->{$service}->{$f.".type"} || "GAUGE"); 
    306                         $field_info{'warn'}    = $config->{domain}->{$domain}->{node}->{$node}->{client}->{$service}->{$f.".warning"} || "None"; 
    307                         $field_info{'crit'}    = $config->{domain}->{$domain}->{node}->{$node}->{client}->{$service}->{$f.".critical"} || "None"; 
    308                         $field_info{'info'}    = $config->{domain}->{$domain}->{node}->{$node}->{client}->{$service}->{$f.".info"} || ""; 
    309  
    310                         my $state = &munin_field_status ($config, $limits, $domain, $node, $service, $f, 1); 
    311                         if (defined $state) 
    312                         { 
    313                                 $field_info{'state_warning'}  = 1 if $state eq "warning"; 
    314                                 $field_info{'state_critical'} = 1 if $state eq "critical"; 
    315                                 $field_info{'state_unknown'}  = 1 if $state eq "unknown"; 
    316                         } 
    317                         push @{$service{fieldinfo}}, \%field_info; 
    318                 } 
    319  
    320                 { 
    321                         my $state = &munin_service_status ($config, $limits, $domain, $node, $service, 1); 
    322                         if (defined $state) 
    323                         { 
    324                                 $service{'state_warning'}  = 1 if $state eq "warning"; 
    325                                 $service{'state_critical'} = 1 if $state eq "critical"; 
    326                                 $service{'state_unknown'}  = 1 if $state eq "unknown"; 
    327                         } 
    328                 } 
    329  
    330             push @services, \%service; 
    331             push @service, \%service; 
    332             push @{$tmp_cats{$service{'category'}}}, \%service; 
    333             $servicetemplate->param(SERVICES => \@service, 
    334                                     SERVICE => $service, 
    335                                     NODE => $node, 
    336                                     DOMAIN => $domain,  
    337                                     DOMAINS => \@domainlist,  
    338                                     TIMESTAMP => $timestamp); 
    339             open (FILE, ">$config->{htmldir}/$domain/$node-$service.html") or die "Cannot open $config->{htmldir}/$domain/$node-$service.html"; 
    340             print FILE $servicetemplate->output; 
    341             close FILE; 
    342         } 
    343         foreach my $key (keys %tmp_cats) 
    344         { 
    345             next if $key eq "other"; 
    346             my %tmp; 
    347             my $state = &munin_category_status ($config, $limits, $domain, $node, $key, 1); 
    348             print "DEBUG: Pushing category \"$node\" -> \"$key\"...\n" if $DEBUG; 
    349             if (defined $state) 
    350             { 
    351                     $tmp{'state_warning'}  = 1 if $state eq "warning"; 
    352                     $tmp{'state_critical'} = 1 if $state eq "critical"; 
    353                     $tmp{'state_unknown'}  = 1 if $state eq "unknown"; 
    354             } 
    355             $tmp{name} = ucfirst $key; 
    356             $tmp{services} = \@{$tmp_cats{$key}}; 
    357             $tmp{node} = $node; 
    358             $tmp{domain} = $domain; 
    359             $categories{ucfirst $key} = \%tmp; 
    360             $comparisons{$key}{$node} = \%tmp; 
    361         } 
    362         if (defined $tmp_cats{'other'}) 
    363         { 
    364             my $key = 'other'; 
    365             my %tmp; 
    366             my $state = &munin_category_status ($config, $limits, $domain, $node, $key, 1); 
    367             print "DEBUG: Pushing category \"$node\" -> \"$key\"...\n" if $DEBUG; 
    368             if (defined $state) 
    369             { 
    370                     $tmp{'state_warning'}  = 1 if $state eq "warning"; 
    371                     $tmp{'state_critical'} = 1 if $state eq "critical"; 
    372                     $tmp{'state_unknown'}  = 1 if $state eq "unknown"; 
    373             } 
    374             $tmp{name} = ucfirst $key; 
    375             $tmp{services} = \@{$tmp_cats{$key}}; 
    376             $tmp{node} = $node; 
    377             $tmp{domain} = $domain; 
    378             $categories{ucfirst $key} = \%tmp; 
    379             $comparisons{'other'}{$node} = \%tmp; 
    380         } 
    381         # Handle category_order 
    382         @categories = (); 
    383         if ($config->{domain}->{$domain}->{node}->{$node}->{category_order}) { 
    384             foreach my $cat (split /\s+/, $config->{domain}->{$domain}->{node}->{$node}->{category_order}) 
    385             { 
    386                 push @categories, $categories{ucfirst $cat}; 
    387             } 
    388             foreach my $cat (sort keys %categories) 
    389             { 
    390                 push @categories, $categories{$cat} 
    391                         unless (grep { $_->{name} eq $cat } @categories); 
    392             } 
    393         } else { 
    394             @categories = map { $categories{$_} } sort keys %categories; 
    395         } 
    396         $nodetemplate->param(SERVICES => \@services, 
    397                              NODE => $node, 
    398                              DOMAIN => $domain, 
    399                              DOMAINS => \@domainlist,  
    400                              TIMESTAMP => $timestamp, 
    401                              CATEGORIES => \@categories); 
    402         open (FILE, ">$config->{htmldir}/$domain/$node.html") or die "Cannot open $config->{htmldir}/$domain/$node.html"; 
    403         print FILE $nodetemplate->output; 
    404         close FILE; 
    405         $node{services} = \@services; 
    406         $node{categories} = \@categories; 
    407         $node{domain} = $domain; 
    408         push @nodes,\%node; 
    409  
    410     } 
    411     $domaintemplate->param(NODES => \@nodes, 
    412                            DOMAIN => $domain,  
    413                            DOMAINS => \@domainlist,  
    414                            COMPARE => (&munin_get_bool ($config, "compare", 1, $domain) and @nodeorder > 1), 
    415                            TIMESTAMP => $timestamp); 
    416     open (FILE, ">$config->{htmldir}/$domain/index.html") or die "Cannot open $config->{htmldir}/index.html"; 
    417     print FILE $domaintemplate->output; 
    418     close FILE; 
    419      
    420     $domain{nodes} = \@nodes; 
    421     $domain{domain} = $domain; 
    422     $domain{compare} = (&munin_get_bool ($config, "compare", 1, $domain) and @nodeorder > 1); 
    423  
    424     my @cats = (); 
    425     foreach my $key (sort keys %comparisons) 
    426     { 
    427         my %cat; 
    428         my %servlist; 
    429         my $nodewidth = 0; 
    430  
    431         foreach my $node (sort keys %{$comparisons{$key}}) 
    432         { 
    433             foreach my $serv (@{$comparisons{$key}{$node}->{services}}) 
    434             { 
    435                 $servlist{$serv->{service}}{$node} = $serv; 
    436                 $nodewidth = $serv->{imgdaywidth} if (defined $serv->{imgdaywidth} and $serv->{imgdaywidth} > $nodewidth); 
    437             } 
    438         } 
    439         foreach my $sname (sort keys %servlist) 
    440         { 
    441             my %s; 
    442             foreach my $node (@nodeorder) 
    443             { 
    444                 if (defined $servlist{$sname}{$node}) 
    445                 { 
    446                     $servlist{$sname}{$node}->{width} = $nodewidth; 
    447                     push (@{$s{nodes}}, $servlist{$sname}{$node}); 
    448                 } 
    449                 else 
    450                 { 
    451                     my %ts; 
    452                     $ts{label} = "Not present"; 
    453                     $ts{service} = "$sname"; 
    454                     $ts{title} = "Not present"; 
    455                     $ts{node} = $node; 
    456                     $ts{width} = $nodewidth; 
    457                     push (@{$s{nodes}}, \%ts); 
    458                 } 
    459             } 
    460             push @{$cat{services}}, \%s; 
    461         } 
    462         $cat{name} = ucfirst $key; 
    463         $cat{numnodes} = @nodeorder; 
    464         $cat{numnodes} = @nodeorder; 
    465         push @cats, \%cat; 
    466     } 
    467  
    468     if (&munin_get_bool ($config, "compare", 1, $domain) and @nodeorder > 1) 
    469     { 
    470         foreach my $t (@times) 
    471         { 
    472             $comparisontemplates{$t}->param(DOMAIN => $domain, 
    473                                  DOMAINS => \@domainlist,  
    474                                  TIMESTAMP => $timestamp, 
    475                                  CATEGORIES => \@cats); 
    476             open (FILE, ">$config->{htmldir}/$domain/comparison-$t.html") or die "Cannot open $config->{htmldir}/$domain/comparison-$t.html"; 
    477             print FILE $comparisontemplates{$t}->output; 
    478             close FILE; 
    479         } 
    480     } 
    481  
    482     push @domains,\%domain; 
     486          my %ts; 
     487          $ts{label} = "Not present"; 
     488          $ts{service} = "$sname"; 
     489          $ts{title} = "Not present"; 
     490          $ts{node} = $node; 
     491          $ts{width} = $nodewidth; 
     492          push (@{$s{nodes}}, \%ts); 
     493        } 
     494      } 
     495      push @{$cat{services}}, \%s; 
     496    } 
     497    $cat{name} = ucfirst $key; 
     498    $cat{numnodes} = @nodeorder; 
     499    $cat{numnodes} = @nodeorder; 
     500    push @cats, \%cat; 
     501  } 
     502 
     503  if (&munin_get_bool ($config, "compare", 1, $domain) and @nodeorder > 1) { 
     504    foreach my $t (@times) { 
     505      $comparisontemplates{$t}->param(DOMAIN => $domain, 
     506                                      DOMAINS => \@domainlist, 
     507                                      TIMESTAMP => $timestamp, 
     508                                      CATEGORIES => \@cats); 
     509      open (FILE, ">$config->{htmldir}/$domain/comparison-$t.html") or 
     510        die "Cannot open $config->{htmldir}/$domain/comparison-$t.html"; 
     511      print FILE $comparisontemplates{$t}->output; 
     512      close FILE; 
     513    } 
     514  } 
     515  push @domains,\%domain; 
    483516} 
    484517 
     
    604637} 
    605638 
    606 logger("munin-html finished"); 
     639$update_time = sprintf("%.2f",(Time::HiRes::time - $update_time)); 
     640 
     641logger("munin-html finished ($update_time sec)"); 
    607642close $log; 
    608643 
     
    651686Munin's nodes, graph them, create html-pages, and optionally warn Nagios 
    652687about any off-limit values. 
     688 
     689If munin.conf sets "graph_strategy cgi" then munin-html generates URLs 
     690referencing the graph CGI instead of referencing pre-generated 
     691graphs (made by munin-graph). 
    653692 
    654693Munin-html creates the html pages. 
     
    678717=head1 COPYRIGHT 
    679718 
    680 Copyright © 2002-2004 Knut Haugen, Audun Ytterdal, and Jimmy Olsen / Linpro AS. 
     719Copyright (C) 2002-2006 Knut Haugen, Audun Ytterdal, and Jimmy Olsen / 
     720Linpro AS. 
    681721 
    682722This is free software; see the source for copying conditions. There is 
  • people/ilmari/modularisation-branch/server/munin-limits.in

    r1012 r1265  
    157157            $client->{'fields'} = join (' ', map { $_ =~ s/\.label$//; $_} grep (/\.label/, keys %$client)); 
    158158            $client->{'plugin'} = $clientname; 
    159             $client->{'graph_options'} = $client->{'notify_alias'} if defined $client->{'notify_alias'}; 
     159            $client->{'graph_title'} = $client->{'notify_alias'} if defined $client->{'notify_alias'}; 
    160160            $client->{'host'} = $config->{'domain'}->{$domain}->{'node'}->{$name}->{'notify_alias'} || $name; 
    161161            $client->{'group'} = $config->{'domain'}->{$domain}->{'notify_alias'} || $domain; 
     
    643643=head1 AUTHORS 
    644644 
    645 Audun Ytterdal and Jimmy Olsen. 
     645Knut Haugen, Audun Ytterdal and Jimmy Olsen. 
    646646 
    647647=head1 BUGS 
     
    653653=head1 COPYRIGHT 
    654654 
    655 Copyright © 2002-2004 Knut Haugen, Audun Ytterdal, and Jimmy Olsen / Linpro AS. 
     655Copyright © 2002-2006 Knut Haugen, Audun Ytterdal, and Jimmy Olsen / Linpro AS. 
    656656 
    657657This is free software; see the source for copying conditions. There is 
  • people/ilmari/modularisation-branch/server/munin-update.in

    r1045 r1265  
    1717# along with this program; if not, write to the Free Software 
    1818# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
    19 # 
    20 # 
    2119# 
    2220# Script to update the RRD-files with current information. 
     
    312310else 
    313311{ 
    314     warn "Could not create lockfile \"$config->{rundir}/munin-update.lock\""; 
     312    die "Could not create lockfile \"$config->{rundir}/munin-update.lock\""; 
    315313} 
    316314 
     
    11071105 
    11081106sub fetch_node { 
    1109   my ($domain,$name,$node,$socket) = @_; 
    1110   my $nodefetch_time = Time::HiRes::time; 
    1111   logger("Fetching node: $name") if $DEBUG; 
    1112   for my $service (keys %{$node->{client}}) { 
    1113     my $servicefetch_time = Time::HiRes::time; 
    1114     logger("Fetching service: $name->$service") if $DEBUG; 
    1115     next if (exists ($node->{client}->{$service}->{fetch_data}) and  
    1116              $node->{client}->{$service}->{fetch_data} == 0); 
    1117     next if (exists ($node->{client}->{$service}->{update}) and  
    1118              $node->{client}->{$service}->{update} ne "yes"); 
    1119     next if (@limit_services and !grep (/^$service$/, @limit_services)); 
    1120     my $realservname = $node->{client}->{$service}->{realservname} || $service; 
    1121     delete $node->{client}->{$service}->{realservname} 
    1122         if exists $node->{client}->{$service}->{realservname}; 
    1123     write_socket_single ($socket, "fetch $realservname\n"); 
    1124     my @lines = &read_socket($socket); 
    1125     return 0 unless $socket; 
    1126     my $fields = {}; 
    1127     for (@lines) { 
    1128       next unless defined $_; 
    1129       if (/\# timeout/) { 
    1130         logger("Client reported timeout in fetching of $service"); 
    1131       } 
    1132       elsif (/(\w+)\.value\s+(.+)/) { 
    1133         my $key = $1; 
    1134         my $value = $2; 
    1135         my $comment = $3; 
    1136         $key = &sanitise_fieldname ($key, $fields); 
    1137         if (exists $node->{client}->{$service}->{$key.".label"}) 
    1138         { 
    1139             my $fname = "$config->{dbdir}/$domain/$name-$service-$key-". 
    1140               lc substr (($node->{client}->{$service}->{$key.".type"}||"GAUGE"),0,1). 
    1141                 ".rrd"; 
    1142             logger("Updating $fname with $value") if $DEBUG; 
    1143             RRDs::update ("$fname", "N:$value"); 
    1144             if (my $ERROR = RRDs::error) { 
    1145               logger ("Unable to update $fname: $ERROR"); 
     1107    my ($domain,$name,$node,$socket) = @_; 
     1108    my $nodefetch_time = Time::HiRes::time; 
     1109    logger("Fetching node: $name") if $DEBUG; 
     1110    for my $service (keys %{$node->{client}}) { 
     1111        my $servicefetch_time = Time::HiRes::time; 
     1112        logger("Fetching service: $name->$service") if $DEBUG; 
     1113        next if (exists ($node->{client}->{$service}->{fetch_data}) and  
     1114                 $node->{client}->{$service}->{fetch_data} == 0); 
     1115        next if (exists ($node->{client}->{$service}->{update}) and  
     1116                 $node->{client}->{$service}->{update} ne "yes"); 
     1117        next if (@limit_services and !grep (/^$service$/, @limit_services)); 
     1118        my $realservname = ( $node->{client}->{$service}->{realservname} || 
     1119                             $service ); 
     1120        delete $node->{client}->{$service}->{realservname} 
     1121          if exists $node->{client}->{$service}->{realservname}; 
     1122        write_socket_single ($socket, "fetch $realservname\n"); 
     1123        my @lines = &read_socket($socket); 
     1124        return 0 unless $socket; 
     1125        my $fields = {}; 
     1126        for (@lines) { 
     1127            next unless defined $_; 
     1128            if (/\# timeout/) { 
     1129                logger("Client reported timeout in fetching of $service"); 
     1130            } elsif (/(\w+)\.value\s+(\S+)\s*(\#.*)?$/) { 
     1131                my $key = $1; 
     1132                my $value = $2; 
     1133                my $comment = $3; 
     1134 
     1135                if ($value =~ /\d[Ee]([+-]?\d+)$/) { 
     1136                    # Looks like scientific format.  RRDtool does not 
     1137                    # like it so we convert it. 
     1138                    my $magnitude = $1; 
     1139                    if ($magnitude < 0) { 
     1140                        # Preserve at least 4 significant digits 
     1141                        $magnitude=abs($magnitude)+4; 
     1142                        $value=sprintf("%.%magnitudef",$value); 
     1143                    } else { 
     1144                        $value=sprintf("%.4f",$value); 
     1145                    } 
     1146                } 
     1147 
     1148                $key = &sanitise_fieldname ($key, $fields); 
     1149                if (exists $node->{client}->{$service}->{$key.".label"}) { 
     1150                    my $fname = 
     1151                      "$config->{dbdir}/$domain/$name-$service-$key-". 
     1152                        lc 
     1153                          substr(($node->{client}->{$service}->{$key.".type"}|| 
     1154                                  "GAUGE"),0,1).".rrd"; 
     1155 
     1156                    logger("Updating $fname with $value") if $DEBUG; 
     1157                    RRDs::update ("$fname", "N:$value"); 
     1158                    if (my $ERROR = RRDs::error) { 
     1159                        logger ("Unable to update $fname: $ERROR"); 
     1160                    } 
     1161                } else { 
     1162                    logger ("Unable to update $domain -> $name -> $service -> $key: No such field (no \"label\" field defined when running plugin with \"config\")."); 
     1163                } 
     1164            } elsif (/(\w+)\.extinfo\s+(.+)/) { 
     1165                $config->{domain}->{$domain}->{node}->{$name}->{client}->{$service}->{$1.".extinfo"} = $2; 
    11461166            } 
    1147         } else { 
    1148             logger ("Unable to update $domain -> $name -> $service -> $key: No such field (no \"label\" field defined when running plugin with \"config\")."); 
    1149         } 
    1150       } 
    1151       elsif (/(\w+)\.extinfo\s+(.+)/) { 
    1152         $config->{domain}->{$domain}->{node}->{$name}->{client}->{$service}->{$1.".extinfo"} = $2; 
    1153       } 
    1154     } 
    1155     $servicefetch_time = sprintf ("%.2f",(Time::HiRes::time - $servicefetch_time)); 
    1156     logger ("Fetched service: $name -> $service ($servicefetch_time sec)"); 
    1157     print STATS "FS|$domain|$name|$service|$servicefetch_time\n"; 
    1158   } 
    1159   $nodefetch_time = sprintf ("%.2f",(Time::HiRes::time - $nodefetch_time)); 
    1160   logger ("Fetched node: $name ($nodefetch_time sec)"); 
    1161   print STATS "FN|$domain|$name|$nodefetch_time\n"; 
    1162  
    1163   return 1; 
     1167        } 
     1168        $servicefetch_time = sprintf ("%.2f",(Time::HiRes::time - $servicefetch_time)); 
     1169        logger ("Fetched service: $name -> $service ($servicefetch_time sec)"); 
     1170        print STATS "FS|$domain|$name|$service|$servicefetch_time\n"; 
     1171    } 
     1172    $nodefetch_time = sprintf ("%.2f",(Time::HiRes::time - $nodefetch_time)); 
     1173    logger ("Fetched node: $name ($nodefetch_time sec)"); 
     1174    print STATS "FN|$domain|$name|$nodefetch_time\n"; 
     1175 
     1176    return 1; 
    11641177} 
    11651178 
     
    13161329=head1 AUTHORS 
    13171330 
    1318 Audun Ytterdal and Jimmy Olsen. 
     1331Audun Ytterdal, Jimmy Olsen, and Tore Anderson. 
    13191332 
    13201333=head1 BUGS 
     
    13261339=head1 COPYRIGHT 
    13271340 
    1328 Copyright © 2002-2004 Audun Ytterdal, Jimmy Olsen, and Tore Anderson / Linpro AS. 
     1341Copyright © 2002-2006 Audun Ytterdal, Jimmy Olsen, and Tore Anderson / Linpro AS. 
    13291342 
    13301343This is free software; see the source for copying conditions. There is