From f77cbb87074a0d05d05444c731676fd007873b1a Mon Sep 17 00:00:00 2001 From: Mike Koss Date: Mon, 13 Feb 2012 10:53:16 -0800 Subject: [PATCH 1/2] Simpler nginx working set plugin. Replaces nginx_memory (which displays total of virtual memory) and ngnix_memory (sic) which has a bug including non-nginx processes. --- plugins/nginx/nginx_working_set | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 plugins/nginx/nginx_working_set diff --git a/plugins/nginx/nginx_working_set b/plugins/nginx/nginx_working_set new file mode 100755 index 00000000..c2a5c8e6 --- /dev/null +++ b/plugins/nginx/nginx_working_set @@ -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 From 7de8f2cab4d5b1f177641a0fd4f0535d01aab04e Mon Sep 17 00:00:00 2001 From: Mike Koss Date: Mon, 13 Feb 2012 11:04:05 -0800 Subject: [PATCH 2/2] Redundant with nginx_working_set (and had a bug) --- plugins/nginx/ngnix_memory | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100755 plugins/nginx/ngnix_memory diff --git a/plugins/nginx/ngnix_memory b/plugins/nginx/ngnix_memory deleted file mode 100755 index 9b3376f2..00000000 --- a/plugins/nginx/ngnix_memory +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env perl -# -# Munin plugin for monitoring Nginx memory usage -# -# Written by AkyRhO - 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"; -}