Changeset 1244

Show
Ignore:
Timestamp:
11/15/06 00:24:33 (5 years ago)
Author:
janl
Message:
  • Structure .pm's propperly and localize @@ to them

(not quite done yet)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • people/janl/libperl/Munin.pm.in

    r1203 r1244  
    1 package Munin; 
     1# package Munin; 
    22# -*- perl -*- 
    33# 
    4 # Copyright (C) 2003-2004 Jimmy Olsen, Audun Ytterdal 
     4# Copyright (C) 2003-2006 Jimmy Olsen, Audun Ytterdal, Nicolai Langfeldt 
    55# 
    66# This program is free software; you can redistribute it and/or 
     
    1818# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
    1919# 
    20 # 
    21 # 
    2220# $Id$ 
    23 # 
    2421 
    2522use Exporter; 
    2623@ISA = ('Exporter'); 
    27 @EXPORT = ('munin_trend',  
    28            'munin_fetch',  
    29            'munin_nscasend',  
     24@EXPORT = ('munin_trend', 
     25           'munin_fetch', 
     26           'munin_nscasend', 
    3027           'munin_createlock', 
    3128           'munin_removelock', 
     
    5047           'munin_get_max_label_length', 
    5148           'munin_get_field_order', 
    52            'munin_get_rrd_filename' 
     49           'munin_get_rrd_filename', 
    5350           ); 
    5451 
     
    5956use Symbol 'gensym'; 
    6057 
    61 my $VERSION = "@@VERSION@@"
     58my $VERSION = '@@VERSION@@'
    6259 
    6360my $nsca = new IO::Handle; 
     
    6562 
    6663my $DEBUG=0; 
    67 my $configfile="@@CONFDIR@@/munin.conf"
     64my $configfile='@@CONFDIR@@/munin.conf'
    6865 
    6966my @legal = ("tmpldir", "ncsa", "ncsa_server", "ncsa_config", "rundir", 
    70         "dbdir", "logdir", "htmldir", "include", "domain_order", "node_order",  
    71         "graph_order", "graph_sources", "fork", "graph_title", "create_args",  
    72         "graph_args", "graph_vlabel", "graph_vtitle", "graph_total",  
    73         "graph_scale", "graph", "update", "host_name", "label", "cdef", "draw",  
    74         "graph", "max", "min", "negative", "skipdraw", "type", "warning",  
    75         "critical", "special_stack", "special_sum", "stack", "sum", "address",  
    76         "htaccess", "warn", "use_default_name", "use_node_name", "port",  
    77         "graph_noscale", "nsca", "nsca_server", "nsca_config", "extinfo",  
    78         "fetch_data", "filename", "max_processes", "nagios", "info",  
    79         "graph_info", "graph_category", "graph_strategy", "graph_width",  
     67        "dbdir", "logdir", "htmldir", "include", "domain_order", "node_order", 
     68        "graph_order", "graph_sources", "fork", "graph_title", "create_args", 
     69        "graph_args", "graph_vlabel", "graph_vtitle", "graph_total", 
     70        "graph_scale", "graph", "update", "host_name", "label", "cdef", "draw", 
     71        "graph", "max", "min", "negative", "skipdraw", "type", "warning", 
     72        "critical", "special_stack", "special_sum", "stack", "sum", "address", 
     73        "htaccess", "warn", "use_default_name", "use_node_name", "port", 
     74        "graph_noscale", "nsca", "nsca_server", "nsca_config", "extinfo", 
     75        "fetch_data", "filename", "max_processes", "nagios", "info", 
     76        "graph_info", "graph_category", "graph_strategy", "graph_width", 
    8077        "graph_height", "graph_sums", "local_address", "compare", 
    81         "text", "command", "contact", "contacts",  "max_messages",  
     78        "text", "command", "contact", "contacts",  "max_messages", 
    8279        "always_send", "notify_alias", "line", "state", "graph_period", 
    8380        "cgiurl_graph", "cgiurl", "tls", "service_order", "category_order", 
    84         "version", "tls_certificate", "tls_private_key", "tls_pem",  
     81        "version", "tls_certificate", "tls_private_key", "tls_pem", 
    8582        "tls_verify_certificate", "tls_verify_depth", "graph_data_size", 
    8683        "colour", "graph_printf" 
     
    9087 
    9188# Fields to copy when "aliasing" a field 
    92 my @copy_fields    = ("label", "draw", "type", "rrdfile", "fieldname", "info");  
    93  
     89my @copy_fields    = ("label", "draw", "type", "rrdfile", "fieldname", "info"); 
     90 
     91# Make configuration settings available at runtime. 
     92my $PREFIX               = '@@PREFIX@@'; 
     93$ENV{'MUNIN_PREFIX'}     = $PREFIX; 
     94my $CONFDIR              = '@@CONFDIR@@';   # /etc/munin,/etc/opt/munin or such 
     95$ENV{'MUNIN_CONFDIR'}    = $CONFDIR; 
     96my $BINDIR               = '@@BINDIR@@'; 
     97$ENV{'MUNIN_BINDIR'}     = $BINDIR; 
     98my $SBINDIR              = '@@SBINDIR@@'; 
     99$ENV{'MUNIN_SBINDIR'}    = $SBINDIR; 
     100my $DOCDIR               = '@@DOCDIR@@'; 
     101$ENV{'MUNIN_DOCDIR'}     = $DOCDIR; 
     102my $LIBDIR               = '@@LIBDIR@@';    # LIBDIR/plugins contains plugin.sh 
     103$ENV{'MUNIN_LIBDIR'}     = $LIBDIR; 
     104my $HTMLDIR              = '@@HTMLDIR@@'; 
     105$ENV{'MUNIN_HTMLDIR'}    = $HTMLDIR; 
     106my $CGIDIR               = '@@CGIDIR@@'; 
     107$ENV{'MUNIN_CGIDIR'}     = $CGIDIR; 
     108my $DBDIR                = '@@DBDIR@@'; 
     109$ENV{'MUNIN_DBDIR'}      = $DBDIR; 
     110my $PLUGSTATE            = '@@PLUGSTATE@@'; # Put plugin state files here! 
     111$ENV{'MUNIN_PLUGSTATE'}  = $PLUGSTATE;      # Put plugin state files here! 
     112my $MANDIR               = '@@MANDIR@@'; 
     113$ENV{'MUNIN_MANDIR'}     = $MANDIR; 
     114my $LOGDIR               = '@@LOGDIR@@'; 
     115$ENV{'MUNIN_LOGDIR'}     = $LOGDIR; 
     116my $STATEDIR             = '@@STATEDIR@@';  # This is for .pid files 
     117$ENV{'MUNIN_STATEDIR'}   = $STATEDIR;       # This is for .pid files 
     118my $USER                 = '@@USER@@';      # User munin runs as (mostly) 
     119$ENV{'MUNIN_USER'}       = $USER;           # User munin runs as (mostly) 
     120my $GROUP                = '@@GROUP@@';     # Group ditto 
     121$ENV{'MUNIN_GROUP'}      = $GROUP;          # Group ditto 
     122my $PLUGINUSER           = '@@PLUGINUSER@@';# Default user for plugin running 
     123$ENV{'MUNIN_PLUGINUSER'} = $PLUGINUSER;     # Default user for plugin running 
     124$ENV{'MUNIN_VERSION'}    = $VERSION; 
     125my $PERL                 = '@@PERL@@'; 
     126$ENV{'MUNIN_PERL'}       = $PERL; 
     127my $PERLLIB              = '@@PERLLIB@@'; 
     128$ENV{'MUNIN_PERLLIB'}    = $PERLLIB; 
     129my $GOODSH               = '@@GOODSH@@'; 
     130$ENV{'MUNIN_GOODSH'}     = $GOODSH; 
     131my $BASH                 = '@@BASH@@'; 
     132$ENV{'MUNIN_BASH'}       = $BASH; 
     133my $PYTHON               = '@@PYTHON@@'; 
     134$ENV{'MUNIN_PYTHON'}     = $PYTHON; 
     135my $OSTYPE               = '@@OSTYPE@@'; 
     136$ENV{'MUNIN_OSTYPE'}     = $OSTYPE; 
     137my $HOSTNAME             = '@@HOSTNAME@@'; 
     138$ENV{'MUNIN_HOSTNAME'}   = $HOSTNAME; 
     139my $MKTEMP               = '@@MKTEMP@@'; 
     140$ENV{'MUNIN_MKTEMP'}     = $MKTEMP; 
    94141 
    95142sub munin_trend { 
  • people/janl/node/munin-node.in

    r1198 r1244  
    2727use vars qw(@ISA); 
    2828use Getopt::Long; 
     29use Munin; 
    2930use Net::Server::Fork; # any personality will do 
    3031 
     
    4546$0 =~ /^(.*)$/; # for some strange reason won't "$0 = $0;" work. 
    4647$0 = $1; 
    47  
    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@@'; 
    7448 
    7549@ISA = qw(Net::Server::Fork); 
  • people/janl/server/munin-update.in

    r1179 r1244  
    1 #!@@PERL@@ -w 
    2 # -*- cperl -*- 
     1#!/usr/bin/perl -w 
    32# 
    4 # Copyright (C) 2002-2004 Jimmy Olsen, Audun Ytterdal 
     3# Copyright (C) 2002-2006 Jimmy Olsen, Audun Ytterdal, Nicolai Langfeldt 
    54# 
    65# This program is free software; you can redistribute it and/or 
     
    2625use strict; 
    2726use IO::Socket; 
     27use lib "../build/libperl"; 
    2828use Munin; 
    2929use Time::HiRes; 
     
    3535 
    3636my $DEBUG=0; 
    37 my $VERSION="@@VERSION@@"
     37my $VERSION='@@VERSION@@'
    3838my $serversocket  = "munin-server-socket.$$"; 
    39 my $conffile = "@@CONFDIR@@/munin.conf"; 
     39my $conffile = $Munin::CONFDIR."/munin.conf"; 
    4040my $force_root = 0; 
    4141my $do_usage = 0; 
     
    8080                        may be supplied. 
    8181    --config <file>     Use <file> as configuration file.  
    82                         [@@CONFDIR@@/munin.conf] 
     82                        [$Munin::CONFDIR/Munin.conf] 
    8383    --[no]debug         View debug messages. [--nodebug] 
    8484    --[no]fork          Don't fork one instance for each host. [--fork] 
     
    955955      my $cert; 
    956956      $key = $cert = munin_get ($config, "tls_pem", undef, $domain, $name); 
    957       $key = &munin_get ($config, "tls_private_key", "@@CONFDIR@@/munin.pem", $domain, $name) 
     957      $key = &munin_get ($config, "tls_private_key", "$Munin::CONFDIR/munin.pem", $domain, $name) 
    958958          unless defined $key; 
    959       $cert = &munin_get ($config, "tls_certificate", "@@CONFDIR@@/munin.pem", $domain, $name) 
     959      $cert = &munin_get ($config, "tls_certificate", "$Munin::CONFDIR/munin.pem", $domain, $name) 
    960960          unless defined $cert; 
    961961      if (!start_tls ($socket, $tls_requirement, $cert, $key,