~ubuntu-branches/ubuntu/gutsy/munin/gutsy

« back to all changes in this revision

Viewing changes to node/munin-run.in

  • Committer: Bazaar Package Importer
  • Author(s): Tore Anderson
  • Date: 2004-05-21 20:51:19 UTC
  • Revision ID: james.westby@ubuntu.com-20040521205119-oz8bllbjp9hs80ig
Tags: upstream-0+1.0.0pre5
Import upstream version 0+1.0.0pre5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!@@PERL@@ -wT
 
2
#
 
3
# $Id: munin-run.in,v 1.6 2004/04/30 13:14:53 jimmyo Exp $
 
4
#
 
5
# $Log: munin-run.in,v $
 
6
# Revision 1.6  2004/04/30 13:14:53  jimmyo
 
7
# Added support for snmpconf option in plugins.
 
8
#
 
9
# Revision 1.5  2004/01/29 19:39:00  jimmyo
 
10
# Generic plugins now use printf instead of echo -n, as this is more portable (SF#885564)
 
11
#
 
12
# Revision 1.4  2004/01/29 17:36:19  jimmyo
 
13
# Updated copyright information
 
14
#
 
15
# Revision 1.3  2004/01/29 16:56:54  jimmyo
 
16
# Fixed "group" bug. Added support for multiple and optional groups
 
17
#
 
18
# Revision 1.2  2004/01/15 15:20:01  jimmyo
 
19
# Making things workable after name change. Upping for test verwion.
 
20
#
 
21
# Revision 1.1  2004/01/02 18:50:00  jimmyo
 
22
# Renamed occurrances of lrrd -> munin
 
23
#
 
24
# Revision 1.1.1.1  2004/01/02 15:18:07  jimmyo
 
25
# Import of LRRD CVS tree after renaming to Munin
 
26
#
 
27
# Revision 1.16  2003/12/18 18:51:37  jimmyo
 
28
# added configuration option "ignore_file", which takes regex for files to ignore (e.g. rpmnew/save) (Deb#224265).
 
29
#
 
30
# Revision 1.15  2003/12/18 17:58:18  jimmyo
 
31
# Do a fake clean of the environment because of the taint checking.
 
32
#
 
33
# Revision 1.14  2003/12/17 21:29:26  jimmyo
 
34
# Don\'t try to change uid/gid if not running as root. (Deb#224300)
 
35
#
 
36
# Revision 1.13  2003/12/10 15:30:02  jimmyo
 
37
# Set path before trying to get hostname
 
38
#
 
39
# Revision 1.12  2003/12/10 15:11:40  jimmyo
 
40
# A couple of bugfixes.
 
41
#
 
42
# Revision 1.11  2003/11/07 17:43:16  jimmyo
 
43
# Cleanups and log entries
 
44
#
 
45
#
 
46
 
 
47
use strict;
 
48
use vars qw(@ISA);
 
49
use Getopt::Long;
 
50
 
 
51
# "Clean" environment to disable taint-checking on the environment. We _know_
 
52
# that the environment is insecure, but we want to let admins shoot themselves
 
53
# in the foot with it, if they want to.
 
54
foreach my $key (keys %ENV)
 
55
{
 
56
        $ENV{$key} =~ /^(.*)$/;
 
57
        $ENV{$key} = $1;
 
58
}
 
59
 
 
60
my %services;
 
61
my %nodes;
 
62
my $servicedir="@@CONFDIR@@/plugins";
 
63
my $sconfdir="@@CONFDIR@@/plugin-conf.d";
 
64
my $conffile="@@CONFDIR@@/munin-node.conf";
 
65
my $sconffile=undef;
 
66
my $FQDN="";
 
67
my $do_usage = 0;
 
68
my $DEBUG = 0;
 
69
my $do_version = 0;
 
70
my $VERSION="@@VERSION@@";
 
71
my $defuser = getpwnam ("nobody");
 
72
my $defgroup= getgrnam ("munin");
 
73
my $paranoia = 0;
 
74
my @ignores = ();
 
75
 
 
76
my %sconf  = ();
 
77
 
 
78
$do_usage=1  unless 
 
