/usr/share/perl5/Munin/Common/Config.pm is in munin-common 2.0.37-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | package Munin::Common::Config;
# $Id$
use warnings;
use strict;
use Carp;
use English qw(-no_match_vars);
# Functions here are unable to log as they don't know if they're used
# by the node or the master which use divergent logging facilities.
# In fact, the list in %legal is only used by the master.
my %legal = map { $_ => 1 } qw(
address
always_send
category_order
cdef
cdef_name
cgitmpdir
cgiurl
cgiurl_graph
colour
command
compare
contact
contacts
create_args
critical
dbdir
domain_order
draw
dropdownlimit
extinfo
fetch_data
filename
fork
graph
graph
graphable
graph_args
graph_args_after
graph_category
graph_data_size
graph_future
graph_height
graph_info
graph_noscale
graph_order
graph_period
graph_printf
graph_scale
graph_sources
graph_strategy
graph_sums
graph_title
graph_total
graph_vlabel
graph_vtitle
graph_width
group_order
host_name
htaccess
htmldir
html_rename
html_strategy
includedir
info
label
line
local_address
logdir
max
max_cgi_graph_jobs
max_graph_jobs
max_html_jobs
max_messages
max_processes
max_size_x
max_size_y
min
munin_cgi_graph_jobs
nagios
ncsa
ncsa_config
ncsa_server
negative
node_order
notify_alias
nsca
nsca_config
nsca_server
num_messages
num_unknowns
ok
onlynullcdef
palette
pipe
pipe_command
port
predict
process
realname
realservname
rrdcached_socket
rundir
service_order
skipdraw
ssh_command
ssh_options
stack
state
staticdir
sum
text
timeout
tls
tls_ca_certificate
tls_certificate
tls_match
tls_pem
tls_private_key
tls_verify_certificate
tls_verify_depth
tmpldir
trend
type
unknown
unknown_limit
update
update_rate
use_default_name
use_node_name
use_default_node
version
warn
warning
worker_start_delay
);
my %bools = map { $_ => 1} qw(yes no true false on off 1 0);
sub cl_is_keyword {
# Class-less version of is_keyword for legacy code.
my ($word) = @_;
return defined $legal{$word};
}
sub is_keyword {
my ($self, $word) = @_;
return defined $legal{$word};
}
sub parse_config_from_file {
my ($self, $config_file) = @_;
$config_file ||= $self->{config_file};
open my $file, '<', $config_file
or croak "ERROR: Cannot open '$config_file': $OS_ERROR";
# Note, parse_config is provided by node or master specific config class
eval {
$self->parse_config($file);
};
if ($EVAL_ERROR) {
croak "ERROR: Failed to parse config file '$config_file': $EVAL_ERROR";
}
close $file
or croak "Cannot close '$config_file': $OS_ERROR";
}
sub _trim {
# Trim leading and trailing whitespace.
my $class = shift;
chomp $_[0];
$_[0] =~ s/^\s+//;
$_[0] =~ s/\s+$//;
return;
}
# allows # characters to get through as long as they're escaped
# with a backslash
sub _strip_comment {
my $class = shift;
$_[0] =~ s/(?<!\\)#.*//;
$_[0] =~ s/\\#/#/g;
return;
}
sub _looks_like_a_bool {
my ($class, $str) = @_;
return $bools{lc $str};
}
sub _parse_bool {
my ($class, $str) = @_;
croak "Parse exception: '$str' is not a boolean."
unless $class->_looks_like_a_bool($str);
return $str =~ m{\A no|false|off|0 \z}xi ? 0 : 1;
}
1;
__END__
=head1 NAME
Munin::Common::Config - Abstract base class for common config code.
=head1 SYNOPSIS
Don't use it directly. See L<Munin::Master::Config> and L<Munin::Node::Config>.
=head1 METHODS
=over
=item B<parse_config_from_file>
$config->parse_config_from_file($file_name);
Parses the configuration in $file_name.
=back
|