Projet

Général

Profil

Révision 899a974d

ID899a974d818c217e095828d614ff074148aee43b
Parent 7c879178
Enfant 328d85ad

Ajouté par Marcello Barnaba il y a plus de 12 ans

Add SNMP plugin to monitor the GSA documents index

Voir les différences:

plugins/google/snmp__gsa_docs
1
#!/usr/bin/perl -w
2
# -*- cperl -*-
3

  
4
=head1 NAME
5

  
6
snmp__gsa_docs - SNMP wildcard plugin to monitor GSA document statistics
7

  
8
=head1 APPLICABLE SYSTEMS
9

  
10
A GSA running software version 5.0 or above. See [1] for counters
11
exported via SNMP. Usage of SNMPv3 is recommended, with AuthPriv,
12
and the SHA authentication scheme.
13

  
14
[1]: https://developers.google.com/search-appliance/documentation/50/help_gsa/admin_snmp
15

  
16
=head1 CONFIGURATION
17

  
18
Create a "Munin" user on the GSA SNMP configuration, and then use
19
something similar to the following:
20

  
21
[snmpv3_gsa.host.name_*]
22
  env.v3username munin
23
  env.v3authprotocol sha
24
  env.v3authpassword your-auth-passwd
25
  env.v3privprotocol des
26
  env.v3privpassword your-priv-passwd
27

  
28
Please see 'perldoc Munin::Plugin::SNMP' for further configuration
29
information.
30

  
31
=head1 INTERPRETATION
32

  
33
The graph shows statistics about the documents index and queries per minute.
34

  
35
=head1 MIB INFORMATION
36

  
37
This plugin requires the GOOGLE-MIB and GSA-MIB and will report
38

  
39
GSA-MIB::docsServed.0 = INTEGER: ..
40
GSA-MIB::docErrors.0 = INTEGER: ...
41
GSA-MIB::docsFound.0 = INTEGER: ...
42
GSA-MIB::docBytes.0 = INTEGER: ....
43
GSA-MIB::qpm.0 = INTEGER: .........
44

  
45
=head1 MAGIC MARKERS
46

  
47
  #%# family=snmpauto
48
  #%# capabilities=snmpconf
49

  
50
=head1 VERSION
51

  
52
  $Id$
53

  
54
=head1 BUGS
55

  
56
None known.
57

  
58
=head1 AUTHOR
59

  
60
Copyright (C) 2013 Marcello Barnaba <vjt@openssl.it> based on snmp__if_,
61
Copyright (C) 2004-2009 Jimmy Olsen, Daginn Ilmari Mannsaaker.
62

  
63
=head1 LICENSE
64

  
65
GPLv2
66

  
67
=cut
68

  
69
use strict;
70
use Munin::Plugin;
71
use Munin::Plugin::SNMP;
72

  
73
need_multigraph();
74

  
75
# This is the snmpwalk:
76
# .1.3.6.1.4.1.11129.1.1.1.0 = INTEGER: Running(1)   ##   GSA-MIB::crawlRunning.0 = INTEGER: Running(1)
77
# .1.3.6.1.4.1.11129.1.1.2.1.0 = INTEGER: 855802     ##   GSA-MIB::docsServed.0 = INTEGER: 855802
78
# .1.3.6.1.4.1.11129.1.1.2.2.0 = INTEGER: 0          ##   GSA-MIB::crawlingRate.0 = INTEGER: 0
79
# .1.3.6.1.4.1.11129.1.1.2.3.0 = INTEGER: 501606     ##   GSA-MIB::docBytes.0 = INTEGER: 501606
80
# .1.3.6.1.4.1.11129.1.1.2.4.0 = INTEGER: 1          ##   GSA-MIB::todayDocsCrawled.0 = INTEGER: 1
81
# .1.3.6.1.4.1.11129.1.1.2.5.0 = INTEGER: 0          ##   GSA-MIB::docErrors.0 = INTEGER: 0
82
# .1.3.6.1.4.1.11129.1.1.2.6.0 = INTEGER: 860683     ##   GSA-MIB::docsFound.0 = INTEGER: 860683
83
# .1.3.6.1.4.1.11129.1.1.2.7.0 = INTEGER: Off(0)     ##   GSA-MIB::batchCrawlRunning.0 = INTEGER: Off(0)
84
# .1.3.6.1.4.1.11129.1.1.2.8.0 = INTEGER: 0          ##   GSA-MIB::batchCrawlStartTime.0 = INTEGER: 0
85
# .1.3.6.1.4.1.11129.1.1.2.9.0 = INTEGER: 0          ##   GSA-MIB::batchCrawlEndTime.0 = INTEGER: 0
86
# .1.3.6.1.4.1.11129.1.2.1.0 = INTEGER: 0            ##   GSA-MIB::qpm.0 = INTEGER: 0
87
# .1.3.6.1.4.1.11129.1.3.1.1.0 = INTEGER: green(0)   ##   GSA-MIB::diskHealth.0 = INTEGER: green(0)
88
# .1.3.6.1.4.1.11129.1.3.1.2.0 = STRING:             ##   GSA-MIB::diskErrors.0 = STRING:
89
# .1.3.6.1.4.1.11129.1.3.2.1.0 = INTEGER: green(0)   ##   GSA-MIB::temperatureHealth.0 = INTEGER: green(0)
90
# .1.3.6.1.4.1.11129.1.3.2.2.0 = STRING:             ##   GSA-MIB::temperatureErrors.0 = STRING:
91
# .1.3.6.1.4.1.11129.1.3.3.1.0 = INTEGER: green(0)   ##   GSA-MIB::machineHealth.0 = INTEGER: green(0)
92
# .1.3.6.1.4.1.11129.1.3.3.2.0 = STRING:             ##   GSA-MIB::machineErrors.0 = STRING:
93

  
94
my $entryDocsServed = "1.3.6.1.4.1.11129.1.1.2.1.0";
95
my $entryDocBytes   = "1.3.6.1.4.1.11129.1.1.2.3.0";
96
my $entryDocErrors  = "1.3.6.1.4.1.11129.1.1.2.5.0";
97
my $entryDocsFound  = "1.3.6.1.4.1.11129.1.1.2.6.0";
98
my $entryQPM        = "1.3.6.1.4.1.11129.1.2.1.0"  ; # Queries per Minute
99

  
100
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf") {
101
    print "require $entryDocsServed\n";
