Home > Servers > Live nginx status

Live nginx status

Nginx is a beast of a webserver so you can actually do something like this and receive replies with 0ms delay in between (unfortunately ping is a factor :< )

Also graphs coming soon, but I still find the native format useful and quite readable with it updating several times a second.

Requirements:

<html>
<head>
<script src='jquery.js'></script>
<script>
var fresh = 0;
var doIt = function(){
	$.ajax({
		url: "/nginx_status",
		type: "GET",
		dataType: "text",
		success: function(data, textStatus){
			lol.textContent = data;
			doIt();
		}
	});
	fresh ++;
	ref.textContent = fresh;
};
</script>
</head>
<body onload="var lol = document.getElementById('lol');var ref = document.getElementById('ref');doIt()">
<pre>Nginx Live Status
 By Darkimmortal

Refreshes: <span id='ref'></span>

---------------------------------------------------------------
<span id='lol'></span>---------------------------------------------------------------

</body>
</html>

Also you obviously need this in your nginx config somewhere:

	location /nginx_status {
		stub_status on;
		access_log   off;
	}
Categories: Servers Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.