Browse Source

Merge branch 'master' of https://github.com/k3oni/pydash

windows
root 12 years ago
parent
commit
22179efa78
  1. 26
      main/views.py
  2. 34
      templates/main.html

26
main/views.py

@ -20,7 +20,7 @@
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE #OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
#SOFTWARE. #SOFTWARE.
import socket, platform, os, multiprocessing, json
import platform, os, multiprocessing, json
from datetime import timedelta from datetime import timedelta
@ -65,18 +65,6 @@ def get_uptime():
return data return data
def get_hostname():
"""
Get the hostname
"""
try:
data = socket.gethostname()
except Exception,err:
data = str(err)
return data
def get_ipaddress(): def get_ipaddress():
""" """
@ -175,10 +163,13 @@ def get_traffic(request):
def get_platform(): def get_platform():
""" """
Get the OS name
Get the OS name, hostname and kernel
""" """
try: 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: except Exception,err:
data = str(err) data = str(err)
@ -302,8 +293,9 @@ def get_load():
@login_required(login_url='/login/') @login_required(login_url='/login/')
def getall(request): 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(), 'getcpus': get_cpus(),
'time_refresh': time_refresh, 'time_refresh': time_refresh,
'time_refresh_long': time_refresh_long, 'time_refresh_long': time_refresh_long,

34
templates/main.html

@ -74,6 +74,7 @@
<b>OS:</b> <span class=""></span>{{ getplatform }}<br> <b>OS:</b> <span class=""></span>{{ getplatform }}<br>
<b>Uptime:</b> <span class="" id="get-uptime"></span> Hours<br> <b>Uptime:</b> <span class="" id="get-uptime"></span> Hours<br>
<b>Hostname:</b> <span class=""></span>{{ gethostname }}<br> <b>Hostname:</b> <span class=""></span>{{ gethostname }}<br>
<b>Kernel:</b> <span class=""></span>{{ getkernel }}<br>
<b>CPU(s):</b> <span class=""></span>{{ getcpus.cpus }} x {{ getcpus.type }} <b>CPU(s):</b> <span class=""></span>{{ getcpus.cpus }} x {{ getcpus.type }}
<br><br> <br><br>
</div> </div>
@ -177,9 +178,9 @@
<div class="row"> <div class="row">
<div class="span6"> <div class="span6">
<div class="widget widget-table action-table"> <div class="widget widget-table action-table">
<div class="widget-header"> <i class="icon-group"></i>
<h3>Online</h3>
<div id="refresh-online">
<div class="widget-header"> <i class="icon-monitor"></i>
<h3>IP Adresses</h3>
<div id="refresh-ip">
</div> </div>
</div> </div>
<!-- /widget-header --> <!-- /widget-header -->
@ -187,12 +188,12 @@
<table class="table table-hover table-condensed table-bordered"> <table class="table table-hover table-condensed table-bordered">
<thead> <thead>
<tr> <tr>
<th>User</th>
<th>TTY</th>
<th>Logged in from</th>
<th>Intf</th>
<th>IP</th>
<th>Mac</th>
</tr> </tr>
</thead> </thead>
<tbody id="get-users">
<tbody id="get-ips">
</tbody> </tbody>
</table> </table>
</div> </div>
@ -200,7 +201,7 @@
</div> </div>
<!-- /widget --> <!-- /widget -->
</div> </div>
<!-- /span -->
<div class="span3"> <div class="span3">
<div class="widget"> <div class="widget">
@ -251,9 +252,9 @@
<div class="row"> <div class="row">
<div class="span6"> <div class="span6">
<div class="widget widget-table action-table"> <div class="widget widget-table action-table">
<div class="widget-header"> <i class="icon-monitor"></i>
<h3>IP Adresses</h3>
<div id="refresh-ip">
<div class="widget-header"> <i class="icon-group"></i>
<h3>Online</h3>
<div id="refresh-online">
</div> </div>
</div> </div>
<!-- /widget-header --> <!-- /widget-header -->
@ -261,19 +262,20 @@
<table class="table table-hover table-condensed table-bordered"> <table class="table table-hover table-condensed table-bordered">
<thead> <thead>
<tr> <tr>
<th>Intf</th>
<th>IP</th>
<th>Mac</th>
<th>User</th>
<th>TTY</th>
<th>Logged in from</th>
</tr> </tr>
</thead> </thead>
<tbody id="get-ips">
<tbody id="get-users">
</tbody> </tbody>
</table> </table>
</div> </div>
<!-- /widget-content --> <!-- /widget-content -->
</div> </div>
<!-- /widget --> <!-- /widget -->
</div><!-- /span -->
</div>
<!-- /span -->
</div> </div>
<!-- /row --> <!-- /row -->

Loading…
Cancel
Save