[-]
[+]
|
Changed |
munin.spec
|
|
[-]
[+]
|
Added |
munin-1.4.tar.bz2/Announce-1.4.0
^
|
@@ -0,0 +1,59 @@
+Introducing Munin 1.4.0!
+
+Munin 1.4 is expected to appear in Debian Unstable and in EPEL within
+not too long. Will also appear in Ubuntu later. If you are a
+packager please contact us and we'll list your
+support/repository/whatever on our Wiki.
+
+The most important features:
+* Better scalabilith through:
+ - Multigraph plugins: One plugin, many graphs.
+ This makes it possible to graph switches efficiently as one example.
+ In our test environment graphing one 16 port switch went from over 30
+ seconds to 3 seconds (please see snmp__if_multi and multigraph_tester
+ plugins for examples).
+ - Prallellized munin-graph (tunable number of processes)
+ - Nesting of groups to any depth:
+ "Conglomerate;US;New_York;Manhattan;6th-floor;" if you wish
+ - Slightly better templates
+* Better security through TLS (SSL) session encryption and
+ certificates to authenticate masters and slaves.
+* Better SNMP support: SNMP version 1, 2c and 3, all modes of authentication
+ are supported (but autoconfiguration of 3 is not quite there yet).
+ (only applies to "most" SNMP plugins: those that have been ported to
+ use Munin::Plugin::SNMP, some remain unported)
+* (exactly one instance of) "includedir" in munin.conf includes all files
+ in that directory in the configuration.
+* munindoc command to show plugin documentaiton. A majority of the
+ plugins are documented now - no need to read the code - in most cases ;-)
+* New fab look on HTML pages, new graph colours with better contrast
+* More than 100 new plugins since the 1.2 series.
+ - Among them are a set of jmx based Java plugins to monitor JVMs.
+ - A new and better MySQL plugin patterned on the Cacti MySQL plugin
+ - PgSQL plugins based on generic Munin::Plugin::Pgsql module
+ - Asterisk plugins
+ - Netapp plugin
+* Slightly better "not Linux" support:
+ - More Solaris plugins. Solaris plugin names have been aligned with
+ the other platforms.
+ - Core programs should play nice on all flavours of AIX
+ - Nominal OS X ("darwin") support. (need someone to make a .img for us :-)
+ - Some HP-UX plugins have been contributed
+ - Good bunch of NetBSD plugins have been contributed
+ - Still support for FreeBSD :-)
+ - And many many others
+* Ever better documentation everywhere, not least our web/wiki pages
+ at munin-monitoring.org.
+* More bugfixes, both in the core code and plugins, than you can shake
+ a stick at
+* Plugins can specify colours and printf format
+* Works well with RRD 1.3
+
+Other things you may want to know:
+* munin-update and munin-node (and family) have been refactored and are
+ much nicer to hack now.
+* CGI graphing remains "in BETA" but we now have a FASTCGI script too.
+
+Full details in
+http://munin-monitoring/browser/tags/1.4.0/ChangeLog (once we
+have released 1.4.0 FIX)
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/ChangeLog
^
|
@@ -1,11 +1,94 @@
-*- text -*-
Some stats on 1.4.0:
-* Over 1430 changesets
+* Over 1500 changesets
* More than 100 new plugins
* Commits from 13 different people (**FIXME** Check again at release)
* Way too much time since the last major stable release
+munin (1.4.0-beta, r2982:3032, 2009-11-21)
+
+* ejabberd_: Fix some documentation and other problems, move to
+ generic plugin directory (not Linux specific software)
+* No .t files in the TAGS file!
+* munin-update: Make rrd files even if the DS label evaluates to false
+ in perl (e.g., foo.label 0)
+* bind9: Parse query logs with view information. Closes #661
+* linux/ip_: Avoid matching x.x.x.2 with x.x.x.24. Fix is "obviously"
+ correct and has only been syntax checked
+* linux/ip_: Document that we won't support rule matching on the "any"
+ firewall framework
+* linux/cps_ (LVS) plugin fixed by incurporating patch in #636. Not
+ tested beyond a syntax/autoconf test
+* bind9_rndc: Parse BIND 9.6 stats output.
+* exim_mailqueue: Add documentation about user required to run plugin and
+ modidy AWK script as the default action is to print the whole line, which
+ was done...
+* Various fixees to various plugins
+* sunos/iostat: New plugin showhing I/O thruput on Solaris
+* exim_mailstats: count the number of received, rejected and completed
+ emails using regexes rather than substr(). fix for ticket #698.
+ also suppress stderr when fetching the log_file_path, remove some
+ unnecessary code, improve error when the logfile is unreadable, and
+ tidy up here and there.
+* dev_scripts/install: add install-plugins-prime to the targets run
+ during a standard install. makes working on plugins rather easier,
+ since a full, slow, salted-earth reinstall isn't required.
+* postfix_mailstats: remove processing of rotated logfiles, as decided
+ in ticket #631. also includes a bit of tidying, and descriptive
+ error messages when bailing rather than relying exclusively on exit
+ status. i don't have a postfix server to hand, so this is not
+ exactly well tested...
+* Plugin execution: remove undefined elements from the plugin command
+ passed to exec. this fixes the underlying problem the yum plugin
+ was encountering earlier.
+* linux/yum: change yum plugin so it ignores defined-but-empty
+ arguments. makes fetch work again.
+* munin-graph: Re-introduce line continuation in the rrdtool graph
+ command debug output
+* Make munin_graph immune to redundance in graph_order field
+* M::M::Config: Enhance a error message to include input line number
+* linux/fw_conntrack: Let there be a total.value even if the input is empty
+* linux/diskstat_: Document problem with multiple masters
+* overview template: Remove COMPARE links as we will not be able to make them
+ correct in any reasonable timeframe. The datastructure we have now does
+ not support that O:-)
+* munin.conf.pod: Removed the list of example required parameters
+ configurations from munin.conf man page, as they are not required
+ anymore, instead moved them to the explanation section for each
+ parameter, showing the default
+* linux/iostat: Changed to manual, as they are replaced by the new
+ diskstat_ plugin by Michael Renner
+* linux/threads: make a little less racy (and a tiny bit more
+ efficient to boot). it's still not perfect, because even now
+ there's a gap between the shell expanding the glob and grep getting
+ round to reading the files, but at least it complains less.
+* log anything that plugins print to stderr. also sends a brief
+ message back to the server explaining what went wrong. fix for
+ ticket #582.
+* munin-graph: Stop trying to copy cdef when aliasing fields in
+ graph_order -- 1.2 doesn't do that.
+* Changing munin.conf.pod, munin-cron.pod to munin.conf.pod.in
+ munin-cron.pod.in. Adjusting Makefile accordingly. Closes #753
+* munin-node: Do "next" on weird filenames not "return" so that we
+ read all plugin config files
+* favicon for all templates. Refactored the finding of the root path
+ and css name in the process. Added tests for get_root_path
+* modify how nested timeouts are handled, as discussed with janl.
+ this fixes the bug whereby a connection to munin-node would be
+ unexpectedly terminated if a plugin took more than 10 seconds to
+ run, regardless of whether this was allowed by the plugin
+ configuration.
+* Catch problems if someone forgot a "address <IP>" or "update no" -
+ and make it plain in the error message.
+* Use_node_name should default to "no". Closes #757
+* Clearify munin_set_var_loc error message so we know what value is
+ set illegaly
+* munin-node: Improve error reporting during startup by sort of
+ merging it with _run_service(). move the eval to the very top of
+ the event loop so as to avoid interfering with the session timeout.
+* linux/fw_conntrack: Now works in 2.6, closes #532, thanks :-)
+* Added ejabberd contrib plugin, moved from debian patches
munin (1.4.0-alpha2, r2899:2981, 2009-11-13)
@@ -203,7 +286,7 @@
in the filesystem instead. This will cause a propagation delay -
image sizes _may_ be wrong, until munin-html runs again.
* munin-graph: set m/a time of png to last modification time of the
- corresponding rrd file
+ corresponding rrd file (since reverted)
* Adapt patch in #3 to current munin-cgi-graph for non-fastcgi. Closes #3.
Thanks to blueyed
* Adapt patch in #3 to current munin-cgi-graph to obtain munin-fastcgi-graph
@@ -236,12 +319,13 @@
across all three applications.
* Report errors against plugins with inconsistent/unexpected magic markers.
* Java plugins written by FIX. Adapted for inclusion in munin by Erik
- Bolsø, Tom Feiner nad Ilya Kikoin. THANKS!
+ Bolsø, Tom Feiner and Ilya Kikoin. THANKS!
* Applied patch by Katriel Traum for snmp__memory that converts the plugin
to use Munin::Plugin::SNMP, and does some clean-ups
* New plugin: nomadix_users_. Monitors a kind of enterprise wifi
infrastructure.
-* snmp__if_multi: Updated with some known bugs/enhancement needs as well as better author/copyright info
+* snmp__if_multi: Updated with some known bugs/enhancement needs as well
+ as better author/copyright info
* linux/ip_: Better support for IPv6. Patch by Rune Skillingstad, thanks!
Closes #563.
* linux/if_* plugins: Even more virtual lan support. Patch by Rune
@@ -535,7 +619,7 @@
* Clearify the purpose of DESTDIR
* plugin qmail-qstat now uses a single pipe to generate all output
* new plugin: qmailqstat contributed by Nils Breunese
-Add an eval to $DF to expand the string to arguments.
+* Add an eval to $DF to expand the string to arguments.
* And a changelog for 1.3.4 too
* Update RELEASE and plugins.history for 1.3.4
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/Checklist
^
|
@@ -1,5 +1,7 @@
This is a pre-release checklist for the maintainer.
+ * is there any "FIX" in: ChangeLog, INSTALL, Announce?
+
* Does make node-monkeywrench run without abnormal abortions?
* Is .htaccess installed?
* rm -f /etc/munin/plugins/*
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/Makefile
^
|
@@ -2,7 +2,7 @@
#
# Gnu make only. Seriously.
#
-# $Id: Makefile 2951 2009-11-10 20:13:54Z knuthaug $
+# $Id: Makefile 3027 2009-11-20 15:07:32Z janl $
# Defaults/paths. Allows $(CONFIG) to be overrided by
# make command line
@@ -23,8 +23,8 @@
MANCENTER := "Munin Documentation"
MAN8 := master/_bin/munin-graph master/_bin/munin-update \
master/_bin/munin-limits master/_bin/munin-html
-PODMAN8 := master/doc/munin-cron master/doc/munin master/doc/munin-check
-PODMAN5 := master/doc/munin.conf node/doc/munin-node.conf
+PODMAN8 := build/master/doc/munin-cron master/doc/munin master/doc/munin-check
+PODMAN5 := build/master/doc/munin.conf node/doc/munin-node.conf
.PHONY: install install-pre install-master-prime install-node-prime install-node-pre install-common-prime install-doc install-man \
build build-common-prime build-common-pre build-doc \
@@ -53,7 +53,7 @@
tags:
-rm -f TAGS
- find master common -type f | egrep -v '/(build|_build|blib|.svn|\.t$$)/' | fgrep -v '~' | xargs etags -l perl -a
+ find master common -type f | egrep -v '/(build/|_build/|blib/|\.svn/)' | grep -v '\.t$$' | fgrep -v '~' | xargs etags -l perl -a
######################################################################
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/common/lib/Munin/Common/Timeout.pm
^
|
@@ -1,7 +1,7 @@
use warnings;
use strict;
-# $Id: Timeout.pm 2431 2009-09-16 10:04:17Z janl $
+# $Id: Timeout.pm 2996 2009-11-17 18:35:51Z ligne $
package Munin::Common::Timeout;
use base qw(Exporter);
@@ -24,9 +24,9 @@
sub do_with_timeout {
my ($timeout, $block) = @_;
- croak "Argument exception: \$timeout"
+ croak 'Argument exception: $timeout'
unless $timeout && $timeout =~ /^\d+$/;
- croak "Argument exception: \$block"
+ croak 'Argument exception: $block'
unless ref $block eq 'CODE';
my $old_alarm = alarm 0;
@@ -44,23 +44,25 @@
my $remaining_alarm = alarm 0;
- $SIG{ALRM} = $old_handler ? $old_handler : 'DEFAULT';
+ $SIG{ALRM} = $old_handler || 'DEFAULT';
$current_timeout = $old_current_timeout;
if ($old_alarm) {
- my $old_alarm = $old_alarm - $timeout + $remaining_alarm;
- if ($old_alarm > 0) {
- alarm($old_alarm);
- }
- else {
- #It should have gone off already - so set it off
- kill 'ALRM', $$;
- }
+ my $old_alarm = $old_alarm - $timeout + $remaining_alarm;
+
+ # HACK: give the outer loop a couple of seconds to finish up before
+ # timing out. a compromise between the requirements of munin-node
+ # (which shouldn't have the inner plugin timeout trigger the outer
+ # session timeout) and munin-update (which has a hard-and-fast limit
+ # on the time the outer timeout can run for).
+ $old_alarm = 10 unless ($old_alarm > 0);
+
+ alarm($old_alarm);
}
if ($err) {
- return if $EVAL_ERROR eq "alarm\n";
+ return 0 if $err eq "alarm\n";
die; # Propagate any other exceptions
}
@@ -124,3 +126,5 @@
=back
+=cut
+# vim: ts=4 : sw=4 : et
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/common/t/munin_common_timeout.t
^
|
@@ -43,9 +43,9 @@
for (;;) {}
});
});
-
- ok(!$stat1, "Outer timed out during evaluation of inner");
+
ok(!$stat2, "Inner timed out");
+ ok($stat1, "Outer didn't time out during evaluation of inner");
}
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/dev_scripts/install
^
|
@@ -13,7 +13,7 @@
fi
make DESTDIR=$DESTDIR HTMLDIR=$DESTDIR/www/munin || exit
-fakeroot make install-common-prime install-master-prime install-node-prime install-man DESTDIR=$DESTDIR HTMLDIR=$DESTDIR/www/munin || exit
+fakeroot make install-common-prime install-master-prime install-node-prime install-plugins-prime install-man DESTDIR=$DESTDIR HTMLDIR=$DESTDIR/www/munin || exit
if [ $1 ]; then
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/master/doc/munin-cron.pod.in
^
|
(renamed from master/doc/munin-cron.pod)
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/master/doc/munin-cron.pod.in
^
|
(renamed from master/doc/munin-cron.pod)
|
[-]
[+]
|
Deleted |
munin-1.4.tar.bz2/master/doc/munin.conf.pod
^
|
@@ -1,342 +0,0 @@
-=head1 NAME
-
-munin.conf - Munin configuration file
-
-=head1 DESCRIPTION
-
-Munin is a group of programs to gather data from hosts, graph them,
-create html-pages, and optionally warn contacts about any off-limit
-values.
-
-The hosts are divided into three groups: One master (could be more,
-but Munin is not cluster aware so they'll likely be independent). The
-master contacts a number of machines running munin-node, these are
-called nodes. Each node has data from one or more hosts that is
-monitored by Munin.
-
-F<munin.conf> is the configuration file for the Munin master server.
-The programs using it are munin-update, munin-graph, munin-limits and
-munin-html. There is also quite extensive documentation of this file
-at L<http://munin.projects.linpro.no/wiki/munin.conf>
-
-The format of the file is simple. A minimal configuration looks
-something like:
-
- dbdir /var/lib/munin
- logdir /var/log/munin
- htmldir /var/www/munin
- rundir /var/run/munin
- tmpldir /etc/munin/templates/
-
- [machine1.your.dom]
- address localhost
-
-The default location of F<munin.conf> is F<@@CONFDIR@@/munin.conf>.
-If your placement deviates from this norm, use the "--config
-E<lt>fileE<gt>"-option when running the munin-* programs.
-
-Munin-update will expand all node-entries in this file, and save them
-to F<@@DBDIR@@/datafile>, which is used by all programs in the package
-together with this file.
-
-Any directives in this file will override directives of the same name
-in F<datafile>. E.g., if you want to change the title of the
-"load"-graph in the above minimum configuration, you would modify the
-two bottom lines to:
-
- [machine1.your.dom]
- address localhost
- load.graph_title Edited title of the load-graph
-
-This will override the C<graph_title> attribute of the C<load>
-field/data series while keeping all the others at their default.
-
-=head1 GLOBAL DIRECTIVES
-
-These directives should appear in F<munin.conf> before any host or
-group definitions.
-
-=over
-
-=item B<dbdir> I<path>
-
-Directory for generated database files. Required.
-
-=item B<logdir> I<path>
-
-Directory for log files. Required.
-
-=item B<htmldir> I<path>
-
-Directory for HTML pages and graphs. Required.
-
-=item B<rundir> I<path>
-
-Directory for files tracking munin's current running state. Required.
-
-=item B<tmpldir> I<path>
-
-Directory for templates used to generate HTML pages. Required.
-
-=item B<fork> I<value>
-
-This directive determines whether munin-update fork when gathering
-information from nodes. Possible values are C<yes> and C<no>.
-Default is C<yes>. If you set it to C<no> munin-update will collect
-data from the nodes in sequence rather than in parallel and this will
-take considerably more time. Affects: munin-update.
-
-=item B<palette> I<default|old>
-
-Choose palette between the very nice "C<default>", and the good old
-"C<old>".
-
-=item B<graph_data_size> I<value>
-
-This directive sets the resolution of the RRD files that are created.
-Possible values are C<normal> and C<huge>. Default is C<normal>.
-C<Huge> is really huge, it saves the complete data with 5 minute
-resolution for 400 days. This will probably increase the I/O load on
-your Munin master, and currently has very little benefit. Affects:
-munin-update.
-
-=item B<graph_strategy> I<value>
-
-This directive can be C<cron> or C<cgi>. This determines whether
-graphs will be produced when the cron job is run or whether they will
-be generated by the CGI script (Links this CGI script will be added to
-the HTML pages if C<cgi> is selected). This is one of several steps
-required to enable CGI graphing, see
-L<http://munin.projects.linpro.no/wiki/CgiHowto> for more details.
-Default is C<cron>. Affects: munin-graph and munin-html.
-
-=item B<local_address> I<value>
-
-The local address to connect any node from in case the master has
-several IP interfaces. This can be overriden by a group or global
-directive. Without this directive Munins traffic will originate from
-the master server according to the IP routing table.
-
-=item B<max_processes> <value>
-
-This directive specifies the maximum number of processes to be used
-for gathering information from nodes. If left blank, munin will use
-as many processes as necessary. Affects: munin-update.
-
-=item B<max_graph_jobs> <value>
-
-This directive specifies the maximum number of concurrent rrdgraph
-proesses started by munin-graph. The default is 6. A setting of 0
-disables concurrent processing. Affects: munin-graph
-
-=item B<max_cgi_graph_jobs> <value>
-
-This directiuve specifies the maximum number of concurrent
-munin-cgi-graph jobs. The web server can start a high number of
-munin-cgi-graph jobs which we can't stop, but munin-cgi-graph will
-throttle down how many rrdgraph calls will be running at the same time
-to this number. Affects: munin-cgi-graph and munin-fastcgi-graph.
-
-=item B<tls> <value>
-
-Can have four values. C<paranoid>, C<enabled>, C<auto>, and
-C<disabled>. C<Paranoid> and C<enabled> require a TLS connection,
-while C<disabled> will not attempt one at all.
-
-The current default is C<disabled> because C<auto> is broken. C<Auto>
-causes bad interaction between munin-update and munin-node if the node
-is unprepared to go to TLS.
-
-If you see data dropouts (gaps in graphs) please try to disable TLS.
-Affects: munin-update.
-
-=item B<tls_verify_certificate> <value>
-
-This directive can be C<yes> or C<no>. It determines if the remote
-certificate needs to be signed by a CA that is known locally. Default
-is C<no>. Affects: munin-update.
-
-=item B<tls_private_key> <value>
-
-This directive sets the location of the private key to be used for
-TLS. Default is @@CONFDIR@@/munin.pem. The private key and
-certificate can be stored in the same file. Affects: munin-update.
-
-=item B<tls_certificate> <value>
-
-This directive sets the location of the TLS certificate to be used for
-TLS. Default is @@CONFDIR@@/munin.pem. The private key and
-certificate can be stored in the same file. Affects: munin-update.
-
-=item B<tls_ca_certificate> <value>
-
-This directive sets the CA certificate to be used to verify the node's
-certificate, if tls_verify_certificate is set to C<yes>. Default is
-@@CONFDIR@@/cacert.pem. Affects: munin-update.
-
-=item B<tls_verify_depth> <value>
-
-This directive sets how many signings up a chain of signatures TLS is
-willing to go to reach a known, trusted CA when verifying a
-certificate. Default is C<5>. Affects: munin-update.
-
-=item FIXME: This section MAY be complete, it may be missing a directive or two.
-
-=back
-
-=head1 HOST DEFINITIONS
-
-Host definitions can have several types. In all forms, the definition
-is used to generate the host name and group for the host, and the
-following lines define its directives. All following directives apply
-to that node until another node definition or EOF. Note that when
-defining a nodename it is vital that you use a standard DNS name, as
-in, one that uses only a-z, '-', and '.'. While other characters can
-be used in a DNS name, it is against the RFC, and Munin uses the other
-characters as delimiters. If they appear in nodenames, unexpected
-behavior may occur.
-
-The simplest node definition defines the section for a new node by
-simply wrapping the DNS name of the node in brackets, e.g.
-C<[machine1.your.dom]>. This will add the node C<machine1.your.dom>
-to the group C<your.dom>.
-
-The next form of definition is used to define the node and group
-independently. It follows the form
-C<[your.dom;machine1.sub.your.dom]>. This adds the node
-C<machine1.sub.your.dom> to the group C<your.dom>. This can be useful
-if you have machines you want to put together as a group that are
-under different domains (as in the given example). This can also
-solve a problem if your machine is C<machine1.com>, where having a
-group of C<com> makes little sense.
-
-Multiple groups can be specified by adding more C<groupname;>s, e.g.
-C<[servers;local;mail;mail.foo.net]>, if you need a more hierarchical
-structure.
-
-=head1 NODE DIRECTIVES
-
-These are directives that can follow a node definition and will apply
-only to that node.
-
-=over
-
-=item B<address> <value>
-
-The IP address of the node. Required.
-
-=item B<local_address> <value>
-
-The local address to connect to the node from. This overrides a group or
-global directive.
-
-=item FIXME: This section is incomplete.
-
-=back
-
-=head1 PLUGIN DIRECTIVES
-
-These directives should appear after a node definition and are of the
-form C<plugin.directive E<lt>valueE<gt>>. Using these directives you
-can override various directives for a plugin, such as its contacts,
-and can also be used to create graphs containing data from other
-plugins.
-
-=over
-
-=item FIXME: This section is (obviously) incomplete.
-
-=back
-
-=head1 FIELD DIRECTIVES
-
-These directives should appear after a node definition and are of the
-form C<plugin.field E<lt>valueE<gt>>. Using these directives you can
-override values originally set by plugins on the nodes, such as
-warning and critical levels or graph names.
-
-=over
-
-=item B<graph_height> <value>
-
-The graph height for a specific service. Default is C<175>. Affects:
-munin-graph.
-
-=item B<graph_width> <value>
-
-The graph width for a specific service. Default is C<400>. Affects:
-munin-graph.
-
-=item B<warning> <value>
-
-The value at which munin-limits will mark the service as being in a
-warning state. Value can be a single number to specify a limit that
-must be passed or they can be a comma separated pair of numbers
-defining a valid range of values. Affects: munin-limits.
-
-=item B<critical> <value>
-
-The value at which munin-limits will mark the service as being in a
-critical state. Value can be a single number to specify a limit that
-must be passed or they can be a comma separated pair of numbers
-defining a valid range of values Affects: munin-limits.
-
-=item FIXME: This section is incomplete.
-
-=back
-
-=head1 EXAMPLES
-
-On all the examples below, all the 'top-level' parameters (dbdir,
-logdir, htmldir, tmpldir) are not present. They are only skipped for
-brevity - they are needed.
-
-=head1 EXAMPLE 1
-
-An example with three servers on two domains:
-
- [machine1.one.dom]
- address machine1.one.dom
-
- [machine2.one.dom]
- address 10.33.32.123
-
- [machine3.two.dom]
- address localhost
-
-This will appear as two groups (one.dom and two.dom), having
-respectively two and one node.
-
-=head1 EXAMPLE 2
-
-Summarize the 'load'-graphs of the two servers in one.dom, in a 'total
-load'-graph.
-
- [one.dom;Totals]
- update no
- load.graph_title Total load
- load.sum_load.label load
- load.sum_load.special_stack machine1=machine1.one.dom:load.load machine2=machine2.one.dom:load.load
-
-
-=head1 AUTHORS
-
-Jimmy Olsen, Audun Ytterdal, Brian de Wolf, Nicolai Langfeldt
-
-=head1 COPYRIGHT
-
-Copyright (C) 2002-2008 Audun Ytterdal, Jimmy Olsen, Nicolai
-Langfeldt, Linpro AS and others.
-
-This is free software; see the source for copying conditions. There is
-NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE.
-
-This program is released under the GNU General Public License
-
-=head1 SEE ALSO
-
-For more information, see the man pages of the individual munin-*
-programs or the Munin homepage L<http://munin.sf.net/>.
-
-=cut
|
[-]
[+]
|
Added |
munin-1.4.tar.bz2/master/doc/munin.conf.pod.in
^
|
@@ -0,0 +1,336 @@
+=head1 NAME
+
+munin.conf - Munin configuration file
+
+=head1 DESCRIPTION
+
+Munin is a group of programs to gather data from hosts, graph them,
+create html-pages, and optionally warn contacts about any off-limit
+values.
+
+The hosts are divided into three groups: One master (could be more,
+but Munin is not cluster aware so they'll likely be independent). The
+master contacts a number of machines running munin-node, these are
+called nodes. Each node has data from one or more hosts that is
+monitored by Munin.
+
+F<munin.conf> is the configuration file for the Munin master server.
+The programs using it are munin-update, munin-graph, munin-limits and
+munin-html. There is also quite extensive documentation of this file
+at L<http://munin.projects.linpro.no/wiki/munin.conf>
+
+The format of the file is simple. A minimal configuration looks
+something like:
+
+ [machine1.your.dom]
+ address localhost
+
+The default location of F<munin.conf> is F<@@CONFDIR@@/munin.conf>.
+If your placement deviates from this norm, use the "--config
+E<lt>fileE<gt>"-option when running the munin-* programs.
+
+Munin-update will expand all node-entries in this file, and save them
+to F<@@DBDIR@@/datafile>, which is used by all programs in the package
+together with this file.
+
+Any directives in this file will override directives of the same name
+in F<datafile>. E.g., if you want to change the title of the
+"load"-graph in the above minimum configuration, you would modify the
+two bottom lines to:
+
+ [machine1.your.dom]
+ address localhost
+ load.graph_title Edited title of the load-graph
+
+This will override the C<graph_title> attribute of the C<load>
+field/data series while keeping all the others at their default.
+
+=head1 GLOBAL DIRECTIVES
+
+These directives should appear in F<munin.conf> before any host or
+group definitions.
+
+=over
+
+=item B<dbdir> I<path> (Default: F<@@DBDIR@@>)
+
+Directory for generated database files. Required.
+
+=item B<logdir> I<path> (Default: F<@@LOGDIR@@>)
+
+Directory for log files. Required.
+
+=item B<htmldir> I<path> (Default: F<@@HTMLDIR@@>)
+
+Directory for HTML pages and graphs. Required.
+
+=item B<rundir> I<path> (Default: F<@@STATEDIR@@>)
+
+Directory for files tracking munin's current running state. Required.
+
+=item B<tmpldir> I<path> (Default: F<@@CONFDIR@@/templates>)
+
+Directory for templates used to generate HTML pages. Required.
+
+=item B<fork> I<value>
+
+This directive determines whether munin-update fork when gathering
+information from nodes. Possible values are C<yes> and C<no>.
+Default is C<yes>. If you set it to C<no> munin-update will collect
+data from the nodes in sequence rather than in parallel and this will
+take considerably more time. Affects: munin-update.
+
+=item B<palette> I<default|old>
+
+Choose palette between the very nice "C<default>", and the good old
+"C<old>".
+
+=item B<graph_data_size> I<value>
+
+This directive sets the resolution of the RRD files that are created.
+Possible values are C<normal> and C<huge>. Default is C<normal>.
+C<Huge> is really huge, it saves the complete data with 5 minute
+resolution for 400 days. This will probably increase the I/O load on
+your Munin master, and currently has very little benefit. Affects:
+munin-update.
+
+=item B<graph_strategy> I<value>
+
+This directive can be C<cron> or C<cgi>. This determines whether
+graphs will be produced when the cron job is run or whether they will
+be generated by the CGI script (Links this CGI script will be added to
+the HTML pages if C<cgi> is selected). This is one of several steps
+required to enable CGI graphing, see
+L<http://munin.projects.linpro.no/wiki/CgiHowto> for more details.
+Default is C<cron>. Affects: munin-graph and munin-html.
+
+=item B<local_address> I<value>
+
+The local address to connect any node from in case the master has
+several IP interfaces. This can be overriden by a group or global
+directive. Without this directive Munins traffic will originate from
+the master server according to the IP routing table.
+
+=item B<max_processes> <value>
+
+This directive specifies the maximum number of processes to be used
+for gathering information from nodes. If left blank, munin will use
+as many processes as necessary. Affects: munin-update.
+
+=item B<max_graph_jobs> <value>
+
+This directive specifies the maximum number of concurrent rrdgraph
+proesses started by munin-graph. The default is 6. A setting of 0
+disables concurrent processing. Affects: munin-graph
+
+=item B<max_cgi_graph_jobs> <value>
+
+This directiuve specifies the maximum number of concurrent
+munin-cgi-graph jobs. The web server can start a high number of
+munin-cgi-graph jobs which we can't stop, but munin-cgi-graph will
+throttle down how many rrdgraph calls will be running at the same time
+to this number. Affects: munin-cgi-graph and munin-fastcgi-graph.
+
+=item B<tls> <value>
+
+Can have four values. C<paranoid>, C<enabled>, C<auto>, and
+C<disabled>. C<Paranoid> and C<enabled> require a TLS connection,
+while C<disabled> will not attempt one at all.
+
+The current default is C<disabled> because C<auto> is broken. C<Auto>
+causes bad interaction between munin-update and munin-node if the node
+is unprepared to go to TLS.
+
+If you see data dropouts (gaps in graphs) please try to disable TLS.
+Affects: munin-update.
+
+=item B<tls_verify_certificate> <value>
+
+This directive can be C<yes> or C<no>. It determines if the remote
+certificate needs to be signed by a CA that is known locally. Default
+is C<no>. Affects: munin-update.
+
+=item B<tls_private_key> <value>
+
+This directive sets the location of the private key to be used for
+TLS. Default is @@CONFDIR@@/munin.pem. The private key and
+certificate can be stored in the same file. Affects: munin-update.
+
+=item B<tls_certificate> <value>
+
+This directive sets the location of the TLS certificate to be used for
+TLS. Default is @@CONFDIR@@/munin.pem. The private key and
+certificate can be stored in the same file. Affects: munin-update.
+
+=item B<tls_ca_certificate> <value>
+
+This directive sets the CA certificate to be used to verify the node's
+certificate, if tls_verify_certificate is set to C<yes>. Default is
+@@CONFDIR@@/cacert.pem. Affects: munin-update.
+
+=item B<tls_verify_depth> <value>
+
+This directive sets how many signings up a chain of signatures TLS is
+willing to go to reach a known, trusted CA when verifying a
+certificate. Default is C<5>. Affects: munin-update.
+
+=item FIXME: This section MAY be complete, it may be missing a directive or two.
+
+=back
+
+=head1 HOST DEFINITIONS
+
+Host definitions can have several types. In all forms, the definition
+is used to generate the host name and group for the host, and the
+following lines define its directives. All following directives apply
+to that node until another node definition or EOF. Note that when
+defining a nodename it is vital that you use a standard DNS name, as
+in, one that uses only a-z, '-', and '.'. While other characters can
+be used in a DNS name, it is against the RFC, and Munin uses the other
+characters as delimiters. If they appear in nodenames, unexpected
+behavior may occur.
+
+The simplest node definition defines the section for a new node by
+simply wrapping the DNS name of the node in brackets, e.g.
+C<[machine1.your.dom]>. This will add the node C<machine1.your.dom>
+to the group C<your.dom>.
+
+The next form of definition is used to define the node and group
+independently. It follows the form
+C<[your.dom;machine1.sub.your.dom]>. This adds the node
+C<machine1.sub.your.dom> to the group C<your.dom>. This can be useful
+if you have machines you want to put together as a group that are
+under different domains (as in the given example). This can also
+solve a problem if your machine is C<machine1.com>, where having a
+group of C<com> makes little sense.
+
+Multiple groups can be specified by adding more C<groupname;>s, e.g.
+C<[servers;local;mail;mail.foo.net]>, if you need a more hierarchical
+structure.
+
+=head1 NODE DIRECTIVES
+
+These are directives that can follow a node definition and will apply
+only to that node.
+
+=over
+
+=item B<address> <value>
+
+The IP address of the node. Required.
+
+=item B<local_address> <value>
+
+The local address to connect to the node from. This overrides a group or
+global directive.
+
+=item FIXME: This section is incomplete.
+
+=back
+
+=head1 PLUGIN DIRECTIVES
+
+These directives should appear after a node definition and are of the
+form C<plugin.directive E<lt>valueE<gt>>. Using these directives you
+can override various directives for a plugin, such as its contacts,
+and can also be used to create graphs containing data from other
+plugins.
+
+=over
+
+=item FIXME: This section is (obviously) incomplete.
+
+=back
+
+=head1 FIELD DIRECTIVES
+
+These directives should appear after a node definition and are of the
+form C<plugin.field E<lt>valueE<gt>>. Using these directives you can
+override values originally set by plugins on the nodes, such as
+warning and critical levels or graph names.
+
+=over
+
+=item B<graph_height> <value>
+
+The graph height for a specific service. Default is C<175>. Affects:
+munin-graph.
+
+=item B<graph_width> <value>
+
+The graph width for a specific service. Default is C<400>. Affects:
+munin-graph.
+
+=item B<warning> <value>
+
+The value at which munin-limits will mark the service as being in a
+warning state. Value can be a single number to specify a limit that
+must be passed or they can be a comma separated pair of numbers
+defining a valid range of values. Affects: munin-limits.
+
+=item B<critical> <value>
+
+The value at which munin-limits will mark the service as being in a
+critical state. Value can be a single number to specify a limit that
+must be passed or they can be a comma separated pair of numbers
+defining a valid range of values Affects: munin-limits.
+
+=item FIXME: This section is incomplete.
+
+=back
+
+=head1 EXAMPLES
+
+On all the examples below, all the 'top-level' parameters (dbdir,
+logdir, htmldir, tmpldir) are not present. They are only skipped for
+brevity - they are needed.
+
+=head1 EXAMPLE 1
+
+An example with three servers on two domains:
+
+ [machine1.one.dom]
+ address machine1.one.dom
+
+ [machine2.one.dom]
+ address 10.33.32.123
+
+ [machine3.two.dom]
+ address localhost
+
+This will appear as two groups (one.dom and two.dom), having
+respectively two and one node.
+
+=head1 EXAMPLE 2
+
+Summarize the 'load'-graphs of the two servers in one.dom, in a 'total
+load'-graph.
+
+ [one.dom;Totals]
+ update no
+ load.graph_title Total load
+ load.sum_load.label load
+ load.sum_load.special_stack machine1=machine1.one.dom:load.load machine2=machine2.one.dom:load.load
+
+
+=head1 AUTHORS
+
+Jimmy Olsen, Audun Ytterdal, Brian de Wolf, Nicolai Langfeldt
+
+=head1 COPYRIGHT
+
+Copyright (C) 2002-2008 Audun Ytterdal, Jimmy Olsen, Nicolai
+Langfeldt, Linpro AS and others.
+
+This is free software; see the source for copying conditions. There is
+NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE.
+
+This program is released under the GNU General Public License
+
+=head1 SEE ALSO
+
+For more information, see the man pages of the individual munin-*
+programs or the Munin homepage L<http://munin.sf.net/>.
+
+=cut
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/master/lib/Munin/Master/Config.pm
^
|
@@ -2,7 +2,7 @@
use base qw(Munin::Common::Config);
-# $Id: Config.pm 2926 2009-11-09 13:16:34Z janl $
+# $Id: Config.pm 3008 2009-11-19 11:46:01Z janl $
# Notes about config data structure:
#
@@ -434,6 +434,7 @@
# If all is not well we'll corak here.
my ($self,$longkey,$value) = @_;
+
my ($groups,$host,$key) = $self->_split_config_line($longkey);
@@ -441,8 +442,12 @@
my $last_word = pop(@words);
if (! $self->is_keyword($last_word)) {
+ # We have seen some problems with $value in the following
+ # error message. Se make sure it's defined so we can see the
+ # message.
+ $value = '' unless defined $value;
croak "Parse error in ".$self->{config_file}." for $key:\n".
- " Unknown keyword at end of left hand side of line ($key $value)\n";
+ " Unknown keyword at end of left hand side of line $NR ($key $value)\n";
}
if ($host =~ /[^-A-Za-z0-9\.]/) {
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/master/lib/Munin/Master/GraphOld.pm
^
|
@@ -28,7 +28,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-$Id: GraphOld.pm 2944 2009-11-10 15:12:46Z jo $
+$Id: GraphOld.pm 3010 2009-11-19 13:23:04Z janl $
=end comment
@@ -404,15 +404,6 @@
}
}
- # cdef is special...
- if (!defined $service->{$fname}->{"cdef"}) {
- if (defined $src->{"cdef"}) {
- (my $tmpcdef = $src->{"cdef"})
- =~ s/([,=])$sname([,=]|$)/$1$fname$2/g;
- munin_set_var_loc($service, [$fname, "cdef"], $tmpcdef);
- }
- }
-
if (!defined $service->{$fname}->{"label"}) {
munin_set_var_loc($service, [$fname, "label"], $fname);
}
@@ -1148,7 +1139,7 @@
}
}
- DEBUG "\n\nrrdtool 'graph' '" . join("'\n\t'", @complete) . "'\n";
+ DEBUG "\n\nrrdtool 'graph' '" . join("' \\\n\t'", @complete) . "'\n";
# Make sure directory exists
munin_mkdir_p($picdirname, oct(777));
@@ -1286,7 +1277,7 @@
unshift @rrd_sum, "--vertical-label", $label;
}
- DEBUG "\n\nrrdtool 'graph' '" . join("'\n\t'", @rrd_sum) . "'\n";
+ DEBUG "\n\nrrdtool 'graph' '" . join("' \\\n\t'", @rrd_sum) . "'\n";
# Make sure directory exists
munin_mkdir_p($picdirname, oct(777));
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/master/lib/Munin/Master/HTMLOld.pm
^
|
@@ -28,7 +28,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
-$Id: HTMLOld.pm 2975 2009-11-13 07:47:30Z feiner.tom $
+$Id: HTMLOld.pm 2997 2009-11-17 21:07:16Z knuthaug $
This is the hierarchy of templates
@@ -224,7 +224,8 @@
NAME => $key->{'name'},
GROUPS => $key->{'comparegroups'},
PATH => $key->{'path'},
- CSSPATH => $key->{'csspath'},
+ CSS_NAME => $key->{'css_name'},
+ ROOT_PATH => $key->{'root_path'},
COMPLINKS => find_complinks($t),
LARGESET => decide_largeset($key->{'peers'}),
PEERS => $key->{'peers'},
@@ -259,9 +260,10 @@
INFO_OPTION => 'Nodes on this level',
GROUPS => $key->{'groups'},
PATH => $key->{'path'},
- CSSPATH => $key->{'csspath'},
+ CSS_NAME => $key->{'css_name'},
+ ROOT_PATH => $key->{'root_path'},
PEERS => $key->{'peers'},
- LARGESET => decide_largeset($key->{'peers'}),
+ LARGESET => decide_largeset($key->{'peers'}),
PARENT => $key->{'path'}->[-2]->{'name'},
NAME => $key->{'name'},
CATEGORIES => $key->{'categories'},
@@ -295,7 +297,8 @@
INFO_OPTION => 'Groups on this level',
GROUPS => $key->{'groups'},
PATH => $key->{'path'},
- CSSPATH => $key->{'csspath'},
+ ROOT_PATH => $key->{'root_path'},
+ CSS_NAME => $key->{'css_name'},
PEERS => $key->{'peers'},
LARGESET => decide_largeset($key->{'peers'}),
PARENT => $key->{'path'}->[-2]->{'name'} || "Overview",
@@ -312,7 +315,7 @@
sub emit_service_template {
- my ($srv, $pathnodes, $peers, $csspath, $service) = @_;
+ my ($srv, $pathnodes, $peers, $css_name, $root_path, $service) = @_;
my $servicetemplate = HTML::Template->new(
filename => "$tmpldir/munin-serviceview.tmpl",
@@ -333,7 +336,8 @@
PATH => $pathnodes,
PEERS => $peers,
LARGESET => decide_largeset($peers),
- CSSPATH => $csspath,
+ ROOT_PATH => $root_path,
+ CSS_NAME => $css_name,
CATEGORY => ucfirst $srv->{'category'},
TAGLINE => $htmltagline,
);
@@ -380,6 +384,7 @@
$template->param(
TAGLINE => $htmltagline,
GROUPS => $groups,
+ CSS_NAME => get_css_name(),
);
my $filename = munin_get_html_filename($config);
@@ -543,7 +548,7 @@
my $path = []; # (temporary) array of paths relevant to . (here)
my $rpath = undef;
my $visible = 0;
- my $csspath;
+ my $css_name;
my $children = munin_get_sorted_children($hash);
@@ -634,7 +639,8 @@
: ($rpath = ""))}
} reverse(undef, split('\/', $base));
- ($csspath = $path->[0]->{'path'}) =~ s/index.html$/style.css/;
+ my $root_path = get_root_path($path);
+ $css_name = get_css_name();
# We need a bit more info for the comparison templates
my $compare = munin_get_bool($hash, "compare", 1);
@@ -705,7 +711,8 @@
"depth" => scalar(my @splitted_base = split("/", $base . "index.html"))
- 1,
"filename" => munin_get_html_filename($hash),
- "csspath" => $csspath,
+ "css_name" => $css_name,
+ "root_path" => $root_path,
"groups" => $groups,
"graphs" => $graphs,
"multigraph" => munin_has_subservices ($hash),
@@ -734,6 +741,31 @@
}
+=pod
+
+Method to find the relative url to the root of the munin tree. This is
+needed to refer to stuff in the root from deeper in the levels.
+
+returns the url path as a string.
+
+=cut
+
+sub get_root_path{
+ my ($path) = @_;
+ if ($path) {
+ (my $root = $path->[0]->{'path'}) =~ s/\/index.html$//;
+ return $root;
+ }
+ return "";
+}
+
+
+sub get_css_name{
+ #NOTE: this will do more in future versions. knuthaug 2009-11-15
+ return "style.css";
+}
+
+
# This is called both at group level, service level, and subservice level
sub munin_get_sorted_children {
my $hash = shift || return;
@@ -866,7 +898,10 @@
my $peers = get_peer_nodes($service,
lc munin_get($service, "graph_category", "other"));
my $parent = munin_get_parent_name($service);
- (my $csspath = $pathnodes->[0]->{'path'}) =~ s/index.html$/style.css/;
+
+
+ my $root_path = get_root_path($pathnodes);
+ my $css_name = get_css_name();
my $bp = borrowed_path($service) || ".";
$srv{'node'} = munin_get_node_name($service);
@@ -989,7 +1024,7 @@
$srv{'state_unknown'} = 1 if $state eq "unknown";
}
- emit_service_template(\%srv, $pathnodes, $peers, $csspath, $service);
+ emit_service_template(\%srv, $pathnodes, $peers, $css_name, $root_path, $service);
return \%srv;
}
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/master/lib/Munin/Master/Host.pm
^
|
@@ -2,7 +2,7 @@
use base qw(Munin::Master::Group);
-# $Id: Host.pm 2831 2009-11-03 23:32:48Z janl $
+# $Id: Host.pm 2994 2009-11-17 13:01:00Z janl $
use warnings;
use strict;
@@ -20,7 +20,7 @@
port => 4949,
update => 1,
- use_node_name => 1,
+ use_node_name => 0,
%$attributes,
};
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/master/lib/Munin/Master/Node.pm
^
|
@@ -1,6 +1,6 @@
package Munin::Master::Node;
-# $Id: Node.pm 2924 2009-11-09 12:33:50Z janl $
+# $Id: Node.pm 2995 2009-11-17 13:17:26Z janl $
# This module is used by UpdateWorker to keep in touch with a node and
# parse some of the output.
@@ -50,6 +50,9 @@
# Connect to a munin node. Return false if not, true otherwise.
my ($self) = @_;
+ LOGCROAK("[FATAL] No address! Did you forget to set 'update no' or to set 'address <IP>' ?")
+ if !defined($self->{address});
+
if (! ( $self->{socket} = IO::Socket::INET->new(
PeerAddr => $self->{address},
PeerPort => $self->{port},
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/master/lib/Munin/Master/UpdateWorker.pm
^
|
@@ -1,7 +1,7 @@
package Munin::Master::UpdateWorker;
use base qw(Munin::Master::Worker);
-# $Id: UpdateWorker.pm 2950 2009-11-10 17:53:43Z ligne $
+# $Id: UpdateWorker.pm 3025 2009-11-20 14:03:38Z janl $
use warnings;
use strict;
@@ -339,7 +339,7 @@
for my $ds_name (keys %{$service_config}) {
$self->_set_rrd_data_source_defaults($service_config->{$ds_name});
- unless ($service_config->{$ds_name}{label}) {
+ unless (defined($service_config->{$ds_name}{label})) {
ERROR "[ERROR] Unable to update $service on $nodedesignation -> $ds_name: Missing data source configuration attribute: label";
next;
}
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/master/lib/Munin/Master/Utils.pm
^
|
@@ -1,6 +1,7 @@
package Munin::Master::Utils;
+# -*- cperl -*-
-# $Id: Utils.pm 2961 2009-11-11 19:59:26Z feiner.tom $
+# $Id: Utils.pm 3009 2009-11-19 13:08:36Z janl $
use strict;
use warnings;
@@ -611,10 +612,11 @@
}
return munin_set_var_loc ($hash->{$tmpvar}, \@aloc, $val);
} else {
- WARN "[WARNING] munin_set_var_loc: Setting unknown option \"$tmpvar\"."
+ WARN "[WARNING] munin_set_var_loc: Setting unknown option '$tmpvar' at "
+ . munin_get_keypath($hash)
unless Munin::Common::Config::cl_is_keyword($tmpvar);
- # FIX
+ # FIX - or not.
$hash->{$tmpvar} = $val;
return $hash;
@@ -916,7 +918,8 @@
my $i = $hash;
while (ref ($i) eq "HASH") {
- my $name = $i->{'#%#name'};
+ # Not sure when a #%#name node can go missing
+ my $name = $i->{'#%#name'} || '*BUG*';
last if $name eq 'root';
if ($host) {
# Into group land now
@@ -1260,15 +1263,32 @@
for my $fieldnode (@{munin_find_field ($hash, "label")}) {
my $fieldname = munin_get_node_name ($fieldnode);
- push @$result,$fieldname if !grep /^\Q$fieldname\E(?:=|$)/, @$result;;
+ push @$result,$fieldname
+ if !grep m[^\Q$fieldname\E(?:=|$)], @$result;;
}
for my $fieldnode (@{munin_find_field ($hash, "stack")}) {
my $fieldname = munin_get_node_name ($fieldnode);
- push @$result,$fieldname if !grep /^\Q$fieldname\E(?:=|$)/, @$result;;
+ push @$result,$fieldname
+ if !grep m[^\Q$fieldname\E(?:=|$)], @$result;;
+ }
+
+ # We have seen some occurances of redundance in the graph_order
+ # due to plugin bugs and so on. This make process_service
+ # generate rrd commands with multiple definitions of the same
+ # data. SO: Make sure there is no redundance in the order.
+
+ my %seen = ();
+ my $nresult = [];
+
+ for my $field (@$result) {
+ next if exists($seen{$field});
+
+ push @$nresult, $field;
+ $seen{$field}=1;
}
- return $result;
+ return $nresult;
}
|
[-]
[+]
|
Added |
munin-1.4.tar.bz2/master/t/munin_master_htmlold.t
^
|
@@ -0,0 +1,22 @@
+use warnings;
+use strict;
+use English '-no_match_vars';
+
+use Test::More tests => 4;
+
+use_ok('Munin::Master::HTMLOld');
+
+my $test_path = [ {'path' => "../../index.html" } ];
+
+#munin_get_root
+{
+
+ is(Munin::Master::HTMLOld::get_root_path($test_path), "../..");
+
+ $test_path = [ {'path' => "../index.html" } ];
+
+ is(Munin::Master::HTMLOld::get_root_path($test_path), "..");
+
+ is(Munin::Master::HTMLOld::get_root_path(), "");
+
+}
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/master/www/munin-overview.tmpl
^
|
@@ -3,11 +3,13 @@
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
- <link rel="stylesheet" href="style.css" type="text/css" />
+ <link rel="stylesheet" href="<TMPL_VAR NAME="CSS_NAME">" type="text/css" />
<meta http-equiv="refresh" content="300" />
<title>Munin :: overview</title>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=iso-8859-1" />
<meta name="author" content="Auto-generated by Munin" />
+ <link rel="icon" type="image/vnd.microsoft.icon" href="favicon.ico" />
+ <link rel="SHORTCUT ICON" href="favicon.ico"/>
</head>
<body>
<table id="header-table">
@@ -22,17 +24,29 @@
<td>
<TMPL_LOOP NAME="GROUPS">
<ul>
- <li><TMPL_IF NAME="NCATEGORIES"><span class="host"><TMPL_ELSE><span class="domain"></TMPL_IF><a href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a></span><TMPL_IF NAME="COMPARE"> :: [ <a href="<TMPL_VAR NAME="NAME">/comparison-day.html">day</a> <a href="<TMPL_VAR NAME="NAME">/comparison-week.html">week</a> <a href="<TMPL_VAR NAME="NAME">/comparison-month.html">month</a> <a href="<TMPL_VAR NAME="NAME">/comparison-year.html">year</a> ]</TMPL_IF> <TMPL_IF NAME="NCATEGORIES">[ <TMPL_LOOP NAME="CATEGORIES"><a <TMPL_IF NAME="STATE_WARNING">class="warn"</TMPL_IF> <TMPL_IF NAME="STATE_CRITICAL">class="crit"</TMPL_IF> href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a> </TMPL_LOOP>]</TMPL_IF>
+ <li><TMPL_IF NAME="NCATEGORIES"><span class="host"><TMPL_ELSE><span class="domain"></TMPL_IF><a href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a></span>
+<!-- <TMPL_IF NAME="COMPARE"> :: [ <a href="<TMPL_VAR NAME="NAME">/comparison-day.html">day</a> <a href="<TMPL_VAR NAME="NAME">/comparison-week.html">week</a> <a href="<TMPL_VAR NAME="NAME">/comparison-month.html">month</a> <a href="<TMPL_VAR NAME="NAME">/comparison-year.html">year</a> ]</TMPL_IF> -->
+ <TMPL_IF NAME="NCATEGORIES">[ <TMPL_LOOP NAME="CATEGORIES"><a <TMPL_IF NAME="STATE_WARNING">class="warn"</TMPL_IF> <TMPL_IF NAME="STATE_CRITICAL">class="crit"</TMPL_IF> href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a> </TMPL_LOOP>]</TMPL_IF>
<TMPL_IF NAME="NGROUPS"><TMPL_LOOP NAME="GROUPS"><TMPL_UNLESS NAME="MULTIGRAPH"><ul>
- <li><TMPL_IF NAME="NCATEGORIES"><span class="host"><TMPL_ELSE><span class="domain"></TMPL_IF><a href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a></span><TMPL_IF NAME="COMPARE"> :: [ <a href="<TMPL_VAR NAME="NAME">/comparison-day.html">day</a> <a href="<TMPL_VAR NAME="NAME">/comparison-week.html">week</a> <a href="<TMPL_VAR NAME="NAME">/comparison-month.html">month</a> <a href="<TMPL_VAR NAME="NAME">/comparison-year.html">year</a> ]</TMPL_IF> <TMPL_IF NAME="NCATEGORIES">[ <TMPL_LOOP NAME="CATEGORIES"><a <TMPL_IF NAME="STATE_WARNING">class="warn"</TMPL_IF> <TMPL_IF NAME="STATE_CRITICAL">class="crit"</TMPL_IF> href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a> </TMPL_LOOP>]</TMPL_IF>
+ <li><TMPL_IF NAME="NCATEGORIES"><span class="host"><TMPL_ELSE><span class="domain"></TMPL_IF><a href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a></span>
+<!-- <TMPL_IF NAME="COMPARE"> :: [ <a href="<TMPL_VAR NAME="NAME">/comparison-day.html">day</a> <a href="<TMPL_VAR NAME="NAME">/comparison-week.html">week</a> <a href="<TMPL_VAR NAME="NAME">/comparison-month.html">month</a> <a href="<TMPL_VAR NAME="NAME">/comparison-year.html">year</a> ]</TMPL_IF> -->
+ <TMPL_IF NAME="NCATEGORIES">[ <TMPL_LOOP NAME="CATEGORIES"><a <TMPL_IF NAME="STATE_WARNING">class="warn"</TMPL_IF> <TMPL_IF NAME="STATE_CRITICAL">class="crit"</TMPL_IF> href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a> </TMPL_LOOP>]</TMPL_IF>
<TMPL_IF NAME="NGROUPS"><TMPL_LOOP NAME="GROUPS"><TMPL_UNLESS NAME="MULTIGRAPH"><ul>
- <li><TMPL_IF NAME="NCATEGORIES"><span class="host"><TMPL_ELSE><span class="domain"></TMPL_IF><a href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a></span><TMPL_IF NAME="COMPARE"> :: [ <a href="<TMPL_VAR NAME="NAME">/comparison-day.html">day</a> <a href="<TMPL_VAR NAME="NAME">/comparison-week.html">week</a> <a href="<TMPL_VAR NAME="NAME">/comparison-month.html">month</a> <a href="<TMPL_VAR NAME="NAME">/comparison-year.html">year</a> ]</TMPL_IF> <TMPL_IF NAME="NCATEGORIES">[ <TMPL_LOOP NAME="CATEGORIES"><a <TMPL_IF NAME="STATE_WARNING">class="warn"</TMPL_IF> <TMPL_IF NAME="STATE_CRITICAL">class="crit"</TMPL_IF> href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a> </TMPL_LOOP>]</TMPL_IF>
+ <li><TMPL_IF NAME="NCATEGORIES"><span class="host"><TMPL_ELSE><span class="domain"></TMPL_IF><a href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a></span>
+<!-- <TMPL_IF NAME="COMPARE"> :: [ <a href="<TMPL_VAR NAME="NAME">/comparison-day.html">day</a> <a href="<TMPL_VAR NAME="NAME">/comparison-week.html">week</a> <a href="<TMPL_VAR NAME="NAME">/comparison-month.html">month</a> <a href="<TMPL_VAR NAME="NAME">/comparison-year.html">year</a> ]</TMPL_IF>
+--> <TMPL_IF NAME="NCATEGORIES">[ <TMPL_LOOP NAME="CATEGORIES"><a <TMPL_IF NAME="STATE_WARNING">class="warn"</TMPL_IF> <TMPL_IF NAME="STATE_CRITICAL">class="crit"</TMPL_IF> href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a> </TMPL_LOOP>]</TMPL_IF>
<TMPL_IF NAME="NGROUPS"><TMPL_LOOP NAME="GROUPS"><TMPL_UNLESS NAME="MULTIGRAPH"><ul>
- <li><TMPL_IF NAME="NCATEGORIES"><span class="host"><TMPL_ELSE><span class="domain"></TMPL_IF><a href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a></span><TMPL_IF NAME="COMPARE"> :: [ <a href="<TMPL_VAR NAME="NAME">/comparison-day.html">day</a> <a href="<TMPL_VAR NAME="NAME">/comparison-week.html">week</a> <a href="<TMPL_VAR NAME="NAME">/comparison-month.html">month</a> <a href="<TMPL_VAR NAME="NAME">/comparison-year.html">year</a> ]</TMPL_IF> <TMPL_IF NAME="NCATEGORIES">[ <TMPL_LOOP NAME="CATEGORIES"><a <TMPL_IF NAME="STATE_WARNING">class="warn"</TMPL_IF> <TMPL_IF NAME="STATE_CRITICAL">class="crit"</TMPL_IF> href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a> </TMPL_LOOP>]</TMPL_IF>
+ <li><TMPL_IF NAME="NCATEGORIES"><span class="host"><TMPL_ELSE><span class="domain"></TMPL_IF><a href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a></span>
+<!-- <TMPL_IF NAME="COMPARE"> :: [ <a href="<TMPL_VAR NAME="NAME">/comparison-day.html">day</a> <a href="<TMPL_VAR NAME="NAME">/comparison-week.html">week</a> <a href="<TMPL_VAR NAME="NAME">/comparison-month.html">month</a> <a href="<TMPL_VAR NAME="NAME">/comparison-year.html">year</a> ]</TMPL_IF> -->
+<TMPL_IF NAME="NCATEGORIES">[ <TMPL_LOOP NAME="CATEGORIES"><a <TMPL_IF NAME="STATE_WARNING">class="warn"</TMPL_IF> <TMPL_IF NAME="STATE_CRITICAL">class="crit"</TMPL_IF> href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a> </TMPL_LOOP>]</TMPL_IF>
<TMPL_IF NAME="NGROUPS"><TMPL_LOOP NAME="GROUPS"> <TMPL_UNLESS NAME="MULTIGRAPH"><ul>
- <li><TMPL_IF NAME="NCATEGORIES"><span class="host"><TMPL_ELSE><span class="domain"></TMPL_IF><a href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a></span><TMPL_IF NAME="COMPARE"> :: [ <a href="<TMPL_VAR NAME="NAME">/comparison-day.html">day</a> <a href="<TMPL_VAR NAME="NAME">/comparison-week.html">week</a> <a href="<TMPL_VAR NAME="NAME">/comparison-month.html">month</a> <a href="<TMPL_VAR NAME="NAME">/comparison-year.html">year</a> ]</TMPL_IF> <TMPL_IF NAME="NCATEGORIES">[ <TMPL_LOOP NAME="CATEGORIES"><a <TMPL_IF NAME="STATE_WARNING">class="warn"</TMPL_IF> <TMPL_IF NAME="STATE_CRITICAL">class="crit"</TMPL_IF> href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a> </TMPL_LOOP>]</TMPL_IF>
+ <li><TMPL_IF NAME="NCATEGORIES"><span class="host"><TMPL_ELSE><span class="domain"></TMPL_IF><a href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a></span>
+<!-- <TMPL_IF NAME="COMPARE"> :: [ <a href="<TMPL_VAR NAME="NAME">/comparison-day.html">day</a> <a href="<TMPL_VAR NAME="NAME">/comparison-week.html">week</a> <a href="<TMPL_VAR NAME="NAME">/comparison-month.html">month</a> <a href="<TMPL_VAR NAME="NAME">/comparison-year.html">year</a> ]</TMPL_IF> -->
+ <TMPL_IF NAME="NCATEGORIES">[ <TMPL_LOOP NAME="CATEGORIES"><a <TMPL_IF NAME="STATE_WARNING">class="warn"</TMPL_IF> <TMPL_IF NAME="STATE_CRITICAL">class="crit"</TMPL_IF> href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a> </TMPL_LOOP>]</TMPL_IF>
<TMPL_IF NAME="NGROUPS"><TMPL_LOOP NAME="GROUPS"><TMPL_UNLESS NAME="MULTIGRAPH"><ul>
- <li><TMPL_IF NAME="NCATEGORIES"><span class="host"><TMPL_ELSE><span class="domain"></TMPL_IF><a href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a></span><TMPL_IF NAME="COMPARE"> :: [ <a href="<TMPL_VAR NAME="NAME">/comparison-day.html">day</a> <a href="<TMPL_VAR NAME="NAME">/comparison-week.html">week</a> <a href="<TMPL_VAR NAME="NAME">/comparison-month.html">month</a> <a href="<TMPL_VAR NAME="NAME">/comparison-year.html">year</a> ]</TMPL_IF> <TMPL_IF NAME="NCATEGORIES">[ <TMPL_LOOP NAME="CATEGORIES"><a <TMPL_IF NAME="STATE_WARNING">class="warn"</TMPL_IF> <TMPL_IF NAME="STATE_CRITICAL">class="crit"</TMPL_IF> href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a> </TMPL_LOOP>]</TMPL_IF>
+ <li><TMPL_IF NAME="NCATEGORIES"><span class="host"><TMPL_ELSE><span class="domain"></TMPL_IF><a href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a></span>
+<!-- <TMPL_IF NAME="COMPARE"> :: [ <a href="<TMPL_VAR NAME="NAME">/comparison-day.html">day</a> <a href="<TMPL_VAR NAME="NAME">/comparison-week.html">week</a> <a href="<TMPL_VAR NAME="NAME">/comparison-month.html">month</a> <a href="<TMPL_VAR NAME="NAME">/comparison-year.html">year</a> ]</TMPL_IF> -->
+ <TMPL_IF NAME="NCATEGORIES">[ <TMPL_LOOP NAME="CATEGORIES"><a <TMPL_IF NAME="STATE_WARNING">class="warn"</TMPL_IF> <TMPL_IF NAME="STATE_CRITICAL">class="crit"</TMPL_IF> href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="NAME"></a> </TMPL_LOOP>]</TMPL_IF>
</li>
</ul>
</TMPL_UNLESS>
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/master/www/partial/head.tmpl
^
|
@@ -3,9 +3,12 @@
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
- <link rel="stylesheet" href="<TMPL_VAR NAME="CSSPATH">" type="text/css" />
+ <link rel="stylesheet" href="<TMPL_VAR NAME="ROOT_PATH">/<TMPL_VAR NAME="CSS_NAME">" type="text/css" />
<meta http-equiv="refresh" content="300" />
<title><TMPL_LOOP NAME="PATH"><TMPL_IF NAME="name"> :: <TMPL_VAR ESCAPE="HTML" NAME="name"><TMPL_ELSE>Munin</TMPL_IF></TMPL_LOOP></title>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=iso-8859-1" />
<meta name="author" content="Auto-generated by Munin" />
+ <link rel="icon" type="image/vnd.microsoft.icon" href="<TMPL_VAR NAME="ROOT_PATH">/favicon.ico" />
+ <link rel="SHORTCUT ICON" href="<TMPL_VAR NAME="ROOT_PATH">/favicon.ico"/>
+
</head>
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/node/lib/Munin/Node/Config.pm
^
|
@@ -1,7 +1,7 @@
package Munin::Node::Config;
use base qw(Munin::Common::Config);
-# $Id: Config.pm 2773 2009-10-30 08:35:18Z bjorn $
+# $Id: Config.pm 2998 2009-11-18 00:24:34Z janl $
use strict;
use warnings;
@@ -50,11 +50,9 @@
my @var = $self->_parse_line($line);
next unless @var;
if ($var[0] eq 'ignore_file') {
- $self->{ignores} ||= [];
push @{$self->{ignores}}, $var[1];
}
elsif ($var[0] eq 'unhandled') {
- $self->{sconf} ||= {};
next if defined $self->{sconf}{$var[1]};
$self->{sconf}{$var[1]} = $var[2];
}
@@ -77,13 +75,6 @@
my ($var_name, $var_value) = ($1, $2);
- my %handled_by_net_server_fork = map { $_ => 1 } qw(
- allow
- deny
- cidr_allow
- cidr_deny
- );
-
return if $self->_handled_by_net_server($var_name);
my %config_variables = map { $_ => 1 } qw(
@@ -154,7 +145,7 @@
FILE:
for my $file (grep { -f "$self->{sconfdir}/$_" } readdir ($DIR)) {
# Untaint file
- return if $file !~ m/^([-\w.:]+)$/; # Skip if any weird chars
+ next if $file !~ m/^([-\w.:]+)$/; # Skip if any weird chars
$file = $1;
for my $regex (@ignores) {
@@ -231,7 +222,6 @@
my @var = $self->_parse_plugin_line($line);
next unless @var;
if ($var[0] eq 'env') {
- $sconf->{$service}{'env'} ||= {};
my ($key, $value) = %{$var[1]};
$sconf->{$service}{$var[0]}{$key} = $value;
}
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/node/lib/Munin/Node/Server.pm
^
|
@@ -1,6 +1,6 @@
package Munin::Node::Server;
-# $Id: Server.pm 2974 2009-11-12 23:43:50Z ligne $
+# $Id: Server.pm 3001 2009-11-18 18:07:16Z ligne $
use base qw(Net::Server::Fork);
@@ -72,33 +72,28 @@
{
my (@services) = @_;
- for my $service (keys %services) {
+ for my $service (@services) {
print STDERR "Configuring $service\n" if $config->{DEBUG};
- my $res = eval {
- local $SIG{CHLD}; # stop Net::Server from reaping the dead service too fast
- Munin::Node::Service->fork_service($config->{servicedir},
- $service,
- 'config');
- };
+ my @response = _run_service($service, 'config');
- # FIXME: report errors properly
- if ($EVAL_ERROR or $res->{timed_out} or $res->{retval}) {
+ unless (@response) {
print STDERR "Error running $service. Dropping it.\n"
if $config->{DEBUG};
delete $services{$service};
+ next;
}
- my ($host_name) = grep /^host_name /, @{$res->{stdout}};
+ my ($host_name) = grep /^host_name /, @response;
my $node = $config->{sconf}{$service}{host_name}
|| (split /\s+/, ($host_name || ''))[1]
|| $config->{fqdn};
print STDERR "\tAdding to node $node\n" if $config->{DEBUG};
- $nodes{$node}{$service} = 1;
+ push @{$nodes{$node}}, $service;
# Note any plugins that require particular server capabilities.
- if (grep /^multigraph\s+/, @{$res->{stdout}}) {
+ if (grep /^multigraph\s+/, @response) {
print STDERR "\tAdding to multigraph plugins\n"
if $config->{DEBUG};
push @multigraph_services, $service;
@@ -114,6 +109,7 @@
{
my $self = shift;
+ my $timed_out;
my $session = Munin::Node::Session->new();
$session->{tls} = undef;
@@ -125,17 +121,25 @@
_net_write($session, "# munin node at $config->{fqdn}\n");
- my $timed_out = !do_with_timeout($config->{'timeout'}, sub {
- while (defined (my $line = _net_read($session))) {
- chomp $line;
- _process_command_line($session, $line)
- or last;
- }
- });
+ # catch and report any system errors in a clean way.
+ eval {
+ $timed_out = !do_with_timeout($config->{'timeout'}, sub {
+ while (defined (my $line = _net_read($session))) {
+ chomp $line;
+ _process_command_line($session, $line) or last;
+ }
+ });
+ };
+
+ if ($EVAL_ERROR) {
+ logger($EVAL_ERROR);
+ }
if ($timed_out) {
logger("Connection timed out");
}
+
+ return;
}
@@ -171,10 +175,10 @@
_show_nodes($session);
}
elsif (/^fetch\s?(\S*)/i) {
- _print_service($session, _run_service($session, $1))
+ _print_service($session, _run_service($1))
}
elsif (/^config\s?(\S*)/i) {
- _print_service($session, _run_service($session, $1, "config"));
+ _print_service($session, _run_service($1, "config"));
}
elsif (/^starttls\s*$/i) {
eval {
@@ -290,7 +294,7 @@
if (exists $nodes{$node}) {
# remove any plugins that require capabilities the server doesn't provide
- my @services = keys %{$nodes{$node}};
+ my @services = @{$nodes{$node}};
@services = Munin::Node::Utils::set_difference(\@services, \@multigraph_services)
unless $session->{server_capabilities}{multigraph};
@@ -300,42 +304,37 @@
}
-sub _run_service {
- # FIXME: $autoreap is never set?
- my ($session, $service, $command, $autoreap) = @_;
-
- unless ($services{$service}) {
- _net_write($session, "# Unknown service");
- return;
- }
+sub _run_service
+{
+ my ($service, $command) = @_;
- my $res = eval { Munin::Node::Service->fork_service($config->{servicedir},
- $service,
- $command);
- };
+ return '# Unknown service' unless $services{$service};
- if ($EVAL_ERROR) {
- # Error forking, building pipes, etc
- logger("System error: $EVAL_ERROR");
- return;
- }
+ # temporarily ignore SIGCHLD. this stops Net::Server from reaping the
+ # dead service before we get the chance to check the return value.
+ local $SIG{CHLD};
+ my $res = Munin::Node::Service->fork_service($config->{servicedir},
+ $service, $command);
if ($res->{timed_out}) {
- my $msg = "timeout: $service $command.";
- _net_write($session, "# $msg\n");
- logger("Plugin $msg");
- return;
+ logger("Service '$service' timed out.");
+ return '# Timed out';
+ }
+
+ if (@{$res->{stderr}}) {
+ logger(qq{Error output from $service:});
+ logger("\t$_") foreach @{$res->{stderr}};
}
if ($res->{retval}) {
my $plugin_exit = $res->{retval} >> 8;
my $plugin_signal = $res->{retval} & 127;
-# logger(qq{Plugin '$service' exited with status $CHILD_ERROR. --@lines--});
- return;
+ logger(qq{Service '$service' exited with status $plugin_exit/$plugin_signal.});
+ return '# Bad exit';
}
- return (@{ $res->{stdout} });
+ return (@{$res->{stdout}});
}
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/node/lib/Munin/Node/Service.pm
^
|
@@ -1,6 +1,6 @@
package Munin::Node::Service;
-# $Id: Service.pm 2865 2009-11-05 17:53:32Z ligne $
+# $Id: Service.pm 3012 2009-11-19 18:32:50Z ligne $
use warnings;
use strict;
@@ -165,8 +165,6 @@
sub exec_service {
my ($class, $dir, $service, $arg) = @_;
- $arg ||= '';
-
$class->change_real_and_effective_user_and_group($service);
unless (Munin::Node::OS->check_perms("$dir/$service")) {
@@ -176,7 +174,7 @@
$class->export_service_environment($service);
- my @command = _service_command($dir, $service, $arg);
+ my @command = grep defined, _service_command($dir, $service, $arg);
print STDERR "# About to run '", join (' ', @command), "'\n" if $config->{DEBUG};
exec @command;
}
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/plugins/node.d.linux/cps_.in
^
|
@@ -2,186 +2,173 @@
#
# Plugin to monitor connections per second, for LVS loadbalancers.
#
-# Magic name:
+# Wildcard names:
#
-# cps_<port>
-# cps_<vip>_<port>
+# cps_<port>
+# cps_<vip>_<port>
#
# Examples:
#
-# cps_smtp
-# cps_mail.foo.boo_smtp
-# cps_pop3
-# cps_www.foo.boo_www
-# cps_vvv.foo.boo_www
+# cps_smtp
+# cps_mail.foo.boo_smtp
+# cps_pop3
+# cps_www.foo.boo_www
+# cps_vvv.foo.boo_www
#
# Parameters understood:
#
-# config (required)
-# autoconf (optional - used by munin-config)
-# suggest (optional - used by munin-config)
+# config (required)
+# autoconf (optional - used by munin-config)
+# suggest (optional - used by munin-config)
#
# Magic markers - optional - used by installation scripts and munin-config:
#
-#%# family=manual
+#%# family=auto
#%# capabilities=autoconf suggest
#
use strict;
-if ( defined $ARGV[0] and $ARGV[0] eq "autoconf" )
-{
- &autoconf ();
-}
-if ( defined $ARGV[0] and $ARGV[0] eq "suggest" )
-{
- my $sipvs;
- $sipvs = &ipvs (".", ".", $sipvs);
- exit 0 if $sipvs == undef;
- &suggest ($sipvs);
+if ( defined $ARGV[0] and $ARGV[0] eq "autoconf" ) {
+ autoconf ();
}
-unless ($0 =~ /cps(?:_([^_]+)|)_(.+)\s*$/)
-{
- die "Could not parse name $0.\n";
+if ( defined $ARGV[0] and $ARGV[0] eq "suggest" ) {
+ my $sipvs;
+ $sipvs = &ipvs (".", ".", $sipvs);
+ exit 0 if $sipvs == undef;
+ suggest ($sipvs);
}
+
+unless ($0 =~ /cps(?:_([^_]+)|)_(.+)\s*$/) {
+ die "Could not parse name $0.\n";
+}
+
my $vip = $1;
my $port = $2;
my $ipvs;
+#print "$vip:$port\n";
+
+use Socket;
+my $name;
+my $address;
+$address = inet_aton($vip);
+$name = gethostbyaddr($address,AF_INET);
+
+#print "$vip:$port\n";
#print "Name: $0\nPort: $port\nVip : $vip\n";
# Read ipvsadm-output
$ipvs = &ipvs ($vip, $port, $ipvs);
-if ( defined $ARGV[0] and $ARGV[0] eq "config" )
-{
- &config ($vip, $port, $ipvs);
+if ( defined $ARGV[0] and $ARGV[0] eq "config" ) {
+ config ($vip, $port, $ipvs);
}
$vip = $vip || "";
-if (exists ($ipvs->{$vip}) and exists ($ipvs->{$vip}->{$port}))
-{
- foreach my $host (sort keys %{$ipvs->{$vip}->{$port}})
- {
- (my $fname = $host) =~ s/[.-]/_/g;
- print "$fname.value ", $ipvs->{$vip}->{$port}->{$host}, "\n";;
- }
+if (exists ($ipvs->{$vip}) and exists ($ipvs->{$vip}->{$port})) {
+ foreach my $host (sort keys %{$ipvs->{$vip}->{$port}}) {
+ (my $fname = $host) =~ s/[.-]/_/g;
+ print "$fname.value ", $ipvs->{$vip}->{$port}->{$host}, "\n";;
+ }
}
-sub autoconf
-{
- system ("/sbin/ipvsadm -L --stats >/dev/null 2>/dev/null");
-
- if ($? == 0)
- {
- print "yes\n";
- exit 0;
- }
- elsif (($?>>8) == 2)
- {
- print "no (permission denied)\n";
- exit 0;
- }
- elsif ($? == 127)
- {
- print "no (ipvsadm not found)\n";
- exit 0;
- }
- else
- {
- print "no\n";
- exit 0;
- }
-}
-sub suggest
-{
- my $ipvs = shift;
- exit 0 unless $ipvs;
-
- foreach my $vip (sort keys %{$ipvs})
- {
- foreach my $port (sort keys %{$ipvs->{$vip}})
- {
- print "cps_${vip}_$port\n";
- }
- }
- exit 0;
-}
-sub config
-{
- my $vip = shift;
- my $port = shift;
- my $ipvs = shift;
-
- print "graph_title Loadbalanced ",($vip?$vip:"*"),"->",$port," connections\n";
- print "graph_args -l 0\n";
- print "graph_total total\n";
- print "graph_vlabel connections / \${graph_period}\n";
- print "graph_category network\n";
- my $first=1;
- $vip = $vip || "";
- if (exists ($ipvs->{$vip}) and exists ($ipvs->{$vip}->{$port}))
- {
- foreach my $host (sort keys %{$ipvs->{$vip}->{$port}})
- {
- (my $fname = $host) =~ s/[.-]/_/g;
- if ( $first == 1 )
- {
- print "$fname.draw AREA\n";
- $first=0
- }
- else
- {
- print "$fname.draw STACK\n";
- }
- print "$fname.type DERIVE\n";
- $host =~ s/-bak//;
- print "$fname.label $host\n";
- print "$fname.max 1000\n";
- print "$fname.min 0\n";
- }
- }
+sub autoconf {
+ system ("/sbin/ipvsadm -L -n --stats >/dev/null 2>/dev/null");
+
+ if ($? == 0) {
+ print "yes\n";
+ exit 0;
+ }
+ elsif (($?>>8) == 2) {
+ print "no (permission denied)\n";
exit 0;
+ }
+ elsif ($? == 127) {
+ print "no (ipvsadm not found)\n";
+ exit 0;
+ } else {
+ print "no\n";
+ exit 0;
+ }
}
-sub ipvs
-{
- my $vip = shift;
- my $port = shift;
- my $ipvs = shift;
- open (IPVS, "/sbin/ipvsadm -L --stats 2>/dev/null|") or return undef;
- my $cvip = "";
- my $cport = "";
- while (<IPVS>)
- {
- next if /^IP Virtual Server/;
- next if /^Prot\s+LocalAddress/;
- if (/^(\w+)\s+([\w\.-]+):([\w\d]+)\s+(\d+)[KMG]?\s+/)
- {
- $cvip = ($vip?$2:"");
- $cport = $3;
- }
- elsif (/^\s+->\s+([^:]+):(\S+)\s+(\d+)G\s+/)
- {
- $ipvs->{$cvip}->{$cport}->{$1} += ($3*1000000000);
- }
- elsif (/^\s+->\s+([^:]+):(\S+)\s+(\d+)M\s+/)
- {
- $ipvs->{$cvip}->{$cport}->{$1} += ($3*1000000);
- }
- elsif (/^\s+->\s+([^:]+):(\S+)\s+(\d+)K\s+/)
- {
- $ipvs->{$cvip}->{$cport}->{$1} += ($3*1000);
- }
- elsif (/^\s+->\s+([^:]+):(\S+)\s+(\d+)\s+/)
- {
- $ipvs->{$cvip}->{$cport}->{$1} += $3;
- }
- }
- close (IPVS) or return undef;
- return $ipvs;
+
+sub suggest {
+ my $ipvs = shift;
+ exit 0 unless $ipvs;
+
+ foreach my $vip (sort keys %{$ipvs}) {
+ foreach my $port (sort keys %{$ipvs->{$vip}}) {
+ print "cps_${vip}_$port\n";
+ }
+ }
+ exit 0;
+}
+
+
+sub config {
+ my $vip = shift;
+ my $port = shift;
+ my $ipvs = shift;
+
+ print "graph_title Loadbalanced ",($name?$name:"*"),"->",$port," connections\n";
+ print "graph_args -l 0\n";
+ print "graph_total total\n";
+ print "graph_vlabel connections / \${graph_period}\n";
+ print "graph_category network\n";
+ my $first=1;
+ $vip = $vip || "";
+ if (exists ($ipvs->{$vip}) and exists ($ipvs->{$vip}->{$port})) {
+ foreach my $host (sort keys %{$ipvs->{$vip}->{$port}}) {
+ (my $fname = $host) =~ s/[.-]/_/g;
+ if ( $first == 1 ) {
+ print "$fname.draw AREA\n";
+ $first=0
+ } else {
+ print "$fname.draw STACK\n";
+ }
+ print "$fname.type DERIVE\n";
+ $host =~ s/-bak//;
+ print "$fname.label $host\n";
+ print "$fname.max 1000\n";
+ print "$fname.min 0\n";
+ }
+ }
+ exit 0;
+}
+
+sub ipvs {
+ my $vip = shift;
+ my $port = shift;
+ my $ipvs = shift;
+ open (IPVS, "/sbin/ipvsadm -L -n --stats 2>/dev/null|") or return undef;
+ my $cvip = "";
+ my $cport = "";
+ while (<IPVS>) {
+ next if /^IP Virtual Server/;
+ next if /^Prot\s+LocalAddress/;
+ if (/^(\w+)\s+([\w\.-]+):([\w\d]+)\s+(\d+)[KMG]?\s+/) {
+ $cvip = ($vip?$2:"");
+ $cport = $3;
+ }
+ elsif (/^\s+->\s+([^:]+):(\S+)\s+(\d+)G\s+/) {
+ $ipvs->{$cvip}->{$cport}->{$1} += ($3*1000000000);
+ }
+ elsif (/^\s+->\s+([^:]+):(\S+)\s+(\d+)M\s+/) {
+ $ipvs->{$cvip}->{$cport}->{$1} += ($3*1000000);
+ }
+ elsif (/^\s+->\s+([^:]+):(\S+)\s+(\d+)K\s+/) {
+ $ipvs->{$cvip}->{$cport}->{$1} += ($3*1000);
+ }
+ elsif (/^\s+->\s+([^:]+):(\S+)\s+(\d+)\s+/) {
+ $ipvs->{$cvip}->{$cport}->{$1} += $3;
+ }
+ }
+ close (IPVS) or return undef;
+ return $ipvs;
}
# vim:syntax=perl
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/plugins/node.d.linux/diskstat_.in
^
|
@@ -103,13 +103,21 @@
=head1 VERSION
- $Id: diskstat_.in 2923 2009-11-09 11:57:44Z janl $
+ $Id: diskstat_.in 3006 2009-11-19 11:43:51Z janl $
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf suggest
+=head1 BUGS
+
+Does not work correctly with multiple Munin masters as it calculates
+averages between each time it is run. In such a case it can be run
+twice in the same second, this causes "division by zero" errors. If
+it is run two seconds apart the average it reports is over 2 seconds,
+not 5 minutes.
+
=head1 AUTHOR
Michael Renner <michael.renner@amd.co.at>
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/plugins/node.d.linux/fw_conntrack.in
^
|
@@ -118,7 +118,7 @@
exit 0
;;
autoconf)
- if [ -f /proc/net/ip_conntrack ] ; then
+ if [ -f /proc/net/ip_conntrack -o -f /proc/net/nf_conntrack ] ; then
echo yes
exit 0
else
@@ -129,16 +129,19 @@
# Do the work, perform the deed
-# INPUT:
+# INPUT /proc/net/ip_conntrack:
# tcp 6 225790 ESTABLISHED src=10.0.0.4 dst=198.144.194.12 sport=48580 dport=6667 src=198.144.194.12 dst=80.111.68.163 sport=6667 dport=48580 [ASSURED] use=1
# tcp 6 431918 ESTABLISHED src=10.0.0.2 dst=209.58.150.153 sport=33018 dport=6667 src=209.58.150.153 dst=80.111.68.163 sport=6667 dport=33018 [ASSURED] use=1
# tcp 6 123109 ESTABLISHED src=10.0.0.5 dst=198.144.194.12 sport=33846 dport=6667 [UNREPLIED] src=198.144.194.12 dst=80.111.68.163 sport=6667 dport=33846 use=1
# udp 17 53 src=80.111.68.163 dst=62.179.100.29 sport=34153 dport=53 src=62.179.100.29 dst=80.111.68.163 sport=53 dport=34153 [ASSURED] use=1
#
+# INPUT /proc/net/nf_conntrack:
+# ipv4 2 tcp 6 424416 ESTABLISHED src=192.168.1.53 dst=196.203.198.11 sport=1584 dport=22146 packets=13659 bytes=5426603 src=196.203.198.11 dst=83.24.222.252 sport=22146 dport=1584 packets=14757 bytes=15342572 [ASSURED] mark=0 use=1
-cat /proc/net/ip_conntrack | awk '
+if [ -f /proc/net/ip_conntrack ]; then
+ cat /proc/net/ip_conntrack | awk '
BEGIN { STATE["ESTABLISHED"]=STATE["FIN_WAIT"]=STATE["TIME_WAIT"]=0;
- ASSURED=NOREPLY=NATED=STATE["SYN_SENT"]=STATE["UDP"]=0; }
+ TOTAL=ASSURED=NOREPLY=NATED=STATE["SYN_SENT"]=STATE["UDP"]=0; }
/^tcp/ { STATE[$4]++; }
/^udp/ { STATE["UDP"]++; }
/ASSURED/ { ASSURED++; }
@@ -157,8 +160,32 @@
print "nated.value " NATED;
print "total.value " TOTAL;
}'
+else
+ cat /proc/net/nf_conntrack | awk '
+ BEGIN { STATE["ESTABLISHED"]=STATE["FIN_WAIT"]=STATE["TIME_WAIT"]=0;
+ TOTAL=ASSURED=NOREPLY=NATED=STATE["SYN_SENT"]=STATE["UDP"]=0; }
+ / tcp / { STATE[$6]++; }
+ / udp / { STATE["UDP"]++; }
+ /ASSURED/ { ASSURED++; }
+ {
+ TOTAL++;
+ src1 = substr($7, 5); src2 = substr($14, 5);
+ dst1 = substr($8, 5); dst2 = substr($15, 5);
+ if (src1 != dst2 || dst1 != src2) NATED++;
+ }
+ END { print "established.value " STATE["ESTABLISHED"];
+ print "fin_wait.value " STATE["FIN_WAIT"];
+ print "time_wait.value " STATE["TIME_WAIT"];
+ print "syn_sent.value " STATE["SYN_SENT"];
+ print "udp.value " STATE["UDP"];
+ print "assured.value " ASSURED;
+ print "nated.value " NATED;
+ print "total.value " TOTAL;
+ }'
+fi
# Hum, the total.value should be possible to do as a cdef.
+# Or to use the builtin "total" support.
# LocalWords: expr
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/plugins/node.d.linux/iostat.in
^
|
@@ -32,16 +32,18 @@
=head1 MAGIC MARKERS
- #%# family=auto
+ #%# family=manual
#%# capabilities=autoconf
=head1 VERSION
-$Id: iostat.in 2507 2009-09-28 13:56:44Z feiner.tom $
+ $Id: iostat.in 3019 2009-11-20 10:44:42Z janl $
=head1 AUTHOR
-Unknown
+This plugin has been in Munin since it was called "LRRD". The log for
+this file shows that there was a rewrite by Mike Fedyk applied in
+January 2004. We have no other records of who wrote it.
=head1 LICENSE
@@ -101,13 +103,11 @@
foreach my $key (sort by_dev keys %devs) {
print $key . "_read.label $devs{$key}->{name}\n";
print $key . "_read.type DERIVE\n";
- print $key . "_read.max 900000\n";
print $key . "_read.min 0\n";
print $key . "_read.graph no\n";
print $key . "_write.label $devs{$key}->{name}\n";
print $key . "_write.info I/O on device $devs{$key}->{name}\n";
print $key . "_write.type DERIVE\n";
- print $key . "_write.max 900000\n";
print $key . "_write.min 0\n";
print $key . "_write.negative " . $key . "_read\n";
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/plugins/node.d.linux/iostat_ios.in
^
|
@@ -32,12 +32,12 @@
=head1 MAGIC MARKERS
- #%# family=auto
+ #%# family=manual
#%# capabilities=autoconf
=head1 VERSION
- $Id: iostat_ios.in 2383 2009-08-30 12:18:59Z matthias $
+ $Id: iostat_ios.in 3003 2009-11-18 20:50:19Z feiner.tom $
=head1 BUGS
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/plugins/node.d.linux/ip_.in
^
|
@@ -37,7 +37,8 @@
ln -s /usr/share/node/node/plugins-auto/ip_ \
/etc/munin/node.d/ip_192.0.2.1
-...will monitor the IP 192.0.2.1.
+...will monitor the IP 192.0.2.1 (you may be using other directories
+in your setup).
=head2 IPTABLES
@@ -46,6 +47,12 @@
the rules. Given the multitude of methods used to configure iptables
firewalls, they do not show how to make them survive a reboot.
+Please also note that we do not intend to make this script compatible
+with anything but these rules made explicitly for the plugin. If you
+use a firewall tool to create iptables rules you may find that that
+will not work. Please add the appropriate lines by hand (or by
+hand-made script) if so.
+
=head3 IPv4
For the IP address "192.0.2.0", you will need the rules:
@@ -166,6 +173,8 @@
exit 0
fi;
-iptables -L ${INPUT} -v -n -x | grep -m1 $IP | awk "{ print \"in.value \" \$2 }"
-iptables -L ${OUTPUT} -v -n -x | grep -m1 $IP | awk "{ print \"out.value \" \$2 }"
+iptables -L ${INPUT} -v -n -x | grep -m1 "$IP " |
+ awk "{ print \"in.value \" \$2 }"
+iptables -L ${OUTPUT} -v -n -x | grep -m1 "$IP " |
+ awk "{ print \"out.value \" \$2 }"
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/plugins/node.d.linux/threads.in
^
|
@@ -1,5 +1,6 @@
#!@@GOODSH@@
# -*- sh -*-
+# vim: ft=sh
: << =cut
@@ -43,7 +44,8 @@
exit 0
fi
-echo -n "threads.value "
-find /proc -maxdepth 1 -name '[1-9]*' -exec grep 'Threads' {}/status \; | awk ' { sum += $2; } END { print sum; }'
-# Alternate command:
-#ps --no-headers axm | grep '^ -' | wc -l
+# -s suppresses errors about files that vanished before they could
+# be read. It isn't entirely portable, but GNU grep should be a given on
+# Linux. Sadly awk has no such equivalent option or we could skip grep
+# altogether
+grep -s '^Threads' /proc/[0-9]*/status | awk '{ sum += $2; } END { print "threads.value", sum; }'
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/plugins/node.d.linux/yum.in
^
|
@@ -1,5 +1,6 @@
#!@@PERL@@ -w
# -*- perl -*-
+# vim: ft=perl
=head1 NAME
@@ -87,12 +88,13 @@
if @packages;
}
-if (defined $ARGV[0]) {
+if ($ARGV[0]) {
my $arg = $ARGV[0];
- my %funcs = ( update =>\&update,
- config => \&config,
- autoconf => \&autoconf,
- );
+ my %funcs = (
+ update => \&update,
+ config => \&config,
+ autoconf => \&autoconf,
+ );
if (exists $funcs{$arg}) {
$funcs{$arg}->();
|
[-]
[+]
|
Added |
munin-1.4.tar.bz2/plugins/node.d.sunos/iostat.in
^
|
@@ -0,0 +1,125 @@
+#!@@PERL@@
+# -*- perl -*-
+
+=head NAME
+
+iostat - Plugin for watching output from iostat on SunOS/Solaris.
+This plugin is based on io counters rather than calculated averages.
+
+=head1 APPLICABLE SYSTEMS
+
+SunOS/Solaris with that have /bin/iostat.
+
+=head1 CONFIGURATION
+
+None needed or possible at this time.
+
+=head1 INTERPRETATION
+
+To be written...
+
+=head1 MAGIC MARKERS
+
+ #%# family=auto
+ #%# capabilities=autoconf
+
+=head1 VERSION
+
+ $Id $
+
+=head1 AUTHORS
+
+Nicolai Langfeldt (janl@linpro.no) 17/10/2003. Based on work done by
+Andreas Dahl (andread@linpro.no)
+
+=head1 LICENSE
+
+GPLv2
+
+=cut
+
+use warning;
+use strict;
+
+use constant IOSTATBIN => "/bin/iostat";
+
+# -I Report the counts in each interval, rather than rates
+# (where applicable).
+# -x For each disk, report extended disk statistics. The
+# output is in tabular form.
+# -r Emit data in a comma-separated format.
+use constant IOSTATPRM => "-Ixr";
+
+if ($ARGV[0] && $ARGV[0] eq "autoconf"){
+ if (-x IOSTATBIN) {
+ print "yes\n";
+ } else {
+ print 'no (no ',IOSTATBIN," executable)\n";
+ }
+ exit 0;
+}
+
+if ($ARGV[0] && $ARGV[0] eq "config"){
+ print "graph_title I/O throughput\n";
+ print "graph_vlabel bytes/second\n";
+
+ print "diskw.label Disk write\n";
+ print "diskw.type DERIVE\n";
+ print "diskw.min 0\n";
+
+ print "diskr.label Disk read\n";
+ print "diskr.type COUNTER\n";
+ print "diskr.min 0\n";
+
+ print "tapew.label Tape write\n";
+ print "tapew.type COUNTER\n";
+ print "tapew.min 0\n";
+
+ print "taper.label Tape read\n";
+ print "taper.type COUNTER\n";
+ print "taper.min 0\n";
+
+ print "nfsw.label NFS write\n";
+ print "nfsw.type COUNTER\n";
+ print "nfsw.min 0\n";
+
+ print "nfsr.label NFS read\n";
+ print "nfsr.type COUNTER\n";
+ print "nfsr.min 0\n";
+ exit 0;
+}
+
+open(IOSTAT, IOSTATBIN." ".IOSTATPRM."|") ||
+ die ("Couldn't run iostat $!\n");
+
+my($dev,$nri,$nwi,$bri,$bwi);
+my(%nri,%nwi,%bri,%bwi);
+
+while(<IOSTAT>){
+ # Fields: device,r/i,w/i,kr/i,kw/i,...
+ # print;
+ ($dev,$nri,$nwi,$bri,$bwi,undef) = split(',',$_,6);
+ # print "$dev $nri $nwi $bri $bwi\n";
+ if ($dev =~ /^sd/) {
+ $dev = 'disk';
+ } elsif ($dev =~ /^st/) {
+ $dev = 'tape';
+ } elsif ($dev =~ /^nfs/) {
+ $dev = 'nfs';
+ } else {
+ # We ignore fd = floppy, and lines of headers and such
+ next;
+ }
+ $nri{$dev} += $nri;
+ $nwi{$dev} += $nwi;
+ $bri{$dev} += ($bri*1024); # The header says kr/i, and we want bytes
+ $bwi{$dev} += ($bwi*1024); # Ditto.
+}
+
+close(IOSTAT);
+
+foreach $dev ('disk','tape','nfs') {
+ print $dev,"w.value ",$bwi{$dev},"\n";
+ print $dev,"r.value ",$bri{$dev},"\n";
+}
+
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/plugins/node.d/bind9.in
^
|
@@ -7,31 +7,33 @@
=head1 CONFIGURATION
-The following environment variables are used by this plugin:
+This plugin is configurable environment variables. The following
+shows the default settings:
- logfile - Location of the query log
- (default: "/var/log/bind9/query.log")
- statefile - Location of the temporary state file
- (default: "@@PLUGSTATE@@/bind9.state")
+ [bind9]
+ env.logfile /var/log/bind9/query.log
+
+You must also configure query logging in your named.conf. Please
+contribute your documentation about how to do that. Thanks.
=head1 AUTHOR
-Contributed by Nicolai Langfeldt
+Nicolai Langfeldt
=head1 LICENSE
-Unknown license
+GPLv2
=head1 MAGIC MARKERS
- #%# family=contrib
+ #%# family=manual
=cut
use strict;
-my $QUERYLOG=$ENV{logfile} || '/var/log/bind9/query.log';
-my $STATEFILE=$ENV{statefile} || '@@PLUGSTATE@@/bind9.state';
+my $QUERYLOG = $ENV{logfile} || '/var/log/bind9/query.log';
+my $STATEFILE= $ENV{MUNIN_PLUGSTATE}.'/bind9.state';
my $OTHER=0;
my %IN;
@@ -52,9 +54,9 @@
open(Q,"< $QUERYLOG") or die "$!";
while (<Q>) {
chomp;
- if (/client \d+\.\d+.\d+.\d+\#\d+: query\: \S+ (\w+) (\w+)/) {
- if ($1 eq 'IN' and $2 !~ /^TYPE/) {
- $IN{$2}++;
+ if (/client \d+\.\d+.\d+.\d+\#\d+: (view \S+\: |)query\: \S+ (\w+) (\w+)/) {
+ if ($2 eq 'IN' and $3 !~ /^TYPE/) {
+ $IN{$3}++;
} else {
$OTHER++;
}
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/plugins/node.d/bind9_rndc.in
^
|
@@ -9,34 +9,47 @@
The following environment variables are used by this plugin
- rndc - location of the rndc command.
- set to empty if the stats are updated otherwise
- querystats - location of the statistics file
+ [bind_rndc]
+ env.rndc /usr/sbin/rndc
+ env.querystats /var/run/named.stats
-=head1 USAGE
+The user/group that runs the plugin must have read access to the stats
+file. To change user or group (usually Munin plugins are run as
+nobody) add this to the [bind_rndc] stanza if the "bind" user runs
+BIND:
-To intall, put
+ user bind
- statistics-file "/var/run/named.stats";
+On the BIND side put
+
+ statistics-file "/var/run/named.stats";
in the options part of your named.conf or set the querystats variable
(see below) to where your named puts the statistics file by default.
-You must also make sure the rndc.key file is readable by the plugin.
+You must also make sure the rndc.key file is readable by the user that
+runs the plugin.
+
+=head1 FEATURES AND BUGS
+
+Previous versions of this plugin allowed a empty "rndc" environment
+setting to not do a explicit dump of stats to the stats file. This
+version requires running rndc itself. This makes the method of
+finding the correct stats in the file more reliable than before.
=head1 AUTHOR
-Contributed by Laurent Facq 15/06/2004
-Based on Nicolai Langfeldt bind9 plugin
-Reworked by Dagfinn Ilmari Mannsåker
+Contributed by Laurent Facq 15/06/2004. Based on Nicolai Langfeldts
+bind9 plugin. Reworked by Dagfinn Ilmari Mannsåker. BIND 9.6 patch
+from "Vrivellino".
=head1 LICENSE
-License unknown
+License not documented.
=head1 MAGIC MARKERS
- #%# family=contrib
+ #%# family=manual
=cut
@@ -45,15 +58,26 @@
my $rndc = defined($ENV{rndc}) ? $ENV{rndc} : '/usr/sbin/rndc';
my $querystats = $ENV{querystats} || '/var/run/named.stats';
my %IN;
+my $version96 = 0;
+
+# check to see if we're running bind 9.6
+if ( open VERSION, "$rndc 2>&1 |" ) {
+ while ( my $line = <VERSION> ) {
+ if ( $line =~ m/^Version:\s+9\.(\d+)\./o ) {
+ $version96 = 1 if $1 >= 6;
+ }
+ }
+}
# open the log file, and get its size
-open(my $stats, '<', $querystats) or die "$querystats: $!\n";
+open(my $stats, '<', $querystats) or die "$0: $querystats: $!\n";
my $size = (stat $stats)[7];
+
# call rdnc and go directly to the correct offset
-system("$rndc stats") if $rndc;
+system("$rndc stats");
seek($stats , $size, 0);
-# We want the last block like this in the file
+# We want the last block like this in the file (bind 9.early)
#+++ Statistics Dump +++ (1087277501)
#success 106183673
#referral 2103636
@@ -63,10 +87,112 @@
#failure 17522313
#--- Statistics Dump --- (1087277501)
-while (my $line = <$stats>) {
- next unless $line =~ /^(\w+) (\d+)$/;
- $IN{$1} = $2;
+# From BIND 9.5 or newer this is the format:
+#
+# +++ Statistics Dump +++ (1222740363)
+# ++ Incoming Requests ++
+# 13 QUERY
+# ++ Incoming Queries ++
+# 9 A
+# 1 NS
+# 1 SOA
+# 1 MX
+# 1 TXT
+# ++ Outgoing Queries ++
+# ++ Name Server Statistics ++
+# 13 IPv4 requests received
+# 13 responses sent
+# 13 queries resulted in successful answer
+# 9 queries resulted in authoritative answer
+# 4 queries resulted in non authoritative answer
+# 4 queries caused recursion
+# ++ Zone Maintenance Statistics ++
+# 6 IPv4 notifies sent
+# --- Statistics Dump ---
+
+if ( $version96 ) {
+ my $found_stats = 0;
+ while ( my $line = <$stats> ) {
+ chomp $line;
+
+ if ( $found_stats ) {
+ if ( $line =~ m/^\+\+/o ) {
+ $found_stats = 0;
+ next;
+ }
+
+ if ( $line =~ m/^\s+(\d+) (.*)$/o ) {
+ my $n = $1;
+ my $msg = $2;
+
+ if ($msg =~ m/requests received$/io) {
+ $IN{requests} = 0 unless $IN{requests};
+ $IN{requests} += $n;
+
+ } elsif ($msg =~ m/responses sent$/io ) {
+ $IN{responses} = 0 unless $IN{requests};
+ $IN{responses} += $n;
+
+ } elsif (lc $msg eq 'queries resulted in successful answer') {
+ $IN{success} = $n;
+
+ } elsif (lc $msg eq
+ 'queries resulted in authoritative answer') {
+ $IN{auth_answer} = $n;
+ } elsif (lc $msg eq
+ 'queries resulted in non authoritative answer') {
+ $IN{nonauth_answer} = $n;
+ } elsif (lc $msg eq 'queries resulted in nxrrset') {
+ $IN{nxrrset} = $n;
+ } elsif (lc $msg eq 'queries resulted in servfail') {
+ $IN{failure} = $n;
+
+ } elsif (lc $msg eq 'queries resulted in nxdomain') {
+ $IN{nxdomain} = $n;
+
+ } elsif (lc $msg eq 'queries caused recursion') {
+ $IN{recursion} = $n;
+
+ } elsif (lc $msg eq 'duplicate queries received') {
+ $IN{duplicates} = $n;
+ }
+ }
+
+ } elsif ( $line =~ m/^\+\+ Name Server Statistics \+\+$/o ) {
+ $found_stats = 1;
+ %IN = ( requests => 0,
+ responses => 0,
+ success => 0,
+ auth_answer => 0,
+ nonauth_answer => 0,
+ nxrrset => 0,
+ failure => 0,
+ nxdomain => 0,
+ recursion => 0,
+ duplicates => 0,
+ );
+ }
+ }
+} else { # not version 9.6
+
+ while (my $line = <$stats>) {
+ chomp $line;
+
+ if ($line =~ m/\+\+\+ Statistics Dump \+\+\+/) {
+ # reset
+ undef %IN;
+ } else {
+ my ($what, $nb)= split('\s+', $line);
+ if ($what && ($what ne '---')) {
+ $IN{$what} = $nb;
+ }
+ }
+
+ next unless $line =~ /^(\w+) (\d+)$/;
+ $IN{$1} = $2;
+ }
}
+
close($stats);
if (defined($ARGV[0]) and ($ARGV[0] eq 'config')) {
|
[-]
[+]
|
Added |
munin-1.4.tar.bz2/plugins/node.d/ejabberd_.in
^
|
@@ -0,0 +1,295 @@
+#!@@GOODSH@@
+# -*- sh -*-
+
+: << =cut
+
+=head1 NAME
+
+ejabberd_ - Munin wildcard plugin to monitor ejabberd2
+
+=head1 CONFIGURATION
+
+As connected users, registered users and server-connections have
+somewhat different scales, this plugin uses munins suggest feature to
+create the following graphs:
+
+ejabberd_connections
+
+ejabberd_memory
+
+ejabberd_registrations
+
+ejabberd_statuses
+
+ejabberd_threads
+
+ejabberd_uptime
+
+ejabberd_users
+
+ejabberd_usersindays
+
+
+If the autodetect-feature for vhosts breaks, you can set
+
+=over 4
+
+ [ejabberd_*]
+ env.vhosts foo.com bar.com
+
+=back
+
+in a file in plugin-conf.d to override it. ("user root" may also be
+smart/not so smart depending on your setup).
+
+For monitoring user statuses - define statuses environment variable:
+(you can monitor only some of them)
+
+=over 4
+
+ [ejabberd_*]
+ env.statuses available away chat xa
+
+=back
+
+For usersindays statistics define days environment variable. Be
+careful on high loaded servers, because it will plot all days in one
+graph.
+
+=over 4
+
+ [ejabberd_*]
+ env.days 1 7 30
+
+=back
+
+=head1 MAGIC MARKERS
+
+ #%# family=contrib
+ #%# capabilities=autoconf suggest
+
+=head1 AUTHOR
+
+Written by Lasse Karstensen <lkarsten@hyse.org>. Based on
+ejabberd-plugin by Christian Dröge <Christian@draugr.de>
+
+Status, memory, threads, uptime, usersindays, ejabberd2 and other code
+optimisation by Peter Viskup <skupko.sk@gmail.com>
+
+=head1 LICENSE
+
+Unknown
+
+=head1 BUGS
+
+Previously the documentation for this plugin mentioned RRDs limit on
+data series names. Munin works around this limit and the restriction
+does not apply.
+
+There is no way to configure the path to ejabberdctl.
+
+There is no way to configure the "/etc" path. /etc/ejabberd and
+/usr/local/ejabberd/etc is hardcoded in the script.
+
+=cut
+
+EJCTL=$(which ejabberdctl 2>/dev/null)
+
+if [ "$1" = "autoconf" ]; then
+ if [ -n "$EJCTL" -a -x "$EJCTL" ]; then
+ echo yes
+ exit 0
+ fi
+ echo "no (ejabberdctl not found in path)"
+ exit 0
+fi
+
+if [ "$1" = "suggest" ]; then
+ echo "connections"
+ echo "users"
+ echo "registrations"
+ echo "statuses"
+ echo "memory"
+ echo "threads"
+ echo "usersindays"
+ echo "uptime"
+ exit 0
+fi
+
+# trying to autodetect running vhosts.
+if [ -z "$vhosts" ]; then
+ for CFGPATH in /etc/ejabberd /usr/local/ejabberd/etc; do
+ if [ -f "$CFGPATH/ejabberd.cfg" ]; then
+ EJCFG=$CFGPATH/ejabberd.cfg;
+ fi
+ done
+ if [ -z "$EJCFG" ]; then
+ echo "Unable to find ejabberd.cfg. Exiting." >&2
+ exit -1
+ fi
+ # you have to have all of vhosts defined on one line in $EJCFG or in plugins-conf.d/munin-node config file
+ vhosts=$(awk '/^\s*{hosts/ {gsub( /\{\s?hosts\s?,|[\",\[\]]|\}\s?.|localhost/ ,""); print;}' $EJCFG);
+fi
+
+# get ejabberd PID
+# in GNU/Linux Debian Lenny release the pidof command can be executed only by root
+#EJPID=$(pidof -s /usr/lib/erlang/erts-5.6.3/bin/beam.smp)
+EJPID=$(ps -ef | awk '/ejabberd/ && /\/bin\/beam(.smp)?/ {print $2}')
+
+if [ -z "$vhosts" ]; then
+ echo "No vhosts to sample." >&2
+ echo "Please set env.vhosts in plugins-conf.d/munin-node." >&2
+ exit -1
+fi
+
+MODE=`basename $0 | sed 's/^ejabberd_//g'`
+
+if ! [ "$MODE" = "connections" -o "$MODE" = "users" \
+ -o "$MODE" = "registrations" -o "$MODE" = "statuses" \
+ -o "$MODE" = "memory" -o "$MODE" = "threads" \
+ -o "$MODE" = "usersindays" -o "$MODE" = "uptime" ]; then
+ echo "ERROR: Unknown mode \"$MODE\". Exiting." >&2
+ exit -1
+fi
+
+if [ "$1" = "config" ]; then
+ if [ "$MODE" = "memory" ]; then
+ echo 'graph_args --base 1024 -l 0'
+ echo 'graph_scale yes'
+ echo 'graph_category ejabberd'
+ echo 'graph_info This graph shows a statistic of ejabberd'
+ echo 'graph_title Memory of ejabberd process'
+ echo 'graph_vlabel Bytes'
+ echo "ejabberd_memory_size.label actual memory";
+ echo "ejabberd_memory_size.info Memory used by ejabberd process in Bytes";
+ echo "ejabberd_memory_peak.label memory peak";
+ echo "ejabberd_memory_peak.info Memory peak of ejabberd process in Bytes";
+ else
+ echo 'graph_args --base 1000 -l 0'
+ echo 'graph_scale no'
+ echo 'graph_category ejabberd'
+ echo 'graph_info This graph shows a statistic of ejabberd'
+
+ if [ "$MODE" = "connections" ]; then
+ echo 'graph_title Server-to-server conections'
+ echo 'graph_vlabel s2s'
+ echo 's2s_connections_out.label incoming s2s connections'
+ echo 's2s_connections_out.info Number of outgoing server to server connections'
+ echo 's2s_connections_in.label outgoing s2s connections'
+ echo 's2s_connections_in.info Number of incoming server to server connections'
+ elif [ "$MODE" = "users" ]; then
+ echo 'graph_title Connected users'
+ echo 'graph_vlabel users'
+ for host in $vhosts; do
+ formathost=$(echo $host | tr '.' '_')
+ echo "connected_users_$formathost.label $host connected users";
+ echo "connected_unique_users_$formathost.label $host unique connected users";
+ done;
+ elif [ "$MODE" = "registrations" ]; then
+ echo 'graph_title Number of registered users'
+ echo 'graph_vlabel users'
+ for host in $vhosts; do
+ formathost=$(echo $host | tr '.' '_')
+ echo "registered_$formathost.label $host registered users";
+ echo "registered_$formathost.info Registered users for vhost $host"
+ done;
+ elif [ "$MODE" = "statuses" ]; then
+ echo 'graph_title Users with statuses'
+ echo 'graph_vlabel users'
+ for host in $vhosts; do
+ for status in $statuses; do
+ formathost=$(echo $host | tr '.' '_')
+ echo "status_${formathost}_${status}.label $status on $host";
+ echo "status_${formathost}_${status}.info Number of users with status $status on $host [available, away, xa=not available, dnd=(do not disturb) or (busy), chat=free for chat]";
+ done;
+ done;
+ elif [ "$MODE" = "threads" ]; then
+ echo 'graph_title Threads of ejabberd process'
+ echo 'graph_vlabel threads'
+ echo "ejabberd_threads.label number of threads";
+ echo "ejabberd_threads.info Number of threads of ejabberd process";
+ elif [ "$MODE" = "usersindays" ]; then
+ echo 'graph_title Active users in last days'
+ echo 'graph_vlabel users'
+ for host in $vhosts; do
+ for num in $days; do
+ formathost=$(echo $host | tr '.' '_')
+ echo "usersindays_${formathost}_${num}.label active users on $host in last $num days";
+ echo "usersindays_${formathost}_${num}.info Number of users active on $host in last $num days";
+ done;
+ done;
+ elif [ "$MODE" = "uptime" ]; then
+ echo 'graph_title Uptime of ejabberd server'
+ echo 'uptime in days'
+ echo "uptime.label uptime"
+ echo 'uptime.draw AREA'
+ fi
+ fi
+ exit 0
+fi
+
+if [ "$MODE" = "connections" ]; then
+ echo "s2s_connections_out.value $($EJCTL outgoing-s2s-number)"
+ echo "s2s_connections_in.value $($EJCTL incoming-s2s-number)"
+ exit 0
+fi
+
+if [ "$MODE" = "users" ]; then
+ for host in $vhosts; do
+ formathost=$(echo $host | tr '.' '_')
+ echo "connected_users_$formathost.value $($EJCTL vhost $host stats onlineusers)";
+ echo "connected_unique_users_$formathost.value $($EJCTL connected-users | awk -v var=$host -F/ '{users[$1]} END {for (user in users) {if (index(user,var)) {count++}} print count}')";
+ done
+ exit 0
+fi
+
+if [ "$MODE" = "registrations" ]; then
+ for host in $vhosts; do
+ formathost=$(echo $host | tr '.' '_')
+ num=$($EJCTL vhost $host stats registeredusers)
+ if [ "$?" != 0 ]; then
+ num="U"
+ fi
+ echo "registered_$formathost.value $num";
+ done
+ exit 0
+fi
+
+if [ "$MODE" = "statuses" ]; then
+ for host in $vhosts; do
+ formathost=$(echo $host | tr '.' '_')
+ for status in $statuses; do
+ num=$($EJCTL vhost $host status-num $status)
+ if [ "$?" != 0 ]; then
+ num="U"
+ fi
+ echo "status_${formathost}_${status}.value $num";
+ done
+ done
+ exit 0
+fi
+
+if [ "$MODE" = "memory" ]; then
+ echo "ejabberd_memory_size.value $(awk '/VmSize/ {print $2*1024}' /proc/${EJPID}/status)"
+ echo "ejabberd_memory_peak.value $(awk '/VmPeak/ {print $2*1024}' /proc/${EJPID}/status)"
+ exit 0
+fi
+
+if [ "$MODE" = "threads" ]; then
+ echo "ejabberd_threads.value $(awk '/Threads/ {print $2}' /proc/${EJPID}/status)"
+ exit 0
+fi
+
+if [ "$MODE" = "usersindays" ]; then
+ for host in $vhosts; do
+ for num in $days; do
+ formathost=$(echo $host | tr '.' '_')
+ echo "usersindays_${formathost}_${num}.value $($EJCTL vhost $host num-active-users $num)";
+ done;
+ done;
+ exit 0
+fi
+
+if [ "$MODE" = "uptime" ]; then
+ echo "uptime.value $($EJCTL stats uptime-seconds | awk '{printf "%.2f", $1/86400}')"
+fi
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/plugins/node.d/exim_mailqueue.in
^
|
@@ -9,6 +9,12 @@
=head1 CONFIGURATION
+This plugin needs to run as a user that has access to run exim and
+examine the queue directories. This is done like this for example:
+
+ [exim_*]
+ user exim
+
Configuration parameters for a file in @@CONFDIR@@/plugin-conf.d/
if you need to override the defaults below:
@@ -106,6 +112,7 @@
fi
exiqgrep -cz | awk '
- /[0-9]+ matches out of [0-9]+ messages/
- { printf("frozen.value %u\nmails.value %u\n", $1, $5-$1); exit }
- { printf("frozen.value U\nmails.value U\n") }'
+ BEGIN { frozen=mails="U"; }
+ /[0-9]+ matches out of [0-9]+ messages/ { frozen=$1; mails=($5-$1); }
+ END { printf("frozen.value %s\nmails.value %s\n",frozen,mails); }
+'
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/plugins/node.d/exim_mailstats.in
^
|
@@ -1,5 +1,6 @@
#!@@PERL@@ -w
# -*- perl -*-
+# vim:syntax=perl
=head1 NAME
@@ -45,11 +46,11 @@
=head1 VERSION
- $Id: exim_mailstats.in 2314 2009-08-03 11:28:34Z ssm $
+ $Id: exim_mailstats.in 3019 2009-11-20 10:44:42Z janl $
=head1 AUTHOR
-Copyright (C) 2000-2008 Torstein Svendsen, Henrik Grindal Bakken,
+Copyright (C) 2000-2009 Torstein Svendsen, Henrik Grindal Bakken,
Jimmy Olsen, Nicolai Langfeldt and others.
Torstein Svendsen recalls originally writing this with Henrik Grindal
@@ -75,53 +76,51 @@
##########
-sub get_exim_logfile {
+sub get_exim_logfile
+{
my ($spec, $type, $time) = @_;
chomp($spec);
- $time = time() unless $time;
+ $time ||= time();
my $logfile = $spec;
$logfile =~ s/^log_file_path = //;
$logfile =~ s/\%s/$type/;
- if( $logfile =~ /\%D/ ) {
- my @t=localtime($time);
- my $ts = sprintf("%04d%02d%02d",$t[5]+1900, $t[4]+1, $t[3]);
- $logfile =~ s/\%D/$ts/g;
+ if ($logfile =~ /\%D/) {
+ my @t = localtime($time);
+ my $ts = sprintf("%04d%02d%02d", $t[5] + 1900, $t[4] + 1, $t[3]);
+ $logfile =~ s/\%D/$ts/g;
}
my @lfiles = split(/\s?:\s?/, $logfile);
foreach (@lfiles) {
- return $_ unless /^syslog/;
+ return $_ unless /^syslog/;
}
- return undef;
+ return;
}
-my $pos;
-my $received = 0;
-my $completed = 0;
-my $rejected = 0;
-my $dirname;
+my ($pos, $received, $completed, $rejected);
-sub parseEximfile {
+sub parseEximfile
+{
my ($fname, $start) = @_;
- my ($LOGFILE,$rotated) = tail_open($fname, $start);
+ my ($LOGFILE, $rotated) = tail_open($fname, $start);
if ($rotated) {
- # Reset everything if the log has been rotated
- $pos = $received = $completed = $rejected = 0;
+ # Reset everything if the log has been rotated
+ $pos = $received = $completed = $rejected = 0;
}
- my $line;
-
- while ($line = <$LOGFILE>) {
- chomp ($line);
+ while (<$LOGFILE>) {
+ chomp;
- if (substr ($line, 37,2 ) eq '<=') {
- $received++;
- } elsif (substr ($line, 37,9) eq 'Completed') {
- $completed++;
- } elsif ($line=~/rejected/) {
+ if (/ <= /) {
+ $received++;
+ }
+ elsif (/ Completed /) {
+ $completed++;
+ }
+ elsif (/ rejected /) {
$rejected++;
}
}
@@ -129,54 +128,51 @@
}
-($dirname = $0) =~ s/[^\/]+$//;
-
my $EXIM = "/usr/sbin/exim";
-$EXIM = "/usr/sbin/exim4" if (-x "/usr/sbin/exim4"); # a Debianism
-$EXIM = $ENV{'exim'} if defined $ENV{'exim'};
+$EXIM = "/usr/sbin/exim4" if (-x "/usr/sbin/exim4"); # a Debianism
+$EXIM = $ENV{'exim'} if defined $ENV{'exim'};
-my $LOGDIR = $ENV{'logdir'} || undef;
+my $LOGDIR = $ENV{'logdir'} || undef;
my $LOGNAME = $ENV{'logname'} || '';
my $logfile;
-if ( $ARGV[0] and $ARGV[0] eq "autoconf" ) {
- my $logfile;
+if ($ARGV[0] and $ARGV[0] eq "autoconf") {
+ if (defined($LOGDIR)) {
+ if (! -d $LOGDIR) {
+ print "no (logdir does not exist)\n";
+ exit 0;
+ }
+ $logfile = $LOGDIR . '/' . ($LOGNAME || 'mainlog');
+ }
+ else {
+ my $logfilespec = `$EXIM -bP log_file_path 2>/dev/null`;
- if(defined($LOGDIR)) {
- if(! -d $LOGDIR) {
- print "no (logdir does not exist)\n";
- exit 0;
- }
- $logfile = $LOGDIR . '/' . ($LOGNAME || 'mainlog');
-
- } else {
-
- my $logfilespec = `$EXIM -bP log_file_path 2>/dev/null`;
-
- if (! $?) {
- $logfile = get_exim_logfile( $logfilespec, 'main');
- if (! defined($logfile) ) {
- print "no (not able to parse output of '$EXIM -bP log_file_path' = '$logfilespec')\n";
- exit 0;
- }
- } elsif ($? eq "127") {
- print "no (exim not found)\n";
- exit 0;
- } else {
- print "no ('$EXIM -bP log_file_path' returned an error)\n";
- exit 0;
- }
+ if ($? == 0) {
+ $logfile = get_exim_logfile($logfilespec, 'main');
+ if (!defined($logfile)) {
+ print "no (not able to parse output of '$EXIM -bP log_file_path' = '$logfilespec')\n";
+ exit 0;
+ }
+ }
+ elsif ($? == 127) {
+ print "no (exim not found)\n";
+ exit 0;
+ }
+ else {
+ print "no ('$EXIM -bP log_file_path' returned an error)\n";
+ exit 0;
+ }
}
if ($logfile) {
- if (-r "$logfile") {
- print "yes\n";
- exit 0;
- } else {
- print "no (logfile '$logfile' not readable)\n";
- }
+ if (-r "$logfile") {
+ print "yes\n";
+ }
+ else {
+ print "no (logfile '$logfile' not readable)\n";
+ }
}
exit 0;
@@ -185,17 +181,18 @@
my $logfilespec;
-if(defined($LOGDIR)) {
+if (defined($LOGDIR)) {
$logfilespec = '';
$logfile = $LOGDIR . '/' . ($LOGNAME || 'mainlog');
-} else {
- $logfilespec = `$EXIM -bP log_file_path`;
- $logfile = get_exim_logfile( $logfilespec, 'main');
+}
+else {
+ $logfilespec = `$EXIM -bP log_file_path 2>/dev/null`;
+ $logfile = get_exim_logfile($logfilespec, 'main');
}
-exit 1 unless -r $logfile;
+die "Logfile '$logfile' is not readable\n" unless -r $logfile;
-if ( $ARGV[0] and $ARGV[0] eq "config" ) {
+if ($ARGV[0] and $ARGV[0] eq "config") {
print "graph_title Exim mail throughput\n";
print "graph_args --base 1000 -l 0\n";
print "graph_vlabel mails/\${graph_period}\n";
@@ -214,32 +211,22 @@
exit 0;
}
-if (! -f $logfile) {
- print "completed.value U\n";
- print "received.value U\n";
- print "rejected.value U\n";
- exit 0;
-}
-
-($pos,$received,$completed,$rejected) = restore_state();
-
-if (!defined($rejected)) {
+($pos, $received, $completed, $rejected) = restore_state();
+if (! defined $pos) {
# No state file present. Avoid startup spike: Do not read log
# file up to now, but remember how large it is now, and next
# time read from there.
-
- $pos = (stat $logfile)[7]; # File size
-
- $received = $completed = $rejected = 0;
-} else {
- $pos = parseEximfile ($logfile, $pos);
+ $pos = (stat $logfile)[7]; # File size
+ $received = $completed = $rejected = 'U';
+}
+else {
+ $pos = parseEximfile($logfile, $pos);
}
print "received.value $received\n";
print "completed.value $completed\n";
print "rejected.value $rejected\n";
-save_state($pos,$received,$completed,$rejected);
+save_state($pos, $received, $completed, $rejected);
-# vim:syntax=perl
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/plugins/node.d/postfix_mailstats.in
^
|
@@ -23,7 +23,10 @@
=head1 AUTHOR
-Unknown author
+Records show that the plugin was contributed by Nicolai Langfeldt in
+2003. Nicolai can't find anything in his email about this and expects
+the plugin is based on the corresponding exim plugin - to which it now
+bears no resemblence.
=head1 LICENSE
@@ -41,26 +44,30 @@
#%# family=manual
#%# capabilities=autoconf
+=head1 RANDOM COMMENTS
+
+Would be cool if someone ported this to Munin::Plugin for both state
+file and log tailing.
+
=cut
-my $statefile = "@@PLUGSTATE@@/munin-plugin-postfix_mailstats.state";
-my $pos = undef;
+my $statefile = "$MUNIN_PLUGSTATE/munin-plugin-postfix_mailstats.state";
+my $pos;
my $delivered = 0;
my $rejects = {};
my $LOGDIR = $ENV{'logdir'} || '/var/log';
my $LOGFILE = $ENV{'logfile'} || 'mail.log';
+my $logfile = "$LOGDIR/$LOGFILE";
if ( $ARGV[0] and $ARGV[0] eq "autoconf" )
{
my $logfile;
if (-d $LOGDIR)
{
- $logfile = "$LOGDIR/$LOGFILE";
-
if (-f $logfile)
{
- if (-r "$logfile")
+ if (-r $logfile)
{
print "yes\n";
exit 0;
@@ -83,33 +90,10 @@
exit 0;
}
-my $logfile = "$LOGDIR/$LOGFILE";
-my $prevdate = get_prev_date();
-
-if (-f "$logfile.$prevdate")
-{
- $rotlogfile = "$logfile.$prevdate";
-}
-elsif (-f "$logfile.0")
-{
- $rotlogfile = $logfile . ".0";
-}
-elsif (-f "$logfile.1")
-{
- $rotlogfile = $logfile . ".1";
-}
-elsif (-f "$logfile.01")
-{
- $rotlogfile = $logfile . ".01";
-}
-else
-{
- $rotlogfile = "/dev/null";
-}
-if (-f "$statefile")
+if ( -f $statefile)
{
- open (IN, "$statefile") or exit 4;
+ open (IN, '<', $statefile) or die "Unable to open state-file: $!\n";
if (<IN> =~ /^(\d+):(\d+)/)
{
($pos, $delivered) = ($1, $2);
@@ -124,7 +108,7 @@
close IN;
}
-if (! -f $logfile and ! -f $rotlogfile)
+if (! -f $logfile)
{
print "delivered.value U\n";
foreach my $i (sort keys %{$rejects})
@@ -143,14 +127,7 @@
$pos = $startsize;
}
-if ($startsize < $pos)
-{
- # Log rotated
- parseLogfile ($rotlogfile, $pos, (stat $rotlogfile)[7]);
- $pos = 0;
-}
-
-parseLogfile ($logfile, $pos, $startsize);
+parseLogfile($logfile, $pos, $startsize);
$pos = $startsize;
if ( $ARGV[0] and $ARGV[0] eq "config" )
@@ -184,7 +161,7 @@
if(-l $statefile) {
die("$statefile is a symbolic link, refusing to touch it.");
}
-open (OUT, ">$statefile") or exit 4;
+open (OUT, '>', $statefile) or die "Unable to open statefile: $!\n";
print OUT "$pos:$delivered\n";
foreach my $i (sort keys %{$rejects})
{
@@ -195,12 +172,14 @@
sub parseLogfile
{
my ($fname, $start, $stop) = @_;
- open (LOGFILE, $fname) or exit 3;
- seek (LOGFILE, $start, 0) or exit 2;
+ open (LOGFILE, $fname)
+ or die "Unable to open logfile $fname for reading: $!\n";
+ seek (LOGFILE, $start, 0)
+ or die "Unable to seek to $start in $fname: $!\n";
while (tell (LOGFILE) < $stop)
{
- my $line =<LOGFILE>;
+ my $line = <LOGFILE>;
chomp ($line);
if ($line =~ /qmgr.*from=.*size=[0-9]*/)
@@ -210,17 +189,10 @@
elsif ($line =~ /postfix\/smtpd.*reject: \S+ \S+ \S+ (\S+)/ ||
$line =~ /postfix\/cleanup.* reject: (\S+)/)
{
- $rejects->{$1} ++;
+ $rejects->{$1}++;
}
}
- close(LOGFILE);
-}
-
-sub get_prev_date
-{
- my @date = localtime (time - 86400);
- my $prevdate = $date[5]+1900 . $date[4]+1 . $date[3];
- return $prevdate;
+ close(LOGFILE) or warn "Error closing $fname: $!\n";
}
# vim:syntax=perl
|
[-]
[+]
|
Changed |
munin-1.4.tar.bz2/plugins/plugins.history.in
^
|
@@ -309,3 +309,5 @@
snort_pattern_match
snort_pkts
snort_traffic
+solaris/iostat
+ejabberd_
|