after i made the esm.config.json to this, someone now why. ??
{
"esm": {
"version": "2.5",
"website": "http://www.ezservermonitor.com",
"check_updates": true,
"auto_refresh": 0,
"theme": "dark",
"custom_title": ""
},
"cpu": {
"enable_temperature": true
},
"disk": {
"show_tmpfs": false,
"show_loop": false,
"show_filesystem": true,
"ignore_mounts": []
},
"ping": {
"hosts": [
"facebook.com",
"google.com",
"yahoo.com"
]
},
"last_login": {
"enable": true,
"max": 5
},
"services": {
"show_port": true,
"list": [
{
"name": "Pi00 - SSH",
"host": "192.168.0.4",
"port": 22,
"protocol": "tcp"
},
{
"name": "Pi00 - Web Server",
"host": "192.168.0.4",
"port": 80,
"protocol": "tcp"
},
{
"name": "Pi00 - Desktop Remote",
"host": "192.168.0.4",
"port": 3389,
"protocol": "tcp"
]
},
"pi01services": {
"show_port": true,
"list": [
{
"name": "Pi01 - SSH",
"host": "192.168.0.5",
"port": 23,
"protocol": "tcp"
},
{
"name": "Pi01 - Maria SQL",
"host": "192.168.0.5",
"port": 3306,
"protocol": "tcp"
},
{
"name": "Pi01 - Desktop Remote",
"host": "192.168.0.5",
"port": 3390,
"protocol": "tcp"
}
]
}
}
esm.pi01getServices = function() {
var module = 'pi01services';
esm.reloadBlock_spin(module);
$.get('libs/'+module+'.php', function(data) {
var $box = $('.box#esm-'+module+' .box-content tbody');
$box.empty();
for (var line in data)
{
var label_color = data[line].status == 1 ? 'success' : 'error';
var label_status = data[line].status == 1 ? 'online' : 'offline';
var html = '';
html += '<tr>';
html += '<td class="w15p"><span class="label '+label_color+'">'+label_status+'</span></td>';
html += '<td>'+data[line].name+'</td>';
html += '<td class="w15p">'+data[line].port+'</td>';
html += '</tr>';
$box.append(html);
}
esm.reloadBlock_spin(module);
}, 'json');
}
pi01services: esm.pi01getServices
<?php
require '../autoload.php';
$Config = new Config();
$datas = array();
$available_protocols = array('tcp', 'udp');
$show_port = $Config->get('pi01services:show_port');
if (count($Config->get('pi01services:list')) > 0)
{
foreach ($Config->get('pi01services:list') as $pi01service)
{
$host = $pi01service['host'];
$port = $pi01service['port'];
$name = $pi01service['name'];
$protocol = isset($pi01service['protocol']) && in_array($pi01service['protocol'], $available_protocols) ? $pi01service['protocol'] : 'tcp';
if (Misc::scanPort($host, $port, $protocol))
$status = 1;
else
$status = 0;
$datas[] = array(
'port' => $show_port === true ? $port : '',
'name' => $name,
'status' => $status,
);
}
}
echo json_encode($datas);
<div class="box column-right column-33" id="esm-services">
<div class="box-header">
<h1>PI01 Services status</h1>
<ul>
<li><a href="#" class="reload" onclick="esm.reloadBlock('pi01services');"><span class="icon-cycle"></span></a></li>
</ul>
</div>
<div class="box-content">
<table>
<tbody></tbody>
</table>
</div>
</div>