Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / nginx / nginx_memory @ a7139bca

Historique | Voir | Annoter | Télécharger (2,46 ko)

1 3e759f48 perusio
#!/usr/bin/perl -w
2
# -*- mode: cperl; mode: autopair -*-
3
# Magic markers:
4
#%# family=auto
5
#%# capabilities=autoconf
6
# nginx_memory --- Munin plugin for monitoring Nginx memory
7
#                  usage. Based on the nginx_memory.pl plugin
8
#                  by AkyRhO <akyrho@gmail.com>.
9
10
# Copyright (C) 2010 António P. P. Almeida <appa@perusio.net>
11
12
# Author: António P. P. Almeida <appa@perusio.net>
13
14
# Permission is hereby granted, free of charge, to any person obtaining a
15
# copy of this software and associated documentation files (the "Software"),
16
# to deal in the Software without restriction, including without limitation
17
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
18
# and/or sell copies of the Software, and to permit persons to whom the
19
# Software is furnished to do so, subject to the following conditions:
20
21
# The above copyright notice and this permission notice shall be included in
22
# all copies or substantial portions of the Software.
23
24
# Except as contained in this notice, the name(s) of the above copyright
25
# holders shall not be used in advertising or otherwise to promote the sale,
26
# use or other dealings in this Software without prior written authorization.
27
28
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
31
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
33
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
34
# DEALINGS IN THE SOFTWARE.
35
36
=head1 NAME
37
38
nginx_memory - Munin plugin to show the RAM used by nginx.
39
40
=encoding utf8
41
42
=head1 APPLICABLE SYSTEMS
43
44
Any nginx host
45
46
=head1 MAGIC MARKERS
47
48
  #%# family=auto
49
  #%# capabilities=autoconf
50
51
=head1 VERSION
52
53
1.0
54
55
=head1 BUGS
56
57
None known
58
59
=head1 AUTHOR
60
61
Based on a script by AkyRhO <akyrho@gmail.com>. Modified by António
62
Almeida <appa@perusio.net>
63
64
=head1 REPOSITORY
65
66
Source code at http://github.com/perusio/nginx-munin
67
68
=head1 LICENSE
69
70
MIT
71
72
=cut
73
74
## Munin config method.
75
if (exists $ARGV[0] and $ARGV[0] eq "config") {
76
  print "graph_title nginx RAM usage\n";
77
  print "graph_vlabel RAM\n";
78 3c98d069 dipohl
  print "graph_category webserver\n";
79 3e759f48 perusio
  print "ram.label RAM\n";
80
  print "graph_args --base 1024\n";
81
82
  exit 0;
83
} else {
84
  my $m = `ps u -p  \$(pidof nginx) | awk 'NR > 1 {nm += \$5} END {print nm*1024}'`;
85
  print "ram.value $m";
86
}