root / plugins / mongodb / mongodb_ram @ 4387edfa
Historique | Voir | Annoter | Télécharger (2,3 ko)
| 1 | 0a4891fc | Alban | #!/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_ram - Munin plugin to show RAM 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 RAM usage\n"; |
||
| 64 | print "graph_vlabel RAM\n"; |
||
| 65 | print "graph_category db\n"; |
||
| 66 | print "graph_args --base 1024 -l 0 --upper-limit 4138442752\n"; |
||
| 67 | print "ram.label RAM\n"; |
||
| 68 | print "ram.type GAUGE\n"; |
||
| 69 | print "ram.draw AREASTACK\n"; |
||
| 70 | print "ram.min 0\n"; |
||
| 71 | exit 0; |
||
| 72 | } else {
|
||
| 73 | my $m = `ps u -p \$(pidof mongod) | awk 'NR > 1 {nm += \$5} END {print nm*1024}'`;
|
||
| 74 | print "ram.value $m"; |
||
| 75 | } |