79
GetOptions ( "config=s"     => \$conffile,
 
80
             "debug!"       => \$DEBUG,
 
81
             "version!"     => \$do_version,
 
82
             "servicedir=s" => \$servicedir,
 
83
             "sconfdir=s"   => \$sconfdir,
 
84
             "sconffile=s"  => \$sconffile,
 
85
             "paranoia!"    => \$paranoia,
 
86
             "help"         => \$do_usage );
 
87
 
 
88
if ($do_usage)
 
89
{
 
90
    print "Usage: $0 [options]
 
91
 
 
92
Options:
 
93
    --help              View this message.
 
94
    --config <file>     Use <file> as configuration file. 
 
95
                        [@@CONFDIR@@/munin-node.conf]
 
96
    --servicedir <dir>  Dir where plugins are found. 
 
97
                        [@@CONFDIR@@/plugins]
 
98
    --sconfdir <dir>    Dir where plugin configurations are found. 
 
99
                        [@@CONFDIR@@/plugin-conf.d]
 
100
    --sconffile <dir>   Dir where plugins are found. Overrides sconfdir.
 
101
                        [undefined]
 
102
    --[no]paranoia      Only run plugins owned by root. Check permissions.
 
103
                        [--paranoia]
 
104
    --debug             View debug messages.
 
105
    --version           View version information.
 
106
 
 
107
";
 
108
    exit 0;
 
109
}
 
110
 
 
111
if ($conffile =~ /^([-\/\@_\w\.]+)$/) 
 
