root / plugins / mongodb / mongodb_cpu @ bc55ce69
Historique | Voir | Annoter | Télécharger (2,33 ko)
| 1 |
#!/usr/bin/perl -w |
|---|---|
| 2 |
|
| 3 |
# Author : Alban Espie-Guillon <alban.espie@alterway.fr> |
| 4 |
# Based on http://github.com/perusio/nginx-munin Author: António P. P. Almeida <appa@perusio.net> |
| 5 |
|
| 6 |
# Permission is hereby granted, free of charge, to any person obtaining a |
| 7 |
# copy of this software and associated documentation files (the "Software"), |
| 8 |
# to deal in the Software without restriction, including without limitation |
| 9 |
# the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 10 |
# and/or sell copies of the Software, and to permit persons to whom the |
| 11 |
# Software is furnished to do so, subject to the following conditions: |
| 12 |
|
| 13 |
# The above copyright notice and this permission notice shall be included in |
| 14 |
# all copies or substantial portions of the Software. |
| 15 |
|
| 16 |
# Except as contained in this notice, the name(s) of the above copyright |
| 17 |
# holders shall not be used in advertising or otherwise to promote the sale, |
| 18 |
# use or other dealings in this Software without prior written authorization. |
| 19 |
|
| 20 |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 21 |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 22 |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 23 |
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 24 |
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 25 |
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 26 |
# DEALINGS IN THE SOFTWARE. |
| 27 |
|
| 28 |
=head1 NAME |
| 29 |
|
| 30 |
mongodb_cpu - Munin plugin to show CPU used by mongodb. |
| 31 |
|
| 32 |
=encoding utf8 |
| 33 |
|
| 34 |
=head1 APPLICABLE SYSTEMS |
| 35 |
|
| 36 |
Any mongodb host |
| 37 |
|
| 38 |
=head1 MAGIC MARKERS |
| 39 |
|
| 40 |
#%# family=auto |
| 41 |
#%# capabilities=autoconf |
| 42 |
|
| 43 |
=head1 VERSION |
| 44 |
|
| 45 |
1.0 |
| 46 |
|
| 47 |
=head1 BUGS |
| 48 |
|
| 49 |
None known |
| 50 |
|
| 51 |
=head1 AUTHOR |
| 52 |
|
| 53 |
Based on a script by António P. P. Almeida <appa@perusio.net>. Modified by Alban Espie-Guillon <alban.espie@alterway.fr> |
| 54 |
|
| 55 |
=head1 LICENSE |
| 56 |
|
| 57 |
MIT |
| 58 |
|
| 59 |
=cut |
| 60 |
|
| 61 |
## Munin config method. |
| 62 |
if (exists $ARGV[0] and $ARGV[0] eq "config") {
|
| 63 |
print "graph_title Mongodb CPU usage\n"; |
| 64 |
print "graph_vlabel CPU\n"; |
| 65 |
print "graph_category db\n"; |
| 66 |
print "graph_args --base 1000 -r --lower-limit 0\n"; |
| 67 |
print "graph_scale no\n"; |
| 68 |
print "graph_period second\n"; |
| 69 |
print "cpu.label CPU\n"; |
| 70 |
print "cpu.type GAUGE\n"; |
| 71 |
print "cpu.draw AREASTACK\n"; |
| 72 |
print "cpu.min 0\n"; |
| 73 |
exit 0; |
| 74 |
} else {
|
| 75 |
my $c = `ps u -p \$(pidof mongod) | awk 'NR > 1 {print \$3}'`;
|
| 76 |
print "cpu.value $c"; |
| 77 |
} |
