From cc0ee73d51cc25c36fcece6712a1e5018cfb922e Mon Sep 17 00:00:00 2001 From: Florian N Date: Sat, 15 Feb 2014 21:52:27 -0500 Subject: [PATCH 1/3] add kernel version --- main/views.py | 24 ++++++++---------------- templates/main.html | 1 + 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/main/views.py b/main/views.py index 9e4c088..c223f3c 100755 --- a/main/views.py +++ b/main/views.py @@ -65,18 +65,6 @@ def get_uptime(): return data -def get_hostname(): - """ - Get the hostname - """ - - try: - data = socket.gethostname() - - except Exception,err: - data = str(err) - - return data def get_ipaddress(): """ @@ -175,10 +163,13 @@ def get_traffic(request): def get_platform(): """ - Get the OS name + Get the OS name, hostname and kernel """ try: - data = " ".join(platform.linux_distribution()) + osname = " ".join(platform.linux_distribution()) + uname = platform.uname() + + data = {'osname': osname, 'hostname': uname[1], 'kernel': uname[2] } except Exception,err: data = str(err) @@ -302,8 +293,9 @@ def get_load(): @login_required(login_url='/login/') def getall(request): - return render_to_response('main.html', {'gethostname': get_hostname(), - 'getplatform': get_platform(), + return render_to_response('main.html', {'gethostname': get_platform()['hostname'], + 'getplatform': get_platform()['osname'], + 'getkernel': get_platform()['kernel'], 'getcpus': get_cpus(), 'time_refresh': time_refresh, 'time_refresh_long': time_refresh_long, diff --git a/templates/main.html b/templates/main.html index 9be9b94..c5f9c87 100644 --- a/templates/main.html +++ b/templates/main.html @@ -74,6 +74,7 @@ OS: {{ getplatform }}
Uptime: Hours
Hostname: {{ gethostname }}
+ Kernel: {{ getkernel }}
CPU(s): {{ getcpus.cpus }} x {{ getcpus.type }}

From 5ded53cabbe0d5b699da77297e7be27bec4f3833 Mon Sep 17 00:00:00 2001 From: Florian N Date: Sat, 15 Feb 2014 22:05:05 -0500 Subject: [PATCH 2/3] align ips-traffic --- templates/main.html | 47 +++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/templates/main.html b/templates/main.html index c5f9c87..29935e9 100644 --- a/templates/main.html +++ b/templates/main.html @@ -176,32 +176,32 @@
-
-
-
-

Online

-
+
+
+
+

IP Adresses

+
- +
- - - + + + - + -
UserTTYLogged in fromIntfIPMac
+
- +
@@ -251,30 +251,31 @@
-
-
-

IP Adresses

-
+
+
+

Online

+
- +
- - - + + + - + -
IntfIPMacUserTTYLogged in from
+
-
+
+
From 82ecd70f0ea2e5b62684239c071f807a65076aa8 Mon Sep 17 00:00:00 2001 From: Florian N Date: Sat, 15 Feb 2014 22:10:03 -0500 Subject: [PATCH 3/3] remove socket import --- main/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/views.py b/main/views.py index c223f3c..b2dddad 100755 --- a/main/views.py +++ b/main/views.py @@ -20,7 +20,7 @@ #OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE #SOFTWARE. -import socket, platform, os, multiprocessing, json +import platform, os, multiprocessing, json from datetime import timedelta