112
{
 
113
    $conffile = $1;                     # $data now untainted
 
114
 
115
else 
 
116
{
 
117
    die "Bad data in $conffile";        # log this somewhere
 
118
}
 
119
if ($sconfdir =~ /^([-\/\@_\w\.]+)$/) 
 
120
{
 
121
    $sconfdir = $1;                     # $data now untainted
 
122
 
123
else 
 
124
{
 
125
    die "Bad data in $sconfdir";        # log this somewhere
 
126
}
 
127
if (defined $sconffile and $sconffile =~ /^([-\/\@_\w\.]+)$/) 
 
128
{
 
129
    $sconffile = $1;                     # $data now untainted
 
130
 
131
elsif (defined $sconffile) 
 
132
{
 
133
    die "Bad data in $sconffile";        # log this somewhere
 
134
}
 
135
if ($servicedir =~ /^([-\/\@_\w\.]+)$/) 
 
136
{
 
137
    $servicedir = $1;                     # $data now untainted
 
138
 
139
else 
 
140
{
 
141
    die "Bad data in $servicedir";        # log this somewhere
 
142
}
 
143
 
 
144
 
 
145
 
 
146
if ($do_version)
 
147
{
 
148
        print "munin-run (munin-node) version $VERSION.
 
149
Written by Jimmy Olsen / Linpro AS
 
150
 
 
151
Copyright (C) 2002-2004
 
152
This is free software released under the GNU Public License. There is NO
 
153
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
154
";
 
155
        exit 0;
 
156
}
 
157
 
 
158
# Check permissions of configuration
 
159
 
 
160
if (!&check_perms ($servicedir) or !&check_perms ($conffile))
 
161
{
 
162
        die "Fatal error. Bailing out.";
 
163
}
 
164
 
 
165
if (! -f $conffile) {
 
166
  print "ERROR: Cannot open $conffile\n";
 
167
  exit 1;
 
168
}
 
169
 
 
170
open FILE,$conffile or die "Cannot open $conffile\n";
 
171
while (<FILE>) {
 
172
  chomp;
 
173
  s/#.*//;                # no comments
 
174
  s/^\s+//;               # no leading white
 
175
  s/\s+$//;               # no trailing white
 
176
  next unless length;     # anything left?
 
177
  /(^\w*)\s+(.*)/;
 
178
  if (($1 eq "host_name" or $1 eq "hostname") and $2)
 
179
  {
 
180
      $FQDN=$2;
 
181
  }
 
182
  elsif (($1 eq "default_plugin_user" or $1 eq "default_client_user") and $2)
 
183
  {
 
184
      my $tmpid = $2;
 
185
      my $defuser = &get_uid ($tmpid);
 
186
      if (! defined ($defuser))
 
187
      {
 
188
          die "Default user defined in \"$conffile\" does not exist ($tmpid)";
 
189
      }
 
190
  }
 
191
  elsif (($1 eq "default_plugin_group" or $1 eq "default_client_group") and $2)
 
192
  {
 
193
      my $tmpid = $2;
 
194
      $defgroup = &get_gid ($tmpid);
 
195
      if (! defined ($defgroup))
 
196
      {
 
197
          die "Default group defined in \"$conffile\" does not exist ($tmpid)";
 
198
      }
 
199
  }
 
200
  elsif (($1 eq "paranoia") and defined $2)
 
201
  {
 
202
      if ("$2" eq "no" or "$2" eq "false" or "$2" eq "off" or "$2" eq "0")
 
203
      {
 
204
          $paranoia = 0;
 
205
      }   
 
206
      else
 
207
      {
 
208
          $paranoia = 1;
 
209
      }   
 
210
  }   
 
211
  elsif (($1 eq "ignore_file") and defined $2)
 
212
  {
 
213
          push @ignores, $2;
 
214
  }   
 
215
}
 
216
 
 
217
$FQDN ||= &get_fq_hostname;
 
218
 
 
219
$ENV{FQDN}=$FQDN;
 
220
 
 
221
&load_services;
 
222
 
 
223
exit;
 
224
 
 
225
 
 
226
 
 
227
 
 
228
### over-ridden subs below
 
229
 
 
230
sub load_services {
 
231
    if ($sconffile)
 
232
    {
 
233
        if (!&load_auth_file ("", $sconffile, \%sconf))
 
234
        {
 
235
            warn "Something wicked happened while reading \"$sconffile\". Check the previous log lines for spesifics.";
 
236
        }
 
237
    }
 
238
    else
 
239
    {
 
240
        if (opendir (DIR,$sconfdir))
 
241
        {
 
242
FILES:
 
243
            for my $file (grep { -f "$sconfdir/$_" } readdir (DIR))
 
244
            {
 
245
                next if $file =~ m/^\./; # Hidden files
 
246
                next if $file !~ m/^([-\w.]+)$/; # Skip if any weird chars
 
247
                $file = $1; # Not tainted anymore.
 
248
                foreach my $regex (@ignores)
 
249
                {
 
250
                        next FILES if $file =~ /$regex/;
 
251
                }
 
252
                if (!&load_auth_file ($sconfdir, $file, \%sconf))
 
253
                {
 
254
                    warn "Something wicked happened while reading \"$servicedir/$file\". Check the previous log lines for spesifics.";
 
255
                }
 
256
            }
 
257
            closedir (DIR);
 
258
        }
 
259
    }
 
260
    
 
261
    opendir (DIR,$servicedir) || die "Cannot open plugindir: $servicedir $!";
 
262
FILES:
 
263
    for my $file (grep { -f "$servicedir/$_" } readdir(DIR)) {
 
264
        next if $file =~ m/^\./; # Hidden files
 
265
        next if $file =~ m/.conf$/; # Config files
 
266
        next if $file !~ m/^([-\w.]+)$/; # Skip if any weird chars
 
267
        $file = $1; # Not tainted anymore.
 
268
        foreach my $regex (@ignores)
 
269
        {
 
270
                next FILES if $file =~ /$regex/;
 
271
        }
 
272
        next if (! -x "$servicedir/$file"); # File not executeable
 
273
        next unless ($file =~ /^$ARGV[0]$/);
 
274
        print "# file: '$file'\n" if $DEBUG;
 
275
        my $arg = undef;
 
276
        if (defined $ARGV[1])
 
277
        {
 
278
            if ($ARGV[1] =~ /^c/i)
 
279
            {
 
280
                $arg = "config";
 
281
            }
 
282
            elsif ($ARGV[1] =~ /^a/i)
 
283
            {
 
284
                $arg = "autoconf";
 
285
            }
 
286
            elsif ($ARGV[1] =~ /^snmp/i)
 
287
            {
 
288
                $arg = "snmpconf";
 
289
            }
 
290
            elsif ($ARGV[1] =~ /^s/i)
 
291
            {
 
292
                $arg = "suggest";
 
293
            }
 
294
        }
 
295
        $services{$file}=1;
 
296
        my @rows = run_service($file, $arg);
 
297
        my $node = $FQDN;
 
298
        for my $row (@rows) {
 
299
          print "row: $row\n" if $DEBUG;
 
300
          if ($row =~ m/^host_name (.+)$/) {
 
301
            print "Found host_name, using it\n" if $DEBUG;
 
302
            $node = $1;
 
303
          }
 
304
        }
 
305
        $nodes{$node}{$file}=1;
 
306
    }
 
307
    closedir DIR;
 
308
}
 
309
 
 
310
sub run_service {
 
311
  my ($service,$command) = @_;
 
312
  $command ||="";
 
313
  my @lines = ();;
 
314
  my $timed_out = 0;
 
315
  if ($services{$service}) {
 
316
    my $child = 0;
 
317
    local $SIG{ALRM} = sub { 
 
318
      $timed_out = 1; 
 
319
    };
 
320
 
 
321
    # Setting environment
 
322
    $sconf{$service}{user}    = &get_var (\%sconf, $service, 'user');
 
323
    $sconf{$service}{group}   = &get_var (\%sconf, $service, 'group');
 
324
    $sconf{$service}{command} = &get_var (\%sconf, $service, 'command');
 
325
    &get_var (\%sconf, $service, 'env', \%{$sconf{$service}{env}});
 
326
    
 
327
        if ($< == 0) # If root
 
328
        {
 
329
                # Giving up gid egid uid euid
 
330
                my $u  = (defined $sconf{$service}{'user'}?
 
331
                        $sconf{$service}{'user'}:
 
332
                        $defuser);
 
333
                my $g  = $defgroup;
 
334
                my $gs = "$g $g" .
 
335
                ($sconf{$service}{'group'}?" $sconf{$service}{group}":"");
 
336
 
 
337
                print "# Want to run as euid/egid $u/$g\n" if $DEBUG;
 
338
 
 
339
                $( = $g    unless $g == 0;
 
340
                $) = $gs   unless $g == 0;
 
341
                $< = $u    unless $u == 0;
 
342
                $> = $u    unless $u == 0;
 
343
 
 
344
                if ($> != $u or $g != (split (' ', $)))[0])
 
345
                {
 
346
                print "# Can't drop privileges. Bailing out. (wanted uid=", 
 
347
                ($sconf{$service}{'user'} || $defuser), " gid=\"", 
 
348
                $gs, "\"($g), got uid=$> gid=\"$)\"(", (split (' ', $)))[0], ").\n";
 
349
                exit 1;
 
350
                }
 
351
                print "# Running as uid/gid/euid/egid $</$(/$>/$)\n" if $DEBUG;
 
352
                if (!&check_perms ("$servicedir/$service"))
 
353
                {
 
354
                print "# Error: unsafe permissions. Bailing out.";
 
355
                exit 1;
 
356
                }
 
357
        }
 
358
 
 
359
    # Setting environment...
 
360
    if (exists $sconf{$service}{'env'} and
 
361
            defined $sconf{$service}{'env'})
 
362
    {
 
363
        foreach my $key (keys %{$sconf{$service}{'env'}})
 
364
        {
 
365
            print "Setting environment $key=$sconf{$service}{env}{$key}\n" if $DEBUG;
 
366
            $ENV{$key} = $sconf{$service}{env}{$key};
 
367
        }
 
368
    }
 
369
    if (exists $sconf{$service}{'command'} and
 
370
        defined $sconf{$service}{'command'})
 
371
    {
 
372
        my @run = ();
 
373
        foreach my $t (@{$sconf{$service}{'command'}})
 
374
        {
 
375
            if ($t =~ /^%c$/)
 
376
            {
 
377
                push (@run, "$servicedir/$service", $command);
 
378
            }
 
379
            else
 
380
            {
 
381
                push (@run, $t);
 
382
            }
 
383
        }
 
384
        print STDERR "About to run \"", join (' ', @run), "\"\n" if $DEBUG;
 
385
        print "About to run \"", join (' ', @run), "\"\n" if $DEBUG;
 
386
        exec (@run) if @run;
 
387
    }
 
388
    else
 
389
    {
 
390
        exec ("$servicedir/$service", $command);
 
391
    }
 
392
  } else {
 
393
    print "# Unknown service\n";
 
394
  }
 
395
  chomp @lines;
 
396
  return (@lines);
 
397
}
 
398
 
 
399
sub get_fq_hostname {
 
400
    my $hostname;
 
401
    eval {
 
402
        require Net::Domain;
 
403
        $hostname = Net::Domain::hostfqdn();
 
404
    };
 
405
    return $hostname if $hostname;
 
406
 
 
407
    $hostname = `hostname`;  # Fall$
 
408
    chomp($hostname);
 
409
    $hostname =~ s/\s//g;
 
410
    return $hostname;
 
411
}
 
412
 
 
413
 
 
414
sub get_uid
 
415
{
 
416
    my $user = shift;
 
417
    return undef if (!defined $user);
 
418
 
 
419
    if ($user !~ /\d/)
 
420
    {
 
421
        $user = getpwnam ($user);
 
422
    }
 
423
    return $user;
 
424
}
 
425
 
 
426
sub get_gid
 
427
{
 
428
    my $group = shift;
 
429
    return undef if (!defined $group);
 
430
 
 
431
    if ($group !~ /\d/)
 
432
    {
 
433
        $group = getgrnam ($group);
 
434
    }
 
435
    return $group;
 
436
}
 
437
 
 
438
sub load_auth_file 
 
439
{
 
440
    my ($dir, $file, $sconf) = @_;
 
441
    my $service = $file;
 
442
 
 
443
    if (!defined $dir or !defined $file or !defined $sconf)
 
444
    {
 
445
        return undef;
 
446
    }
 
447
 
 
448
    return undef if (length $dir and !&check_perms ($dir));
 
449
    return undef if (!&check_perms ("$dir/$file"));
 
450
 
 
451
    if (!open (IN, "$dir/$file"))
 
452
    {
 
453
        warn "Could not open file \"$dir/$file\" for reading ($!), skipping plugin\n";
 
454
        return undef;
 
455
    }
 
456
    while (<IN>)
 
457
    {
 
458
        chomp;
 
459
        s/#.*$//;
 
460
        next unless /\S/;
 
461
        if (/^\s*\[([^\]]+)\]\s*$/)
 
462
        {
 
463
            $service = $1;
 
464
        }
 
465
        elsif (/^\s*user\s+(\S+)\s*$/)
 
466
        {
 
467
            my $tmpid = $1;
 
468
            $sconf->{$service}{'user'} = &get_uid ($tmpid);
 
469
            if (!defined $sconf->{$service}{'user'})
 
470
            {
 
471
                warn "User \"$tmpid\" in configuration file \"$dir/$file\" nonexistant. Skipping plugin.";
 
472
                return undef;
 
473
            }
 
474
        }
 
475
        elsif (/^\s*group\s+(.+)\s*$/)
 
476
        {
 
477
            my $tmpid = $1;
 
478
            foreach my $group (split /\s*,\s*/, $tmpid)
 
479
            {
 
480
                my $optional = 0;
 
481
 
 
482
                if ($group =~ /^\(([^)]+)\)$/)
 
483
                {
 
484
                    $optional = 1;
 
485
                    $group = $1;
 
486
                }
 
487
 
 
488
                my $g = &get_gid ($group);
 
489
                if (!defined $g and !$optional)
 
490
                {
 
491
                    warn "Group \"$group\" in configuration file \"$dir/$file\" nonexistant. Skipping plugin.";
 
492
                    return undef;
 
493
                }
 
494
                elsif (!defined $g and $optional)
 
495
                {
 
496
                    print "DEBUG: Skipping \"$group\" (optional).\n" if $DEBUG;
 
497
                    next;
 
498
                }
 
499
                
 
500
                if (!defined $sconf->{$service}{'group'})
 
501
                {
 
502
                    $sconf->{$service}{'group'} = $g;
 
503
                }
 
504
                else
 
505
                {
 
506
                    $sconf->{$service}{'group'} .= " $g";
 
507
                }
 
508
            }
 
509
        }
 
510
        elsif (/^\s*command\s+(.+)\s*$/)
 
511
        {
 
512
            @{$sconf->{$service}{'command'}} = split (/\s+/, $1);
 
513
        }
 
514
        elsif (/^\s*host_name\s+(.+)\s*$/)
 
515
        {
 
516
            $sconf->{$service}{'host_name'} = $1;
 
517
        } 
 
518
        elsif (/^\s*env\s+([^=\s]+)\s*=\s*(.+)$/)
 
519
        {
 
520
            $sconf->{$service}{'env'}{$1} = $2;
 
521
            print "Saving $service->env->$1 = $2...\n" if $DEBUG;
 
522
                        warn "Warning: Deprecated format in \"$dir/$file\" under \"[$service]\" (\"env $1=$2\" should be rewritten to \"env.$1 $2\").";
 
523
        } 
 
524
        elsif (/^\s*env\.(\S+)\s+(.+)$/)
 
525
        {
 
526
            $sconf->{$service}{'env'}{$1} = $2;
 
527
            print "Saving $service->env->$1 = $2...\n" if $DEBUG;
 
528
        }
 
529
        elsif (/^\s*(\w+)\s+(.+)$/)
 
530
        {
 
531
            $sconf->{$service}{'env'}{"lrrd_$1"} = $2;
 
532
            print "Saving $service->env->lrrd_$1 = $2...\n" if $DEBUG; 
 
533
            warn "Warning: Deprecated format in \"$dir/$file\" under \"[$service]\" (\"$1 $2\" should be rewritten to \"env lrrd_$1=$2\").";
 
534
        } 
 
535
        elsif (/\S/)
 
536
        {
 
537
            warn "Warning: Unknown config option in \"$dir/$file\" under \"[$service]\": $_";
 
538
        }
 
539
    }
 
540
    close (IN);
 
541
 
 
542
    return 1;
 
543
}
 
