From 458c65fcc25e0ef54002449cead175661ee5b8cf Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Fri, 22 Oct 2010 18:14:59 +0000 Subject: [PATCH] Add NGINX application type, graphing connections. Thanks to Ove git-svn-id: http://www.observium.org/svn/observer/trunk@1722 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/images/icons/greyscale/nginx.png | Bin 0 -> 564 bytes html/images/icons/nginx.png | Bin 0 -> 688 bytes .../application/nginx_connections.inc.php | 38 ++++++++++++++++++ .../graphs/application/nginx_req.inc.php | 22 ++++++++++ html/pages/device/apps/nginx.inc.php | 27 +++++++++++++ includes/polling/applications/nginx.inc.php | 37 +++++++++++++++++ scripts/nginx-stats | 37 +++++++++++++++++ 7 files changed, 161 insertions(+) create mode 100644 html/images/icons/greyscale/nginx.png create mode 100644 html/images/icons/nginx.png create mode 100644 html/includes/graphs/application/nginx_connections.inc.php create mode 100644 html/includes/graphs/application/nginx_req.inc.php create mode 100644 html/pages/device/apps/nginx.inc.php create mode 100644 includes/polling/applications/nginx.inc.php create mode 100644 scripts/nginx-stats diff --git a/html/images/icons/greyscale/nginx.png b/html/images/icons/greyscale/nginx.png new file mode 100644 index 0000000000000000000000000000000000000000..5bc3e69293d45eaba590dbdd347b7fb89dc0eb3d GIT binary patch literal 564 zcmV-40?Yl0P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02y>eSaefwW^{L9 za%BKeVQFr3E>1;MAa*k@H7+$tiu~XJ00E>)L_t(IPqmY~Yr;?z#)U2&I<%u>7YBF$ zfkKypV<)$|71xd;_)LuP6+?}WAd2D(4I(b4LvRbyC3Gtt3XUC$LnpcYP9PmxwODB2 za&L0K^E>B!hqzq-`HV&*uH9~Pf6fsKg*Zu)9u|wm@xhRKy?!bP!bh=KWH_H43~04l zmyt+>rBW$2o6UrS0r7ZT$z(E26h$V>vTmB@$ySJ_X=1HbQ+vIhF>2;c#ft4!~P3 zmt*;S-d@#eRjO1fB6L>2-?uuQ4(UV}T=v1JWipwxv!&B%Mwuy?-m}@Pedc+d!4vzA z<2ZsY0rc5b>ALR5hg)2(N$3QV*jWUlGZL)3-L3{-+&@~HOeTR+sq{ob%0?5QKx%=^ zL>upDIk4AIWWS2VVs?-NAQ*wr_ua44D3{A~>akELeEC5>P;01ez85f^PQ55~MIIn% z6Ap*fL?WRg`-Xsktj6Q9cP9iwe>55;v)0XK^WG7vs(J(1D@_Uz|4snLX(ISpQ54U2 zQKQlDpt2WK@@N>w(N;(>7`)imBLdIyhsxNm9o;A9u_-B)S13CG0000Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02y>eSaefwW^{L9 za%BKeVQFr3E>1;MAa*k@H7+$tiu~XJ00JOML_t(IPh()9C8$k~?PeuD!cI-Fe5!kt58k$=~Q{G|8pdD|F-bR%qx{wp4XtJ{&&8- z>i>z7N>68p#%tj;q*_zmw^&y0f32GC=ZTKq(_so5o$QjT1;rjU0%IUm+sGHU0Y;Xm z$}|n`)LGi8p(~nV>#UY%Xm&5g+Wy?6rY2^rhFA%TJK^)=jD`lq%H))(6Pp@CVd?-- WE69(BjcBC+0000 diff --git a/html/includes/graphs/application/nginx_req.inc.php b/html/includes/graphs/application/nginx_req.inc.php new file mode 100644 index 0000000000..7feda4c0c8 --- /dev/null +++ b/html/includes/graphs/application/nginx_req.inc.php @@ -0,0 +1,22 @@ + diff --git a/html/pages/device/apps/nginx.inc.php b/html/pages/device/apps/nginx.inc.php new file mode 100644 index 0000000000..f8edacc584 --- /dev/null +++ b/html/pages/device/apps/nginx.inc.php @@ -0,0 +1,27 @@ + 'nginx Connections', + 'nginx_req' => 'nginx requests'); + +foreach($graphs as $key => $text) { + $graph_type = $key; + $graph_array['height'] = "100"; + $graph_array['width'] = "215"; + $graph_array['to'] = $now; + $graph_array['id'] = $app['app_id']; + $graph_array['type'] = "application_".$key; + echo('

'.$text.'

'); + + echo(""); + + + + include("includes/print-quadgraphs.inc.php"); + echo(""); + +} + + + +?> diff --git a/includes/polling/applications/nginx.inc.php b/includes/polling/applications/nginx.inc.php new file mode 100644 index 0000000000..0bba79c2cd --- /dev/null +++ b/includes/polling/applications/nginx.inc.php @@ -0,0 +1,37 @@ + diff --git a/scripts/nginx-stats b/scripts/nginx-stats new file mode 100644 index 0000000000..11a19cf3ca --- /dev/null +++ b/scripts/nginx-stats @@ -0,0 +1,37 @@ +#!/usr/bin/env python +import urllib2 +import re + + +data = urllib2.urlopen('http://localhost/nginx-status').read() + +params = {} + +for line in data.split("\n"): + smallstat = re.match(r"\s?Reading:\s(.*)\sWriting:\s(.*)\sWaiting:\s(.*)$", line) + req = re.match(r"\s+(\d+)\s+(\d+)\s+(\d+)", line) + if smallstat: + params["Reading"] = smallstat.group(1) + params["Writing"] = smallstat.group(2) + params["Waiting"] = smallstat.group(3) + elif req: + params["Requests"] = req.group(3) + else: + pass + + +dataorder = [ + "Active", + "Reading", + "Writing", + "Waiting", + "Requests" + ] + + +for param in dataorder: + if param == "Active": + Active = int(params["Reading"]) + int(params["Writing"]) + int(params["Waiting"]) + print Active + else: + print params[param]