102
    print "require $entryDocErrors\n";
103
    print "require $entryDocsFound\n";
104
    print "require $entryDocBytes\n";
105
    print "require $entryQPM\n";
106
    exit 0;
107
}
108

  
109
# SNMP needed for both config and fetch.
110
my $session = Munin::Plugin::SNMP->session();
111
my $response;
112

  
113
if ($ARGV[0] and $ARGV[0] eq "config") {
114
    my ($host,undef,$version) = Munin::Plugin::SNMP->config_session();
115

  
116
    print "host_name $host\n" unless $host eq 'localhost';
117

  
118
    print "multigraph gsa_documents\n";
119
    print "graph_title GSA documents statistics\n";
120
    print "graph_order found served errors\n";
121
    print "graph_args --base 1000\n";
122
    print "graph_vlabel Documents\n";
123
    print "graph_category search\n";
124
    print "graph_info This graph shows document statistics for the GSA\n";
125
    print "served.label served\n";
126
    print "served.type GAUGE\n";
127
    print "served.graph yes\n";
128
    print "errors.label errors\n";
129
    print "errors.type GAUGE\n";
130
    print "errors.graph yes\n";
131
    print "found.label found\n";
132
    print "found.type GAUGE\n";
133
    print "found.graph yes\n";
134
    print "multigraph gsa_storage\n";
135
    print "graph_title GSA storage statistics\n";
136
    print "graph_order bytes\n";
137
    print "graph_vlabel Megabytes Filtered\n";
138
    print "graph_category search\n";
139
    print "graph_info This graph shows the GSA index size\n";
140
    print "bytes.label bytes\n";
141
    print "bytes.type GAUGE\n";
142
    print "bytes.graph yes\n";
143
    print "multigraph gsa_qpm\n";
144
    print "graph_title GSA Queries Per Minute\n";
145
    print "graph_order qpm\n";
146
    print "graph_vlabel Queries per minute\n";
147
    print "graph_category search\n";
148
    print "graph_info This graph shows how many Queries Per Minute the GSA receives\n";
149
    print "qpm.label count\n";
150
    print "qpm.type DERIVE\n";
151
    print "qpm.graph yes\n";
152
    exit 0;
153
}
154

  
155
print "multigraph gsa_documents\n";
156
if (defined ($response = $session->get_single($entryDocsServed))) {
157
    print "served.value ", $response, "\n";
158
}
159
if (defined ($response = $session->get_single($entryDocErrors))) {
160
    print "errors.value ", $response, "\n";
161
}
162
if (defined ($response = $session->get_single($entryDocsFound))) {
163
    print "found.value ", $response, "\n";
164
}
165

  
166
print "multigraph gsa_storage\n";
167
if (defined ($response = $session->get_single($entryDocBytes))) {
168
    print "bytes.value ", $response, "\n";
169
}
170

  
171
print "multigraph gsa_qpm\n";
172
if (defined ($response = $session->get_single($entryQPM))) {
173
    print "qpm.value ", $response, "\n";
174
}

Formats disponibles : Unified diff