diff --git a/README.md b/README.md index 725194b..e0e0121 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -pyDash - v1.4 +pyDash - v1.4.2 ====== -A small web monitoring dashboard for your linux pc/server writen in Python and Django + Chart.js. +A small web-based monitoring dashboard for your linux pc/server writen in Python and Django + Chart.js. The dashboard is built using only Python libraries available in the main Python distribution, trying to create a small list of dependencies without the need of installing many packages or libraries. @@ -67,3 +67,8 @@ Credits [Dashboard Template](http://www.egrappler.com/templatevamp-free-twitter-bootstrap-admin-template/), [Bootstrap](http://getbootstrap.com/), [Font Awesome](http://fontawesome.io/) + + +Follow [@hostechs](https://twitter.com/hostechs) on Twitter + +[](http://flattr.com/thing/2630601/k3onipydash-on-GitHub "Flattr this") diff --git a/main/views.py b/main/views.py index 71b7fb4..cee502a 100755 --- a/main/views.py +++ b/main/views.py @@ -71,12 +71,18 @@ def get_ipaddress(): Get the IP Address """ try: - pipe = os.popen(" ip addr | grep -A3 'LOWER_UP' | awk '{printf \"%s,\",$2}'|awk -F,, '{print $0}'") + if get_platform()['osname'] == "Linux": + pipe = os.popen("ip addr | grep -A3 'LOWER_UP' | awk '{if ($2 == \"forever\"){printf \"unavailable,\"} else{ printf \"%s,\",$2}}'|awk -F,, '{print $0}'") + else: + pipe = os.popen("ip addr | grep -A3 'LOWER_UP' | awk '{if ($2 == \"forever\"){printf \"unavailable,,\"} else{ printf \"%s,\",$2}}'|awk -F,, '{print $0}'") data = pipe.read().strip().split(',,') pipe.close() - data = [n for n in data if not n.startswith(('lo', '127'))] data = [i.split(',', 4) for i in data] + if len(data) == 2: + del data[0] + if len(data) > 2: + data = data[1:-1] itf = [] for e in data: @@ -123,8 +129,11 @@ def get_users(): data = pipe.read().strip().split('\n') pipe.close() - data = [i.split(None, 3) for i in data] - + if data == [""]: + data = None + else: + data = [i.split(None, 3) for i in data] + except Exception, err: data = str(err) diff --git a/pydash/settings.py b/pydash/settings.py index 5e0d2e0..ade20e6 100644 --- a/pydash/settings.py +++ b/pydash/settings.py @@ -19,7 +19,6 @@ BASE_DIR = os.path.dirname(os.path.dirname(__file__)) # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '1)$crmowu-23tz@i2-d=7tb3t+1u&(pm!lnjyuarki^72h!3af' -#SECRET_KEY = '1)$-23tz@i2-d=7tb3t+1u&(pm!lnjyuarki^72h!3a9' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False @@ -37,7 +36,7 @@ TIME_JS_REFRESH = 30000 TIME_JS_REFRESH_LONG = 120000 TIME_JS_REFRESH_NET = 2000 -VERSION = 1.4 +VERSION = "1.4.2" ALLOWED_HOSTS = ['*'] diff --git a/static/css/style.css b/static/css/style.css index 42c55ff..ce10fee 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -410,12 +410,8 @@ textarea { .widget-content { padding: 20px 15px 15px; - background: #FFF; - - border: 1px solid #D5D5D5; - -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; @@ -423,7 +419,6 @@ textarea { .widget-header+.widget-content { border-top: none; - -webkit-border-top-left-radius: 0; -webkit-border-top-right-radius: 0; -moz-border-radius-topleft: 0; diff --git a/static/js/dashboard.js b/static/js/dashboard.js index 57c5d63..a2eb107 100644 --- a/static/js/dashboard.js +++ b/static/js/dashboard.js @@ -153,11 +153,14 @@ dashboard.getUsers = function() { { sTitle: "USER" }, { sTitle: "TTY" }, { sTitle: "LOOGED IN FROM", - sDefaultContent: "unavailable" } + sDefaultContent: "unavailable" } ], - bPaginate: false, - bFilter: true, - sDom: "lrtip", + aaSorting: [ + [0, "desc"] + ], + bPaginate: true, + sPaginationType: "two_button", + bFilter: false, bAutoWidth: false, bInfo: false }).fadeIn(); @@ -247,3 +250,12 @@ dashboard.getIps = function() { }); } +//Expand-Contract div/table +$(document).ready(function() { + $(".widget-content").show(); + $(".widget-header").click(function() + { + $(this).next(".widget-content").slideToggle(500); + $("i",this).toggleClass("icon-minus icon-plus"); + }); +}); diff --git a/templates/main.html b/templates/main.html index 1362f5d..0d1859d 100644 --- a/templates/main.html +++ b/templates/main.html @@ -61,12 +61,10 @@