544
 
 
545
sub check_perms
 
546
{
 
547
    my $target = shift;
 
548
    my @stat;
 
549
    return undef if (!defined $target);
 
550
    return 1 if (!$paranoia);
 
551
 
 
552
    if (! -e "$target")
 
553
    {
 
554
        warn "Failed to check permissions on nonexistant target: \"$target\"";
 
555
        return undef;
 
556
    }
 
557
 
 
558
    @stat = stat ($target);
 
559
    if (!$stat[4] == 0 or
 
560
        ($stat[5] != 0 and $stat[2] & 00020) or
 
561
        ($stat[2] & 00002))
 
562
    {
 
563
        warn "Warning: \"$target\" has dangerous permissions (", sprintf ("%04o", $stat[2] & 07777), ").";
 
564
        return 0;
 
565
    }
 
566
 
 
567
    if (-f "$target") # Check dir as well
 
568
    {
 
569
        (my $dirname = $target) =~ s/[^\/]+$//;
 
570
        return &check_perms ($dirname);
 
571
    }
 
572
 
 
573
    return 1;
 
574
}
 
575
 
 
576
sub get_var
 
577
{
 
578
    my $sconf   = shift;
 
579
    my $name    = shift;
 
580
    my $var     = shift;
 
581
    my $env     = shift;
 
582
 
 
583
    if ($var eq 'env' and !defined $env)
 
584
    {
 
585
        %{$env} = ();
 
586
    }
 
587
    
 
588
    if ($var ne 'env' and exists $sconf->{$name}{$var})
 
589
    {
 
590
        return $sconf->{$name}{$var};
 
591
    }
 
592
    # Deciding environment
 
593
    foreach my $wildservice (grep (/\*$/, reverse sort keys %{$sconf}))
 
594
    {
 
595
        (my $tmpservice = $wildservice) =~ s/\*$//;
 
596
        next unless ($name =~ /^$tmpservice/);
 
597
        print "Checking $wildservice...\n" if $DEBUG;
 
598
 
 
599
        if ($var eq 'env')
 
600
        {
 
601
            if (exists $sconf->{$wildservice}{'env'})
 
602
            {
 
603
                foreach my $key (keys %{$sconf->{$wildservice}{'env'}})
 
604
                {
 
605
                    if (! exists $sconf->{$name}{'env'}{$key})
 
606
                    {
 
607
                        $sconf->{$name}{'env'}{$key} = $sconf->{$wildservice}{'env'}{$key};
 
608
                        print "Saving $wildservice->$key\n" if $DEBUG;
 
609
                    }
 
610
                }
 
611
            }
 
612
        }
 
613
        else
 
614
        {
 
615
            if (! exists $sconf->{$name}{$var} and
 
616
                    exists $sconf->{$wildservice}{$var})
 
617
            {
 
618
                return ($sconf->{$wildservice}{$var});
 
619
            }
 
620
        }
 
621
    }
 
622
    return $env;
 
623
}
 
