-
Notifications
You must be signed in to change notification settings - Fork 0
/
darwin_specimens
executable file
·86 lines (66 loc) · 2.46 KB
/
darwin_specimens
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/perl
# -*- cperl -*-
#
# Add
# $dbname = $ENV{"PGDATABASE"} if ($ENV{"PGDATABASE"});
# in /usr/share/perl5/Munin/Plugin/Pgsql.pm __connect function
# in order choose the database
# Copyright (C) 2009 Magnus Hagander, Redpill Linpro AB
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2 dated June,
# 1991.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
=head1 NAME
darwin_users - Plugin to monitor connected Darwin users.
=head1 CONFIGURATION
Configuration is done through libpq environment variables, for example
PGUSER, PGDATABASE, etc. For more information, see L<Munin::Plugin::Pgsql>.
=head1 SEE ALSO
L<Munin::Plugin::Pgsql>
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=head1 AUTHOR
Magnus Hagander <[email protected]>, Redpill Linpro AB
Brice Maron <[email protected]>
=head1 COPYRIGHT/License.
Copyright (c) 2009 Magnus Hagander, Redpill Linpro AB
All rights reserved. This program is free software; you can
redistribute it and/or modify it under the terms of the GNU General
Public License as published by the Free Software Foundation; version 2
dated June, 1991.
=cut
use strict;
use warnings;
use Munin::Plugin::Pgsql;
my $pg = Munin::Plugin::Pgsql->new(
title => 'Number of specimens',
info => 'Number of specimens',
vlabel => 'specimens',
category => 'Darwin2',
# graphdraw => 'AREA',
defaultdb => 'darwin2',
basequery =>
"set search_path=darwin2,public; select
(select count(*) from darwin2.specimens ) as spec,
(select count(*) from darwin2.specimen_individuals ) as ind,
(select count(id) from darwin2.specimen_parts) as parts",
configquery => "VALUES
('spec','Number Of specimens', 'Number Of specimens in the db'),
('ind','Number Of individuals', 'Number Of individuals in the db'),
('parts','Number Of parts', 'Number Of parts in the db')
",
pivotquery => 1,
);
$pg->Process();