5 <title>SystemStats</title>
6 <link rel="stylesheet" type="text/css" href="/styles/main.css" />
7 <%include ../../partials/head%>
12 <%include ../../partials/header%>
15 <div class="realtime">
17 <div class="wrapper RAM">
18 <div class="navbar navbar-dark bg-light"><span>Uso de memoria del sistema</span></div>
20 <!-- <script src="js/health/functions.js"></script> -->
26 paper_bgcolor: 'rgba(0,0,0,0)',
27 plot_bgcolor: 'rgba(0,0,0,0)'
34 function updatePlot(value) {
36 Plotly.extendTraces('ram', {
43 Plotly.relayout('ram', {
45 range: [cnt1 - 100, cnt1]
50 setInterval(function() {
51 let xhr = new XMLHttpRequest();
52 xhr.open('GET', '/free', true);
53 //console.log(xhr); //para ver en la consola
54 xhr.onload = function() {
55 if (xhr.status == 200) { //can use this.status instead
56 //console.log(xhr.responseText);// para ver en la consola
57 updatePlot(xhr.responseText)
65 <div class="wrapper CPU">
66 <div class="navbar navbar-dark bg-light"><span>CPU libre en el sistema</span></div>
71 <script type="text/javascript">
72 function updatePlot2(value) {
74 values: [parseInt(value), 100 - value],
75 labels: ['idle', 'used'],
81 paper_bgcolor: 'rgba(0,0,0,0)',
82 plot_bgcolor: 'rgba(0,0,0,0)'
86 Plotly.react('cpu', data, layout, {
90 setInterval(function() {
91 let xhr = new XMLHttpRequest();
92 xhr.open('GET', '/mpstat', true);
93 //console.log(xhr); //para ver en la consola
94 xhr.onload = function() {
95 if (xhr.status == 200) { //can use this.status instead
96 //console.log(xhr.responseText);// para ver en la consola
97 updatePlot2(xhr.responseText)
105 <div class="wrapper TRAFFIC">
106 <div class="navbar navbar-dark bg-light"><span>Trafico de la Red Kbps</span></div>
107 <div id="trafico"></div>
109 Plotly.plot('trafico', [{
118 paper_bgcolor: 'rgba(0,0,0,0)',
119 plot_bgcolor: 'rgba(0,0,0,0)'
126 function updatePlot3(value1) {
127 Plotly.extendTraces('trafico', {
132 }, [0, 1]).then(function() {
137 Plotly.relayout('trafico', {
139 range: [cnt2 - 100, cnt2]
144 setInterval(function() {
145 let xhr = new XMLHttpRequest();
146 xhr.open('GET', '/ifstat', true);
147 //console.log(xhr); //para ver en la consola
148 xhr.onload = function() {
149 if (xhr.status == 200) { //can use this.status instead
150 // console.log(xhr.responseText); // para ver en la consola
151 var Response = xhr.responseText.replace(/ +/g, ' ');
152 Response = Response.split(" ");
153 // Response = [parseFloat(Response[1]), parseFloat(Response[2])];
154 Response = [Response[1], Response[2]];
155 console.log(Response);
156 updatePlot3(Response)
165 <div class="wrapper TEMP">
166 <div class="navbar navbar-dark bg-light"><span>Informacion de los equipos</span></div>
168 <textarea class="text" rows="20" cols="7" id="temperatura"></textarea>
171 function showtemp() {
172 let xhr = new XMLHttpRequest();
173 xhr.open('GET', '/showtemp', true);
174 xhr.onload = function() {
175 if (xhr.status == 200) { //can use this.status instead
176 //console.log(xhr.responseText);// para ver en la consola
177 console.log(xhr.response);
178 document.getElementById('temperatura').value = xhr.response;
182 //clearInterval(intervalController);
185 setInterval(showtemp,15000);
193 <%include ../../partials/footer%>