624
 
 
625
 
 
626
 
 
627
1;
 
628
 
 
629
=head1 NAME
 
630
 
 
631
munin-run - A program to run munin-node plugins from the command line
 
632
 
 
633
=head1 SYNOPSIS
 
634
 
 
635
munin-run [--options] <plugin>
 
636
 
 
637
=head1 OPTIONS
 
638
 
 
639
=over 5
 
640
 
 
641
=item B<< --config <configfile> >>
 
642
 
 
643
Use E<lt>fileE<gt> as configuration file. [@@CONFDIR@@/munin-node.conf]
 
644
 
 
645
=item B<< --servicedir <dir> >>
 
646
 
 
647
Use E<lt>dirE<gt> as plugin dir. [@@CONFDIR@@/plugins]
 
648
 
 
649
=item B<< --sconfdir <dir> >>
 
650
 
 
651
Use E<lt>dirE<gt> as plugin configuration dir. [@@CONFDIR@@/plugin-conf.d]
 
652
 
 
653
=item B<< --sconffile <file> >>
 
654
 
 
655
Use E<lt>fileE<gt> as plugin configuration. [undefined]
 
656
 
 
657
=item B< --help >
 
658
 
 
659
View this help message.
 
660
 
 
661
=item B< --debug >
 
662
 
 
663
View debug messages.
 
