You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

455 lines
14 KiB

12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
  1. {% load i18n %}{% load staticfiles %}<!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  6. <meta name="apple-mobile-web-app-capable" content="yes">
  7. <title>{% block title %}PyDash v{{ version }}{% endblock %}</title>
  8. <link href="{% static "css/bootstrap.min.css" %}" rel="stylesheet">
  9. <link href="{% static "css/bootstrap-responsive.min.css" %}" rel="stylesheet">
  10. <link href="{% static "css/fonts.css" %}" rel="stylesheet">
  11. <link href="{% static "css/font-awesome.css" %}" rel="stylesheet">
  12. <link href="{% static "css/style.css" %}" rel="stylesheet">
  13. <link href="{% static "css/dashboard.css" %}" rel="stylesheet">
  14. {% block style %}{% endblock %}
  15. </head>
  16. <body>
  17. <div class="navbar navbar-fixed-top" style="">
  18. <div class="navbar-inner">
  19. <div class="container">
  20. <a class="brand" href="/">pyDash v{{ version }}</a>
  21. <ul class="btn btn-mini">
  22. {% if request.user.is_authenticated or user.is_authenticated %}
  23. <a href="{% url 'logout' %}">{% trans "Sign out" %}</a>
  24. {% else %}
  25. <a href="{% url 'login' %}">{% trans "Sign in" %}</a>
  26. {% endif %}
  27. </ul>
  28. <div class="nav-collapse">
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. <div class="subnavbar visible-desktop visible-tablet">
  34. <div class="subnavbar-inner">
  35. <div class="container">
  36. <ul class="mainnav">
  37. <li><a href="#refresh-os"><i class="icon-dashboard"></i><span>General</span> </a> </li>
  38. <li><a href="#refresh-df"><i class="icon-hdd"></i><span>Disk</span> </a> </li>
  39. <li><a href="#refresh-cpu"><i class="icon-check"></i><span>CPU</span> </a> </li>
  40. <li><a href="#refresh-ram"><i class="icon-list-alt"></i><span>RAM</span> </a> </li>
  41. <li><a href="#refresh-load"><i class="icon-bolt"></i><span>Load</span> </a> </li>
  42. <li><a href="#refresh-online"><i class="icon-user"></i><span>Users</span> </a> </li>
  43. <li><a href="#refresh-ispeed"><i class="icon-exchange"></i><span>Network</span> </a> </li>
  44. <li><a href="#refresh-ps"><i class="icon-list-alt"></i><span>Processes</span> </a> </li>
  45. <li></li>
  46. </ul>
  47. </div>
  48. <!-- /container -->
  49. </div>
  50. <!-- /subnavbar-inner -->
  51. </div>
  52. <div class="main">
  53. <div class="main-inner">
  54. <div class="container">
  55. {% block content %}
  56. <div class="row">
  57. <div class="span3">
  58. <div class="widget widget-table action-table">
  59. <div class="widget-header"> <i class="icon-info-sign"></i>
  60. <h3>General Info</h3>
  61. <div id="refresh-os">
  62. </div>
  63. </div>
  64. <!-- /widget-header -->
  65. <div class="widget-content">
  66. <br>
  67. <div style="text-align:center;">
  68. <b>OS:</b> <span class=""></span>{{ getplatform }}<br>
  69. <b>Uptime:</b> <span class="" id="get-uptime"></span> Hours<br>
  70. <b>Hostname:</b> <span class=""></span>{{ gethostname }}<br>
  71. <b>CPU(s):</b> <span class=""></span>{{ getcpus.cpus }} x {{ getcpus.type }}
  72. <br><br>
  73. </div>
  74. </div>
  75. <!-- /widget-content -->
  76. </div>
  77. <!-- /widget -->
  78. </div>
  79. <div class="span3">
  80. <div class="widget widget-table action-table">
  81. <div class="widget-header"> <i class="icon-info-sign"></i>
  82. <h3>CPU Usage %</h3>
  83. <div id="refresh-cpu">
  84. </div>
  85. </div>
  86. <!-- /widget-header -->
  87. <div class="widget-content">
  88. <p></p>
  89. <canvas id="cpuuChart" width="270" height="180"></canvas>
  90. <div>
  91. <span class="cpuf">{% trans "Free" %}</span>
  92. <span class="cpuu">{% trans "Used" %}</span>
  93. </div>
  94. </div>
  95. <!-- /widget-content -->
  96. </div>
  97. <!-- /widget -->
  98. </div>
  99. <div class="span6">
  100. <div class="widget widget-nopad">
  101. <div class="widget-header">
  102. <i class="icon-list-alt"></i>
  103. <h3>Memory Usage</h3>
  104. <div id="refresh-ram">
  105. </div>
  106. </div>
  107. <!-- /widget-header -->
  108. <div class="widget-content">
  109. <p></p>
  110. <canvas id="memoryChart" width="560" height="200"></canvas>
  111. </div>
  112. <!-- /widget-content -->
  113. </div>
  114. </div>
  115. </div>
  116. <div class="row">
  117. <div class="span6">
  118. <div class="widget widget-table action-table">
  119. <div class="widget-header"> <i class="icon-hdd"></i>
  120. <h3>Disk Usage</h3>
  121. <div id="refresh-df">
  122. </div>
  123. </div>
  124. <!-- /widget-header -->
  125. <div class="widget-content">
  126. <table class="table table-hover table-condensed table-bordered" >
  127. <thead>
  128. <tr>
  129. <th>Filesystem</th>
  130. <th>Size</th>
  131. <th>Used</th>
  132. <th>Avail</th>
  133. <th>Use %</th>
  134. <th>Mounted</th>
  135. </tr>
  136. </thead>
  137. <tbody id="get-disk">
  138. </tbody>
  139. </table>
  140. </div>
  141. <!-- /widget-content -->
  142. </div>
  143. <!-- /widget -->
  144. </div>
  145. <div class="span6">
  146. <div class="widget widget-table action-table">
  147. <div class="widget-header"> <i class="icon-bolt"></i>
  148. <h3>Load Average</h3>
  149. <div id="refresh-load">
  150. </div>
  151. </div>
  152. <!-- /widget-header -->
  153. <div class="widget-content">
  154. <p></p>
  155. <canvas id="loadChart" width="560" height="200"></canvas>
  156. </div>
  157. <!-- /widget-content -->
  158. </div>
  159. <!-- /widget -->
  160. </div>
  161. <!-- /span6 -->
  162. </div>
  163. <!-- /row -->
  164. <div class="row">
  165. <div class="span6">
  166. <div class="widget widget-table action-table">
  167. <div class="widget-header"> <i class="icon-group"></i>
  168. <h3>Online</h3>
  169. <div id="refresh-online">
  170. </div>
  171. </div>
  172. <!-- /widget-header -->
  173. <div class="widget-content">
  174. <table class="table table-hover table-condensed table-bordered">
  175. <thead>
  176. <tr>
  177. <th>User</th>
  178. <th>TTY</th>
  179. <th>Logged in from</th>
  180. </tr>
  181. </thead>
  182. <tbody id="get-users">
  183. </tbody>
  184. </table>
  185. </div>
  186. <!-- /widget-content -->
  187. </div>
  188. <!-- /widget -->
  189. </div>
  190. <div class="span3">
  191. <div class="widget widget-table action-table">
  192. <div class="widget-header"> <i class="icon-monitor"></i>
  193. <h3>IP Adresses</h3>
  194. <div id="refresh-ip">
  195. </div>
  196. </div>
  197. <!-- /widget-header -->
  198. <div class="widget-content">
  199. <table class="table table-hover table-condensed table-bordered">
  200. <thead>
  201. <tr>
  202. <th>Interface</th>
  203. <th>IP</th>
  204. </tr>
  205. </thead>
  206. <tbody id="get-ips">
  207. </tbody>
  208. </table>
  209. </div>
  210. <!-- /widget-content -->
  211. </div>
  212. <!-- /widget -->
  213. </div><!-- /span -->
  214. <div class="span3">
  215. <div class="widget">
  216. <div class="widget-header"> <i class="icon-monitor"></i>
  217. <h3>Internet Traffic</h3>
  218. <div id="refresh-ispeed">
  219. </div>
  220. </div>
  221. <!-- /widget-header -->
  222. <div class="widget-content">
  223. <p></p>
  224. <canvas id="trfChart" width="250" height="200"></canvas>
  225. <div>
  226. <span class="netin">{% trans "In" %}</span>
  227. <span class="netout">{% trans "Out" %}</span>
  228. </div>
  229. </div>
  230. <!-- /widget-content -->
  231. </div>
  232. <!-- /widget -->
  233. </div><!-- /span -->
  234. <!-- online users widget (breaks DOM pattern) -->
  235. </div>
  236. <!-- /row -->
  237. <div class="row">
  238. <div class="span12">
  239. <div class="widget">
  240. <div class="widget-header"> <i class="icon-dashboard"></i>
  241. <h3> Processes </h3>
  242. <div id="refresh-ps">
  243. </div>
  244. </div>
  245. <!-- /widget-header -->
  246. <div class="widget-content">
  247. <table class="table table-hover table-condensed table-bordered">
  248. <thead>
  249. <tr>
  250. <th>User</th>
  251. <th>Pid</th>
  252. <th>%Cpu</th>
  253. <th>%Mem</th>
  254. <th>Vsz</th>
  255. <th>Rss</th>
  256. <th>Tty</th>
  257. <th>Stat</th>
  258. <th>Start</th>
  259. <th>Time</th>
  260. <th>Command</th>
  261. </tr>
  262. </thead>
  263. <tbody id="get-proc">
  264. </tbody>
  265. </table>
  266. </div>
  267. <!-- /widget-content -->
  268. </div>
  269. <!-- /widget -->
  270. </div>
  271. <!-- /span -->
  272. </div>
  273. <!-- /row -->
  274. </div>
  275. <!-- /container -->
  276. </div>
  277. <!-- /main-inner -->
  278. </div>
  279. <!-- /main -->
  280. <div class="footer">
  281. <div class="footer-inner">
  282. <div class="container">
  283. <div class="row">
  284. <div class="span6">&copy; 2014 by <a href="http://github.com/k3oni">Florian Neagu</a>, template by <a href="http://www.egrappler.com/templatevamp-free-twitter-bootstrap-admin-template/" target="_blank">EGrappler</a> </div>
  285. <!-- /span12 -->
  286. </div>
  287. <!-- /row -->
  288. </div>
  289. <!-- /container -->
  290. </div>
  291. <!-- /footer-inner -->
  292. </div>
  293. <!-- /footer -->
  294. {% endblock %}
  295. {% block script %}
  296. <script src="{% static "js/jquery.js" %}"></script>
  297. <script src="{% static "js/bootstrap.js" %}"></script>
  298. <script src="{% static "js/base.js" %}"></script>
  299. <script src="{% static "js/Chart.min.js" %}"></script>
  300. <!--[if lte IE 8]>
  301. <script src="{% static "js/excanvas.js" %}"></script>
  302. <![endif]-->
  303. <script type="text/javascript">
  304. function get_os_data(url, element) {
  305. $.get(url, function(data) {
  306. $(element).text(data);
  307. }, "json");
  308. }
  309. var dashboard = {};
  310. dashboard.getUptime = function() {
  311. get_os_data('/info/uptime/', "#get-uptime");
  312. }
  313. dashboard.getDisk = function() {
  314. $.getJSON('/info/getdisk/{{ getdisk }}', function(data) {
  315. var tr='';
  316. $.each( data, function( index, item){
  317. tr+='<tr><td>'+item[0]+'</td><td>'+item[1]+'</td><td>'+item[2]+'</td><td>'+item[3]+'</td><td>'+item[4]+'</td><td>'+item[5]+'</td></tr>';
  318. })
  319. tr+='';
  320. $("#get-disk").html( tr );
  321. });
  322. }
  323. dashboard.getUsers = function() {
  324. $.getJSON('/info/getusers/{{ getusers }}', function(data) {
  325. var tr='';
  326. $.each( data, function( index, item){
  327. tr+='<tr><td>'+item[0]+'</td><td>'+item[1]+'</td><td>'+item[2]+'</td></tr>';
  328. })
  329. tr+='';
  330. $("#get-users").html( tr );
  331. });
  332. }
  333. dashboard.getProc = function() {
  334. $.getJSON('/info/proc/', function(data) {
  335. var tr='';
  336. $.each( data, function( index, item){
  337. tr+='<tr><td>'+item[0]+'</td><td>'+item[1]+'</td><td>'+item[2]+'</td><td>'+item[3]+'</td><td>'+item[4]+'</td><td>'+item[5]+'</td><td>'+item[6]+'</td><td>'+item[7]+'</td><td>'+item[8]+'</td><td>'+item[9]+'</td><td>'+item[10]+'</td></tr>';
  338. })
  339. tr+='';
  340. $("#get-proc").html( tr );
  341. });
  342. }
  343. dashboard.getIps = function() {
  344. $.getJSON('/info/getips/{{ getips }}', function(data) {
  345. var tr='';
  346. $.each( data, function( index, item){
  347. tr+='<tr><td>'+item[0]+'</td><td>'+item[1]+'</td></tr>';
  348. })
  349. tr+='';
  350. $("#get-ips").html( tr );
  351. });
  352. }
  353. var mem_ctx = $("#memoryChart").get(0).getContext("2d");
  354. var memChart = new Chart(mem_ctx);
  355. function memory_usage(){
  356. $.getJSON('/info/memory/{{ memusage }}', function(data) {
  357. var options = {
  358. animation : false,
  359. pointDotRadius : 2,
  360. scaleLabel : "<%=value%> Mb"
  361. }
  362. memChart.Line(data, options);
  363. });
  364. }
  365. var cpu_ctx = $("#cpuuChart").get(0).getContext("2d");
  366. var cpuChart = new Chart(cpu_ctx);
  367. function cpuu_usage(){
  368. $.getJSON('/info/cpuusage/{{ cpuusage }}', function(data) {
  369. var options = {
  370. percentageInnerCutout : 50,
  371. segmentStrokeWidth : 0
  372. }
  373. cpuChart.Doughnut(data, options);
  374. });
  375. }
  376. var trf_ctx = $("#trfChart").get(0).getContext("2d");
  377. var trfChart = new Chart(trf_ctx);
  378. function traffic_usage(){
  379. $.getJSON('/info/gettraffic/', function(data) {
  380. var options = {
  381. animation : false,
  382. pointDotRadius : 2,
  383. scaleLabel : "<%=value%>"
  384. }
  385. trfChart.Line(data, options);
  386. });
  387. }
  388. var load_ctx = $("#loadChart").get(0).getContext("2d");
  389. var loadChart = new Chart(load_ctx);
  390. function load_average(){
  391. $.getJSON('/info/loadaverage/{{ loadaverage }}', function(data) {
  392. var options = {
  393. animation : false,
  394. pointDotRadius : 2,
  395. scaleLabel : "<%=value%>"
  396. }
  397. loadChart.Line(data, options);
  398. });
  399. }
  400. $(function() {
  401. window.setInterval('memory_usage()', {{ time_refresh }});
  402. window.setInterval('load_average()', {{ time_refresh }});
  403. window.setInterval('cpuu_usage()', {{ time_refresh }});
  404. window.setInterval('traffic_usage()', {{ time_refresh_net }});
  405. window.setInterval('dashboard.getUptime()', {{ time_refresh_long }});
  406. window.setInterval('dashboard.getDisk()', {{ time_refresh_long }});
  407. window.setInterval('dashboard.getUsers()', {{ time_refresh_long }});
  408. window.setInterval('dashboard.getProc()', {{ time_refresh_long }});
  409. });
  410. $(function pageLoad() {
  411. memory_usage();
  412. load_average();
  413. cpuu_usage();
  414. traffic_usage();
  415. dashboard.getUptime();
  416. dashboard.getDisk();
  417. dashboard.getUsers();
  418. dashboard.getIps();
  419. dashboard.getProc();
  420. });
  421. </script>
  422. {% endblock %}
  423. </body>
  424. </html>