mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
Merge pull request #29 from mckoss/master
Replacement for nginx_memory and ngnix_memory (sic)
This commit is contained in:
commit
6a4f383cdd
24
plugins/nginx/nginx_working_set
Executable file
24
plugins/nginx/nginx_working_set
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Munin plugin for monitoring Nginx working set
|
||||||
|
#
|
||||||
|
# ---
|
||||||
|
|
||||||
|
if [ "$1" == config ]; then
|
||||||
|
cat <<'EOF'
|
||||||
|
graph_title NGINX Working Set
|
||||||
|
graph_vlabel WS Bytes
|
||||||
|
graph_category nginx
|
||||||
|
graph_args --base 1024
|
||||||
|
ws.label Working Set
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
KBS=$(ps -o rss --no-heading -p $(pidof nginx))
|
||||||
|
total=0
|
||||||
|
for size in $KBS
|
||||||
|
do
|
||||||
|
total=$(($total + $size * 1024))
|
||||||
|
done
|
||||||
|
echo ws.value $total
|
@ -1,27 +0,0 @@
|
|||||||
#!/usr/bin/env perl
|
|
||||||
#
|
|
||||||
# Munin plugin for monitoring Nginx memory usage
|
|
||||||
#
|
|
||||||
# Written by AkyRhO <akyrho@gmail.com> - Please e-mail for support/question/request/feedback
|
|
||||||
#
|
|
||||||
# Last release (v0.1) 2009-04-20
|
|
||||||
# Last release (v0.1a) 2009-04-26 - fix the base to 1024
|
|
||||||
#
|
|
||||||
# ---
|
|
||||||
|
|
||||||
if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
|
|
||||||
print "graph_title NGINX ram usage\n";
|
|
||||||
print "graph_vlabel ram\n";
|
|
||||||
print "graph_category nginx\n";
|
|
||||||
print "ram.label ram\n";
|
|
||||||
print "graph_args --base 1024\n";
|
|
||||||
} else {
|
|
||||||
my $i = Integer;
|
|
||||||
@cmd = `ps auwx | grep nginx | grep -v grep | grep -v nginx_memory`;
|
|
||||||
|
|
||||||
foreach (@cmd) {
|
|
||||||
@return = split(/ +/, $_);
|
|
||||||
$i += @return[5]*1024;
|
|
||||||
}
|
|
||||||
print "ram.value ".$i."\n";
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user