664
 
 
665
=item B< --version >
 
666
 
 
667
Show version information.
 
668
 
 
669
=back
 
670
 
 
671
=head1 DESCRIPTION
 
672
 
 
673
Munin's node is a daemon that Munin connects to fetch data. This data is
 
674
stored in .rrd-files, and later graphed and htmlified. It's designed to
 
675
let it be very easy to graph new datasources.
 
676
 
 
677
munin-run is a small perlscript to run the plugins used by the munin-node
 
678
daemon from the command line.
 
679
 
 
680
For more information, see the documentation section at L<http://munin.sf.net/>.
 
681
 
 
682
=head1 FILES
 
683
 
 
684
        @@CONFDIR@@/munin-node.conf
 
685
        @@CONFDIR@@/plugins/*
 
686
        @@CONFDIR@@/plugin-conf.d/*
 
687
        @@STATEDIR@@/munin-node.pid
 
688
        @@LOGDIR@@/munin-node
 
689
 
 
690
=head1 VERSION
 
691
 
 
692
This is munin-node v@@VERSION@@
 
693
 
 
694
=head1 AUTHORS
 
695
 
 
696
Audun Ytterdal, Jimmy Olsen, and Tore Anderson.
 
697
 
 
698
=head1 BUGS
 
699
 
 
700
munin-node does, as of now, not check the syntax of the configuration file.
 
701
 
 
702
Please report other bugs in the bug tracker at L<http://munin.sf.net/>.
 
703
 
 
704
=head1 COPYRIGHT
 
705
 
 
706
Copyright � 2002 Audun Ytterdal, Jimmy Olsen, and Tore Anderson / Linpro AS.
 
707
 
 
708
This is free software; see the source for copying conditions. There is
 
709
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
 
710
PURPOSE.
 
711
 
 
712
This program is released under the GNU General Public License
 
713
 
 
714
=cut
 
715
 
 
716
# vim:syntax=perl