diff --git a/README.md b/README.md index e0e0121..90dc94f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ -pyDash - v1.4.2 +pyDash - v1.4.4 [](https://twitter.com/hostechs) [](http://www.linkedin.com/in/hostechs/) ====== + +[](http://flattr.com/thing/2630601/k3onipydash-on-GitHub "Flattr this") + + 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,8 +71,3 @@ 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 cee502a..f30e552 100755 --- a/main/views.py +++ b/main/views.py @@ -70,31 +70,31 @@ def get_ipaddress(): """ Get the IP Address """ + data = [] try: - 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() + eth = os.popen("ip addr | grep LOWER_UP | awk '{print $2}'") + iface = eth.read().strip().replace(':','').split('\n') + eth.close() + del iface[0] + + for i in iface: + pipe = os.popen("ip addr show " + i + "| awk '{if ($2 == \"forever\"){!$2} else {print $2}}'") + data1 = pipe.read().strip().split('\n') + pipe.close() + if len(data1) == 2: + data1.append('unavailable', 'unavailable') + if len(data1) == 3: + data1.append('unavailable') + data1[0] = i + data.append(data1) + + ips = {'interface': iface, 'itfip': data} + + data = ips + + except Exception,err: + data = str(err) - 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: - itf.append(e[0].strip(':')) - - ips = {'interface': itf, 'itfip': data} - - data = ips - - except Exception,err: - data = str(err) - return data def get_cpus(): @@ -248,7 +248,7 @@ def get_mem(): percent = (100 - ((freemem * 100) / allmem)) usage = (allmem - freemem) - mem_usage = {'usage': usage, 'percent': percent} + mem_usage = {'usage': usage, 'free': freemem, 'percent': percent} data = mem_usage diff --git a/pydash/settings.py b/pydash/settings.py index ade20e6..b8942ff 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' - # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False @@ -36,7 +35,7 @@ TIME_JS_REFRESH = 30000 TIME_JS_REFRESH_LONG = 120000 TIME_JS_REFRESH_NET = 2000 -VERSION = "1.4.2" +VERSION = "1.4.4" ALLOWED_HOSTS = ['*'] diff --git a/static/css/dashboard.css b/static/css/dashboard.css index 86aad04..5ade332 100644 --- a/static/css/dashboard.css +++ b/static/css/dashboard.css @@ -403,3 +403,19 @@ h6.bigstats { padding: 0 0.3em; border-style: solid; } +.memf { + border-color: rgb(43,214,66); + margin: 0.5em; + border-style: solid; + border-width: 0 0 0 1em; + padding: 0 0.3em; + border-style: solid; +} +.memu { + border-color: rgb(249,134,33); + margin: 0.5em; + border-style: solid; + border-width: 0 0 0 1em; + padding: 0 0.3em; + border-style: solid; +} diff --git a/static/js/dashboard.js b/static/js/dashboard.js index a2eb107..ad0d12c 100644 --- a/static/js/dashboard.js +++ b/static/js/dashboard.js @@ -234,8 +234,8 @@ dashboard.getIps = function() { aoColumns: [ { sTitle: "INTERFACE" }, { sTitle: "MAC ADDRESS" }, - { sTitle: "IPv4 ADDRESS" }, - { sTitle: "IPv6 ADDRESS", + { sTitle: "IP ADDRESS" }, + { sTitle: "IP ADDRESS", sDefaultContent: "unavailable" } ], bPaginate: false, diff --git a/templates/main.html b/templates/main.html index 0d1859d..94c37ff 100644 --- a/templates/main.html +++ b/templates/main.html @@ -2,7 +2,7 @@
- +