* Mon May 12 2025 Brian Read <brianr@koozali.org> 11.0.0-1.sme

- Adding SM2 panel [SME: 13004]
- Upgrade to phpsysinfo 3.4.4
- Add code to delete inline styles and add css to make it look better.
- version saved / built uses the static version, which means no drops downs and choices.
This commit is contained in:
2025-05-14 16:14:01 +01:00
parent 80b1da5fa5
commit c8ce77259d
952 changed files with 51341 additions and 28699 deletions

View File

@@ -1,61 +1,23 @@
<div class="col-lg-6" id="block_bat" style="display:none">
<div class="panel panel-primary">
<div class="panel-heading">Battery Status</div>
<div class="panel-body">
<table id="bat" class="table table-hover table-condensed">
<thead>
<tr>
<th>Items</th>
<th>Values</th>
<th></th>
</tr>
</thead>
<tr id="bat_DesignCapacity" style="display:none">
<th>Design capacity</th>
<td><span data-bind="DesignCapacity"></span></td>
<td></td>
</tr>
<tr id="bat_RemainingCapacity" style="display:none">
<th>Remaining capacity</th>
<td><span data-bind="RemainingCapacity"></span></td>
<td><span data-bind="RemainingCapacityBar"></span></td>
</tr>
<tr id="bat_ChargingState" style="display:none">
<th>Charging state</th>
<td><span data-bind="ChargingState"></span></td>
<td></td>
</tr>
<tr id="bat_DesignVoltage" style="display:none">
<th>Design voltage</th>
<td><span data-bind="DesignVoltage"></span></td>
<td><span data-bind="DesignVoltageMax"></span></td>
</tr>
<tr id="bat_PresentVoltage" style="display:none">
<th>Present voltage</th>
<td><span data-bind="PresentVoltage"></span></td>
<td></td>
</tr>
<tr id="bat_BatteryType" style="display:none">
<th>Battery Type</th>
<td><span data-bind="BatteryType"></span></td>
<td></td>
</tr>
<tr id="bat_BatteryTemperature" style="display:none">
<th>Battery Temperature</th>
<td><span data-bind="BatteryTemperature"></span></td>
<td></td>
</tr>
<tr id="bat_BatteryCondition" style="display:none">
<th>Battery Condition</th>
<td><span data-bind="BatteryCondition"></span></td>
<td></td>
</tr>
<tr id="bat_CycleCount" style="display:none">
<th>Cycle Count</th>
<td><span data-bind="CycleCount"></span></td>
<td></td>
</tr>
</table>
<div class="col-lg-6" id="block_bat" style="display:none;">
<div class="card" id="panel_bat" style="display:none;">
<div class="card-header"><span class="lang_plugin_bat_001">Battery Status</span>
<span class="hostname_bat"></span>
<div id="reload_bat" class="reload" title="reload"></div>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="bat" class="table table-hover table-sm">
<thead>
<tr>
<th><span class="lang_plugin_bat_006">Battery</span></th>
<th><span class="lang_plugin_bat_007">Value</span></th>
<th></th>
</tr>
</thead>
<tbody id="bat-data">
</tbody>
</table>
</div>
</div>
</div>
</div>

File diff suppressed because it is too large Load Diff

View File

@@ -21,25 +21,48 @@
// $Id: bat.js 661 2012-08-27 11:26:39Z namiltd $
//
/*global $, jQuery, buildBlock, datetime, plugin_translate, genlang, createBar */
/*global $, jQuery, buildBlock, datetime, plugin_translate, genlang */
"use strict";
var bat_show = false, bat_table;
var bat_show = false;
/**
* insert content into table
* build the table where content is inserted
* @param {jQuery} xml plugin-XML
*/
function bat_populate(xml) {
function bat_buildTable(xml) {
var html = "", tree = [], closed = [], batcount = 0, index = 0, hostname = "";
bat_table.fnClearTable();
$("#Plugin_BAT #Plugin_BATTable").remove();
$("Plugins Plugin_BAT Bat", xml).each(function bat_getitem(idp) {
var DesignCapacity = "", DesignVoltage = "", BatteryType = "",RemainingCapacity = "", PresentVoltage = "", ChargingState = "", BatteryTemperature = "", BatteryCondition = "", CapacityUnit = "", CycleCount = "", DesignVoltageMax = "";
DesignCapacity = $(this).attr("DesignCapacity");
hostname = $("Plugins Plugin_BAT", xml).attr('Hostname');
if (hostname !== undefined) {
$('span[class=Hostname_BAT]').html(hostname);
}
html += " <div style=\"overflow-x:auto;\">\n";
html += " <table id=\"Plugin_BATTable\" class=\"tablemain\">\n";
html += " <thead>\n";
html += " <tr>\n";
html += " <th>" + genlang(6, "BAT") + "</th>\n";
html += " <th style=\"width:31%;\">" + genlang(7, "BAT") + "</th>\n";
html += " <th></th>\n";
html += " </tr>\n";
html += " </thead>\n";
html += " <tbody class=\"tree\">\n";
$("Plugins Plugin_Bat Bat", xml).each(function bat_getbats(id) {
var name = "", DesignCapacity = 0, FullCapacity = 0, DesignVoltage = "", BatteryType = "", RemainingCapacity = 0, PresentVoltage = "", ChargingState = "", BatteryTemperature = "", BatteryCondition = "", CapacityUnit = "", CycleCount = "", DesignVoltageMax = "", Manufacturer = "", Model = "", SerialNumber = "";
name = $(this).attr("Name");
if (name === undefined) {
name = "Battery"+(batcount++);
}
DesignCapacity = parseInt($(this).attr("DesignCapacity"), 10);
FullCapacity = parseInt($(this).attr("FullCapacity"), 10);
DesignVoltage = $(this).attr("DesignVoltage");
BatteryType = $(this).attr("BatteryType");
RemainingCapacity = $(this).attr("RemainingCapacity");
RemainingCapacity = parseInt($(this).attr("RemainingCapacity"), 10);
PresentVoltage = $(this).attr("PresentVoltage");
ChargingState = $(this).attr("ChargingState");
BatteryTemperature = $(this).attr("BatteryTemperature");
@@ -47,77 +70,126 @@ function bat_populate(xml) {
CapacityUnit = $(this).attr("CapacityUnit");
CycleCount = $(this).attr("CycleCount");
DesignVoltageMax = $(this).attr("DesignVoltageMax");
Manufacturer = $(this).attr("Manufacturer");
Model = $(this).attr("Model");
SerialNumber = $(this).attr("SerialNumber");
if (CapacityUnit == undefined) {
html += " <tr><td colspan=\"3\"><div class=\"treediv\"><span class=\"treespanbold\">" + name + "</div></span></td></tr>\n";
index = tree.push(0);
if (Model !== undefined) {
html += " <tr><td><div class=\"treediv\"><span class=\"treespan\">" + genlang(15, "BAT") + "</div></span></td><td>" + Model +"</td><td></td></tr>\n";
tree.push(index);
}
if (Manufacturer !== undefined) {
html += " <tr><td><div class=\"treediv\"><span class=\"treespan\">" + genlang(14, "BAT") + "</div></span></td><td>" + Manufacturer +"</td><td></td></tr>\n";
tree.push(index);
}
if (SerialNumber !== undefined) {
html += " <tr><td><div class=\"treediv\"><span class=\"treespan\">" + genlang(16, "BAT") + "</div></span></td><td>" + SerialNumber +"</td><td></td></tr>\n";
tree.push(index);
}
if (CapacityUnit === undefined) {
CapacityUnit = "mWh";
}
if ((CapacityUnit == "%") && (RemainingCapacity != undefined)) {
bat_table.fnAddData([genlang(4, true, "BAT"), createBar(round(parseInt(RemainingCapacity, 10),0)), '&nbsp;']);
} else if (DesignCapacity == undefined) {
if (RemainingCapacity != undefined) bat_table.fnAddData([genlang(4, true, "BAT"), RemainingCapacity+' '+CapacityUnit, '&nbsp;']);
} else {
bat_table.fnAddData([genlang(3, true, "BAT"), DesignCapacity+' '+CapacityUnit, '&nbsp;']);
if (RemainingCapacity != undefined) bat_table.fnAddData([genlang(4, true, "BAT"), RemainingCapacity+' '+CapacityUnit, createBar(parseInt(DesignCapacity, 10) != 0 ? round(parseInt(RemainingCapacity, 10) / parseInt(DesignCapacity, 10) * 100, 0) : 0)]);
}
if (ChargingState != undefined) {
bat_table.fnAddData([genlang(9, true, "BAT"), ChargingState, '&nbsp;']);
}
if (DesignVoltage != undefined) {
if (DesignVoltageMax != undefined) {
bat_table.fnAddData([genlang(5, true, "BAT"), DesignVoltage+' mV', DesignVoltageMax+' mV']);
} else {
bat_table.fnAddData([genlang(5, true, "BAT"), DesignVoltage+' mV', '&nbsp;']);
if ((CapacityUnit == "%") && ($(this).attr("RemainingCapacity") !== undefined)) {
if (!isNaN(RemainingCapacity)) {
html += " <tr><td><div class=\"treediv\"><span class=\"treespan\">" + genlang(3, "BAT") + "</div></span></td><td>" + createBar(RemainingCapacity) +"</td><td></td></tr>\n";
tree.push(index);
}
} else {
if (!isNaN(DesignCapacity)) {
html += " <tr><td><div class=\"treediv\"><span class=\"treespan\">" + genlang(2, "BAT") + "</div></span></td><td>" + DesignCapacity+' '+CapacityUnit +"</td><td></td></tr>\n";
tree.push(index);
}
if (isNaN(FullCapacity)) {
if (!isNaN(RemainingCapacity)) {
html += " <tr><td><div class=\"treediv\"><span class=\"treespan\">" + genlang(3, "BAT") + "</div></span></td><td>" + RemainingCapacity+' '+CapacityUnit +"</td><td></td></tr>\n";
tree.push(index);
}
} else {
if (isNaN(DesignCapacity)) {
html += " <tr><td><div class=\"treediv\"><span class=\"treespan\">" + genlang(13, "BAT") + "</div></span></td><td>" + FullCapacity+' '+CapacityUnit +"</td><td></td></tr>\n";
tree.push(index);
} else {
html += " <tr><td><div class=\"treediv\"><span class=\"treespan\">" + genlang(13, "BAT") + "</div></span></td><td>" + FullCapacity+' '+CapacityUnit +"</td><td>" + createBar(DesignCapacity !== 0 ? round(FullCapacity / DesignCapacity * 100, 0) : 0) + "</td></tr>\n";
tree.push(index);
}
if (!isNaN(RemainingCapacity)) {
html += " <tr><td><div class=\"treediv\"><span class=\"treespan\">" + genlang(3, "BAT") + "</div></span></td><td>" + RemainingCapacity+' '+CapacityUnit +"</td><td>" + createBar(FullCapacity !== 0 ? round(RemainingCapacity / FullCapacity * 100, 0) : 0) + "</td></tr>\n";
tree.push(index);
}
}
} else if (DesignVoltageMax != undefined) {
bat_table.fnAddData([genlang(5, true, "BAT"), DesignVoltageMax+' mV', '&nbsp;']);
}
if (PresentVoltage != undefined) {
bat_table.fnAddData([genlang(6, true, "BAT"), PresentVoltage+' mV', '&nbsp;']);
if (ChargingState !== undefined) {
html += " <tr><td><div class=\"treediv\"><span class=\"treespan\">" + genlang(8, "BAT") + "</div></span></td><td>" + ChargingState +"</td><td></td></tr>\n";
tree.push(index);
}
if (BatteryType != undefined) {
bat_table.fnAddData([genlang(10, true, "BAT"), BatteryType, '&nbsp;']);
if (DesignVoltage !== undefined) {
if (DesignVoltageMax !== undefined) {
html += " <tr><td><div class=\"treediv\"><span class=\"treespan\">" + genlang(4, "BAT") + "</div></span></td><td>" + DesignVoltage+' mV' +"</td><td>" + DesignVoltageMax+' mV'+ "</td></tr>\n";
tree.push(index);
} else {
html += " <tr><td><div class=\"treediv\"><span class=\"treespan\">" + genlang(4, "BAT") + "</div></span></td><td>" + DesignVoltage+' mV' +"</td><td></td></tr>\n";
tree.push(index);
}
} else if (DesignVoltageMax !== undefined) {
html += " <tr><td><div class=\"treediv\"><span class=\"treespan\">" + genlang(4, "BAT") + "</div></span></td><td>" + DesignVoltageMax+' mV' +"</td><td></td></tr>\n";
tree.push(index);
}
if (BatteryTemperature != undefined) {
bat_table.fnAddData([genlang(11, true, "BAT"), formatTemp(BatteryTemperature, xml), '&nbsp;']);
if (PresentVoltage !== undefined) {
html += " <tr><td><div class=\"treediv\"><span class=\"treespan\">" + genlang(5, "BAT") + "</div></span></td><td>" + PresentVoltage+' mV' +"</td><td></td></tr>\n";
tree.push(index);
}
if (BatteryCondition != undefined) {
bat_table.fnAddData([genlang(12, true, "BAT"), BatteryCondition, '&nbsp;']);
if (BatteryType !== undefined) {
html += " <tr><td><div class=\"treediv\"><span class=\"treespan\">" + genlang(9, "BAT") + "</div></span></td><td>" + BatteryType +"</td><td></td></tr>\n";
tree.push(index);
}
if (CycleCount != undefined) {
bat_table.fnAddData([genlang(13, true, "BAT"), CycleCount, '&nbsp;']);
if (BatteryTemperature !== undefined) {
html += " <tr><td><div class=\"treediv\"><span class=\"treespan\">" + genlang(10, "BAT") + "</div></span></td><td>" + formatTemp(BatteryTemperature, xml) +"</td><td></td></tr>\n";
tree.push(index);
}
if (BatteryCondition !== undefined) {
html += " <tr><td><div class=\"treediv\"><span class=\"treespan\">" + genlang(11, "BAT") + "</div></span></td><td>" + BatteryCondition +"</td><td></td></tr>\n";
tree.push(index);
}
if (CycleCount !== undefined) {
html += " <tr><td><div class=\"treediv\"><span class=\"treespan\">" + genlang(12, "BAT") + "</div></span></td><td>" + CycleCount +"</td><td></td></tr>\n";
tree.push(index);
}
bat_show = true;
});
}
/**
* fill the plugin block with table structure
*/
function bat_buildTable() {
var html = "";
html += "<table id=\"Plugin_BATTable\" style=\"border-spacing:0;\">\n";
html += " <thead>\n";
html += " <tr>\n";
html += " <th>" + genlang(7, true, "BAT") + "</th>\n";
html += " <th>" + genlang(8, true, "BAT") + "</th>\n";
html += " <th>&nbsp;</th>\n";
html += " </tr>\n";
html += " </thead>\n";
html += " <tbody>\n";
html += " </tbody>\n";
html += "</table>\n";
html += " </tbody>\n";
html += " </table>\n";
html += " </div>\n";
$("#Plugin_BAT").append(html);
$("#Plugin_BATTable").jqTreeTable(tree, {
openImg: "./gfx/treeTable/tv-collapsable.gif",
shutImg: "./gfx/treeTable/tv-expandable.gif",
leafImg: "./gfx/treeTable/tv-item.gif",
lastOpenImg: "./gfx/treeTable/tv-collapsable-last.gif",
lastShutImg: "./gfx/treeTable/tv-expandable-last.gif",
lastLeafImg: "./gfx/treeTable/tv-item-last.gif",
vertLineImg: "./gfx/treeTable/vertline.gif",
blankImg: "./gfx/treeTable/blank.gif",
collapse: closed,
column: 0,
striped: true,
highlight: false,
state: false
});
}
/**
* load the xml via ajax
*/
function bat_request() {
$("#Reload_BATTable").attr("title", "reload");
$.ajax({
url: "xml.php?plugin=BAT",
dataType: "xml",
@@ -126,7 +198,7 @@ function bat_request() {
},
success: function bat_buildblock(xml) {
populateErrors(xml);
bat_populate(xml);
bat_buildTable(xml);
if (bat_show) {
plugin_translate("BAT");
$("#Plugin_BAT").show();
@@ -137,32 +209,12 @@ function bat_request() {
$(document).ready(function bat_buildpage() {
$("#footer").before(buildBlock("BAT", 1, true));
$("#Plugin_BAT").css("width", "451px");
bat_buildTable();
bat_table = $("#Plugin_BATTable").dataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": false,
"bInfo": false,
"bProcessing": true,
"bAutoWidth": false,
"bStateSave": true,
"aoColumns": [{
"sType": 'span-string'
}, {
"sType": 'span-string'
}, {
"sType": 'span-string'
}]
});
$("#Plugin_BAT").addClass("halfsize");
bat_request();
$("#Reload_BATTable").click(function bat_reload(id) {
bat_request();
$("#Reload_BATTable").attr("title",datetime());
$(this).attr("title", datetime());
});
});

View File

@@ -1,29 +1,47 @@
function renderPlugin_bat(data) {
var batcount = 0;
var directives = {
RemainingCapacity: {
html: function () {
var CapacityUnit = (this["CapacityUnit"] !== undefined) ? this["CapacityUnit"] : 'mWh';
if ( CapacityUnit === "%" ) {
return '<div class="progress"><div class="progress-bar progress-bar-info" style="width: ' + round(this["RemainingCapacity"],0) + '%;"></div>' +
'</div><div class="percent">' + round(this["RemainingCapacity"],0) + '%</div>';
} else {
return this["RemainingCapacity"] + String.fromCharCode(160) + CapacityUnit;
}
Name: {
text: function () {
return (this.Name !== undefined) ? this.Name : 'Battery'+(batcount++);
}
},
DesignCapacity: {
html: function () {
var CapacityUnit = (this["CapacityUnit"] !== undefined) ? this["CapacityUnit"] : 'mWh';
return this["DesignCapacity"] + String.fromCharCode(160) + CapacityUnit;
return this.DesignCapacity + String.fromCharCode(160) + this.CapacityUnit;
}
},
FullCapacity: {
html: function () {
return this.FullCapacity + String.fromCharCode(160) + this.CapacityUnit;
}
},
FullCapacityBar: {
html: function () {
if (( this.CapacityUnit !== "%" ) && (this.DesignCapacity !== undefined)){
var percent = (this.DesignCapacity > 0) ? round(100*this.FullCapacity/this.DesignCapacity, 0) : 0;
return '<div class="progress"><div class="progress-bar progress-bar-info" style="width:' + percent + '%;"></div>' +
'</div><div class="percent">' + percent + '%</div>';
} else {
return '';
}
}
},
RemainingCapacity: {
html: function () {
if ( this.CapacityUnit === "%" ) {
return '<div class="progress"><div class="progress-bar progress-bar-info" style="width:' + this.RemainingCapacity + '%;"></div>' +
'</div><div class="percent">' + this.RemainingCapacity + '%</div>';
} else {
return this.RemainingCapacity + String.fromCharCode(160) + this.CapacityUnit;
}
}
},
RemainingCapacityBar: {
html: function () {
var CapacityUnit = (this["CapacityUnit"] !== undefined) ? this["CapacityUnit"] : 'mWh';
if (( CapacityUnit !== "%" ) && (this["DesignCapacity"] !== undefined)){
var percent = (this["DesignCapacity"] != 0) ? round(100*this["RemainingCapacity"]/this["DesignCapacity"],0) : 0;
return '<div class="progress"><div class="progress-bar progress-bar-info" style="width: ' + percent + '%;"></div>' +
if (( this.CapacityUnit !== "%" ) && (this.FullCapacity !== undefined)){
var percent = (this.FullCapacity > 0) ? round(100*this.RemainingCapacity/this.FullCapacity, 0) : 0;
return '<div class="progress"><div class="progress-bar progress-bar-info" style="width:' + percent + '%;"></div>' +
'</div><div class="percent">' + percent + '%</div>';
} else {
return '';
@@ -32,38 +50,106 @@ function renderPlugin_bat(data) {
},
PresentVoltage: {
text: function () {
return this['PresentVoltage'] + String.fromCharCode(160) + 'mV';
return this.PresentVoltage + String.fromCharCode(160) + 'mV';
}
},
BatteryTemperature: {
text: function () {
return formatTemp(this["BatteryTemperature"], data["Options"]["@attributes"]["tempFormat"]);
html: function () {
return formatTemp(this.BatteryTemperature, data.Options["@attributes"].tempFormat);
}
},
DesignVoltage: {
text: function () {
return this['DesignVoltage']+String.fromCharCode(160) + 'mV';
return this.DesignVoltage + String.fromCharCode(160) + 'mV';
}
},
DesignVoltageMax: {
text: function () {
return (this["DesignVoltageMax"] !== undefined) ? this['DesignVoltageMax']+String.fromCharCode(160) + 'mV' : '';
return (this.DesignVoltageMax !== undefined) ? this.DesignVoltageMax + String.fromCharCode(160) + 'mV' : '';
}
}
};
if ((data['Plugins']['Plugin_BAT'] !== undefined) && (data['Plugins']['Plugin_BAT']["Bat"] !== undefined) && (data['Plugins']['Plugin_BAT']["Bat"]["@attributes"] !== undefined)){
$('#bat').render(data['Plugins']['Plugin_BAT']["Bat"]["@attributes"], directives);
var attr = data['Plugins']['Plugin_BAT']["Bat"]["@attributes"];
for (bat_param in {DesignCapacity:0,RemainingCapacity:1,ChargingState:2,DesignVoltage:3,PresentVoltage:4,BatteryType:5,BatteryTemperature:6,BatteryCondition:7,CycleCount:8}) {
if (attr[bat_param] !== undefined) {
$('#bat_' + bat_param).show();
if (data.Plugins.Plugin_BAT !== undefined) {
var bats = items(data.Plugins.Plugin_BAT.Bat);
if (bats.length > 0) {
var html = "";
var paramlist = {Model:15,Manufacturer:14,SerialNumber:16,DesignCapacity:2,FullCapacity:13,RemainingCapacity:3,ChargingState:8,DesignVoltage:4,PresentVoltage:5,BatteryType:9,BatteryTemperature:10,BatteryCondition:11,CycleCount:12};
var paramlis2 = {FullCapacity:'FullCapacityBar',RemainingCapacity:'RemainingCapacityBar',DesignVoltage:'DesignVoltageMax'};
var i, proc_param;
for (i = 0; i < bats.length; i++) {
if (bats[i]["@attributes"].CapacityUnit === undefined) {
bats[i]["@attributes"].CapacityUnit = 'mWh';
} else if ((bats[i]["@attributes"].CapacityUnit === '%') && (bats[i]["@attributes"].RemainingCapacity !== undefined)) {
if (bats[i]["@attributes"].DesignCapacity !== undefined) {
delete bats[i]["@attributes"].DesignCapacity;
}
if (bats[i]["@attributes"].FullCapacity !== undefined) {
delete bats[i]["@attributes"].FullCapacity;
}
}
if ((bats[i]["@attributes"].DesignCapacity !== undefined) && isNaN(bats[i]["@attributes"].DesignCapacity = parseInt(bats[i]["@attributes"].DesignCapacity, 10))) {
delete bats[i]["@attributes"].DesignCapacity;
}
if ((bats[i]["@attributes"].FullCapacity !== undefined) && isNaN(bats[i]["@attributes"].FullCapacity = parseInt(bats[i]["@attributes"].FullCapacity, 10))) {
delete bats[i]["@attributes"].FullCapacity;
}
if ((bats[i]["@attributes"].RemainingCapacity !== undefined) && isNaN(bats[i]["@attributes"].RemainingCapacity = parseInt(bats[i]["@attributes"].RemainingCapacity, 10))) {
delete bats[i]["@attributes"].RemainingCapacity;
}
try {
html+="<tr id=\"bat-" + i + "\" class=\"treegrid-bat-" + i + "\" style=\"display:none;\" >";
html+="<td colspan=\"3\"><span class=\"treegrid-spanbold\" data-bind=\"Name\"></span></td>";
html+="</tr>";
for (proc_param in paramlist) {
if (bats[i]["@attributes"][proc_param] !== undefined) {
html+="<tr id=\"bat-" + i + "-" + proc_param + "\" class=\"treegrid-parent-bat-" + i + "\">";
html+="<td><span class=\"treegrid-spanbold\">" + genlang(paramlist[proc_param], 'bat') + "</span></td>";
html+="<td><span data-bind=\"" + proc_param + "\"></span></td>";
if (paramlis2[proc_param] !== undefined) {
html+="<td class=\"rightCell\"><span data-bind=\"" + paramlis2[proc_param] + "\"></span></td>";
} else {
html+="<td></td>";
}
html+="</tr>";
}
}
}
catch (err) {
$("#bat-" + i).hide();
}
}
$("#bat-data").empty().append(html);
for (i = 0; i < bats.length; i++) {
try {
$('#bat-'+ i).render(bats[i]["@attributes"], directives);
$("#bat-" + i).show();
for (proc_param in paramlist) {
if (bats[i]["@attributes"][proc_param] !== undefined) {
$('#bat-'+ i+ "-" + proc_param).render(bats[i]["@attributes"], directives);
}
}
}
catch (err) {
$("#bat-" + i).hide();
}
}
$('#bat').treegrid({
initialState: 'expanded',
expanderExpandedClass: 'normalicon normalicon-down',
expanderCollapsedClass: 'normalicon normalicon-right'
});
$('#block_bat').show();
} else {
$('#block_bat').hide();
}
if (attr["CapacityUnit"] === "%") {
$('#bat_DesignCapacity').hide();
}
$('#block_bat').show();
} else {
$('#block_bat').hide();
}

View File

@@ -9,40 +9,49 @@
<expression id="plugin_bat_001" name="bat_title">
<exp>Stav baterie</exp>
</expression>
<expression id="plugin_bat_002" name="bat_date">
<exp>Aktualizováno</exp>
</expression>
<expression id="plugin_bat_003" name="bat_design_capacity">
<expression id="plugin_bat_002" name="bat_design_capacity">
<exp>Konstrukční kapacita</exp>
</expression>
<expression id="plugin_bat_004" name="bat_remaining_capacity">
<expression id="plugin_bat_003" name="bat_remaining_capacity">
<exp>Zbývající kapacita</exp>
</expression>
<expression id="plugin_bat_005" name="bat_design_voltage">
<expression id="plugin_bat_004" name="bat_design_voltage">
<exp>Konstrukční napětí</exp>
</expression>
<expression id="plugin_bat_006" name="bat_present_voltage">
<expression id="plugin_bat_005" name="bat_present_voltage">
<exp>Aktuální napětí</exp>
</expression>
<expression id="plugin_bat_007" name="bat_item">
<exp>Položky</exp>
<expression id="plugin_bat_006" name="bat_battery">
<exp>Baterie</exp>
</expression>
<expression id="plugin_bat_008" name="bat_value">
<exp>Hodnoty</exp>
<expression id="plugin_bat_007" name="bat_value">
<exp>Hodnota</exp>
</expression>
<expression id="plugin_bat_009" name="bat_charging_state">
<expression id="plugin_bat_008" name="bat_charging_state">
<exp>Stav nabíjení</exp>
</expression>
<expression id="plugin_bat_010" name="bat_battery_type">
<expression id="plugin_bat_009" name="bat_battery_type">
<exp>Battery Type</exp>
</expression>
<expression id="plugin_bat_011" name="bat_battery_temperature">
<expression id="plugin_bat_010" name="bat_battery_temperature">
<exp>Battery Temperature</exp>
</expression>
<expression id="plugin_bat_012" name="bat_battery_condition">
<expression id="plugin_bat_011" name="bat_battery_condition">
<exp>Battery Condition</exp>
</expression>
<expression id="plugin_bat_013" name="bat_cycle_count">
<expression id="plugin_bat_012" name="bat_cycle_count">
<exp>Cycle Count</exp>
</expression>
<expression id="plugin_bat_013" name="bat_full_capacity">
<exp>Plná kapacita</exp>
</expression>
<expression id="plugin_bat_014" name="bat_manufacturer">
<exp>Manufacturer</exp>
</expression>
<expression id="plugin_bat_015" name="bat_model">
<exp>Model</exp>
</expression>
<expression id="plugin_bat_016" name="bat_serialnumber">
<exp>Serial Number</exp>
</expression>
</tns:translationPlugin>

View File

@@ -9,40 +9,49 @@
<expression id="plugin_bat_001" name="bat_title">
<exp>Akku-Status</exp>
</expression>
<expression id="plugin_bat_002" name="bat_date">
<exp>Letzte Aktualisierung</exp>
</expression>
<expression id="plugin_bat_003" name="bat_design_capacity">
<expression id="plugin_bat_002" name="bat_design_capacity">
<exp>Bemeskapazität</exp>
</expression>
<expression id="plugin_bat_004" name="bat_remaining_capacity">
<expression id="plugin_bat_003" name="bat_remaining_capacity">
<exp>Übrige Kapazität</exp>
</expression>
<expression id="plugin_bat_005" name="bat_design_voltage">
<expression id="plugin_bat_004" name="bat_design_voltage">
<exp>Bemessungsspannung</exp>
</expression>
<expression id="plugin_bat_006" name="bat_present_voltage">
<expression id="plugin_bat_005" name="bat_present_voltage">
<exp>Momentane Spannung</exp>
</expression>
<expression id="plugin_bat_007" name="bat_item">
<exp>Dinge</exp>
<expression id="plugin_bat_006" name="bat_battery">
<exp>Akku</exp>
</expression>
<expression id="plugin_bat_008" name="bat_value">
<exp>Werte</exp>
<expression id="plugin_bat_007" name="bat_value">
<exp>Wert</exp>
</expression>
<expression id="plugin_bat_009" name="bat_charging_state">
<expression id="plugin_bat_008" name="bat_charging_state">
<exp>Ladezustand</exp>
</expression>
<expression id="plugin_bat_010" name="bat_battery_type">
<expression id="plugin_bat_009" name="bat_battery_type">
<exp>Akku-Typ</exp>
</expression>
<expression id="plugin_bat_011" name="bat_battery_temperature">
<expression id="plugin_bat_010" name="bat_battery_temperature">
<exp>Akku-Temperatur</exp>
</expression>
<expression id="plugin_bat_012" name="bat_battery_condition">
<expression id="plugin_bat_011" name="bat_battery_condition">
<exp>Akku-Zustand</exp>
</expression>
<expression id="plugin_bat_013" name="bat_cycle_count">
<expression id="plugin_bat_012" name="bat_cycle_count">
<exp>Cycle Count</exp>
</expression>
<expression id="plugin_bat_013" name="bat_full_capacity">
<exp>Volle Kapazität</exp>
</expression>
<expression id="plugin_bat_014" name="bat_manufacturer">
<exp>Manufacturer</exp>
</expression>
<expression id="plugin_bat_015" name="bat_model">
<exp>Model</exp>
</expression>
<expression id="plugin_bat_016" name="bat_serialnumber">
<exp>Serial Number</exp>
</expression>
</tns:translationPlugin>

View File

@@ -9,40 +9,49 @@
<expression id="plugin_bat_001" name="bat_title">
<exp>Battery Status</exp>
</expression>
<expression id="plugin_bat_002" name="bat_date">
<exp>Last refresh</exp>
</expression>
<expression id="plugin_bat_003" name="bat_design_capacity">
<expression id="plugin_bat_002" name="bat_design_capacity">
<exp>Design capacity</exp>
</expression>
<expression id="plugin_bat_004" name="bat_remaining_capacity">
<expression id="plugin_bat_003" name="bat_remaining_capacity">
<exp>Remaining capacity</exp>
</expression>
<expression id="plugin_bat_005" name="bat_design_voltage">
<expression id="plugin_bat_004" name="bat_design_voltage">
<exp>Design voltage</exp>
</expression>
<expression id="plugin_bat_006" name="bat_present_voltage">
<expression id="plugin_bat_005" name="bat_present_voltage">
<exp>Present voltage</exp>
</expression>
<expression id="plugin_bat_007" name="bat_item">
<exp>Items</exp>
<expression id="plugin_bat_006" name="bat_battery">
<exp>Battery</exp>
</expression>
<expression id="plugin_bat_008" name="bat_value">
<exp>Values</exp>
<expression id="plugin_bat_007" name="bat_value">
<exp>Value</exp>
</expression>
<expression id="plugin_bat_009" name="bat_charging_state">
<expression id="plugin_bat_008" name="bat_charging_state">
<exp>Charging state</exp>
</expression>
<expression id="plugin_bat_010" name="bat_battery_type">
<expression id="plugin_bat_009" name="bat_battery_type">
<exp>Battery Type</exp>
</expression>
<expression id="plugin_bat_011" name="bat_battery_temperature">
<expression id="plugin_bat_010" name="bat_battery_temperature">
<exp>Battery Temperature</exp>
</expression>
<expression id="plugin_bat_012" name="bat_battery_condition">
<expression id="plugin_bat_011" name="bat_battery_condition">
<exp>Battery Condition</exp>
</expression>
<expression id="plugin_bat_013" name="bat_cycle_count">
<expression id="plugin_bat_012" name="bat_cycle_count">
<exp>Cycle Count</exp>
</expression>
<expression id="plugin_bat_013" name="bat_full_capacity">
<exp>Full capacity</exp>
</expression>
<expression id="plugin_bat_014" name="bat_manufacturer">
<exp>Manufacturer</exp>
</expression>
<expression id="plugin_bat_015" name="bat_model">
<exp>Model</exp>
</expression>
<expression id="plugin_bat_016" name="bat_serialnumber">
<exp>Serial Number</exp>
</expression>
</tns:translationPlugin>

View File

@@ -9,40 +9,49 @@
<expression id="plugin_bat_001" name="bat_title">
<exp>Etat des batteries</exp>
</expression>
<expression id="plugin_bat_002" name="bat_date">
<exp>Dernière actualisation</exp>
</expression>
<expression id="plugin_bat_003" name="bat_design_capacity">
<expression id="plugin_bat_002" name="bat_design_capacity">
<exp>Capacité d'origine</exp>
</expression>
<expression id="plugin_bat_004" name="bat_remaining_capacity">
<expression id="plugin_bat_003" name="bat_remaining_capacity">
<exp>Capacité restante</exp>
</expression>
<expression id="plugin_bat_005" name="bat_design_voltage">
<expression id="plugin_bat_004" name="bat_design_voltage">
<exp>Tension d'origine</exp>
</expression>
<expression id="plugin_bat_006" name="bat_present_voltage">
<expression id="plugin_bat_005" name="bat_present_voltage">
<exp>Tension actuelle</exp>
</expression>
<expression id="plugin_bat_007" name="bat_item">
<expression id="plugin_bat_006" name="bat_battery">
<exp>Elements</exp>
</expression>
<expression id="plugin_bat_008" name="bat_value">
<exp>Valeurs</exp>
<expression id="plugin_bat_007" name="bat_value">
<exp>Valeur</exp>
</expression>
<expression id="plugin_bat_009" name="bat_charging_state">
<expression id="plugin_bat_008" name="bat_charging_state">
<exp>Etat</exp>
</expression>
<expression id="plugin_bat_010" name="bat_battery_type">
<expression id="plugin_bat_009" name="bat_battery_type">
<exp>Battery Type</exp>
</expression>
<expression id="plugin_bat_011" name="bat_battery_temperature">
<expression id="plugin_bat_010" name="bat_battery_temperature">
<exp>Battery Temperature</exp>
</expression>
<expression id="plugin_bat_012" name="bat_battery_condition">
<expression id="plugin_bat_011" name="bat_battery_condition">
<exp>Battery Condition</exp>
</expression>
<expression id="plugin_bat_013" name="bat_cycle_count">
<expression id="plugin_bat_012" name="bat_cycle_count">
<exp>Cycle Count</exp>
</expression>
<expression id="plugin_bat_013" name="bat_full_capacity">
<exp>Capacité pleine</exp>
</expression>
<expression id="plugin_bat_014" name="bat_manufacturer">
<exp>Manufacturer</exp>
</expression>
<expression id="plugin_bat_015" name="bat_model">
<exp>Model</exp>
</expression>
<expression id="plugin_bat_016" name="bat_serialnumber">
<exp>Serial Number</exp>
</expression>
</tns:translationPlugin>

View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: gr.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: Greek Created by: ChriZathens
-->
<tns:translationPlugin language="greek" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_bat_001" name="bat_title">
<exp>Κατάσταση Μπαταρίας</exp>
</expression>
<expression id="plugin_bat_002" name="bat_design_capacity">
<exp>Εργοστασιακή χωρητικότητα</exp>
</expression>
<expression id="plugin_bat_003" name="bat_remaining_capacity">
<exp>Εναπομείνουσα χωρητικότητα</exp>
</expression>
<expression id="plugin_bat_004" name="bat_design_voltage">
<exp>Εργοστασιακή τάση</exp>
</expression>
<expression id="plugin_bat_005" name="bat_present_voltage">
<exp>Τρέχουσα τάση</exp>
</expression>
<expression id="plugin_bat_006" name="bat_battery">
<exp>Μπαταρία</exp>
</expression>
<expression id="plugin_bat_007" name="bat_value">
<exp>Τιμή</exp>
</expression>
<expression id="plugin_bat_008" name="bat_charging_state">
<exp>Κατάσταση φόρτισης</exp>
</expression>
<expression id="plugin_bat_009" name="bat_battery_type">
<exp>Τύπος Μπαταρίας</exp>
</expression>
<expression id="plugin_bat_010" name="bat_battery_temperature">
<exp>Θερμοκρασία Μπαταρίας</exp>
</expression>
<expression id="plugin_bat_011" name="bat_battery_condition">
<exp>Κατάσταση Μπαταρίας</exp>
</expression>
<expression id="plugin_bat_012" name="bat_cycle_count">
<exp>Κύκλοι φόρτισης</exp>
</expression>
<expression id="plugin_bat_013" name="bat_full_capacity">
<exp>Πλήρης χωρητικότητα</exp>
</expression>
<expression id="plugin_bat_014" name="bat_manufacturer">
<exp>Κατασκευαστής</exp>
</expression>
<expression id="plugin_bat_015" name="bat_model">
<exp>Μοντέλο</exp>
</expression>
<expression id="plugin_bat_016" name="bat_serialnumber">
<exp>Σειριακός Αριθμός</exp>
</expression>
</tns:translationPlugin>

View File

@@ -9,40 +9,49 @@
<expression id="plugin_bat_001" name="bat_title">
<exp>Status Baterii</exp>
</expression>
<expression id="plugin_bat_002" name="bat_date">
<exp>Ostatnie odświeżenie</exp>
</expression>
<expression id="plugin_bat_003" name="bat_design_capacity">
<expression id="plugin_bat_002" name="bat_design_capacity">
<exp>Pojemność znamionowa</exp>
</expression>
<expression id="plugin_bat_004" name="bat_remaining_capacity">
<expression id="plugin_bat_003" name="bat_remaining_capacity">
<exp>Pojemność aktualna</exp>
</expression>
<expression id="plugin_bat_005" name="bat_design_voltage">
<expression id="plugin_bat_004" name="bat_design_voltage">
<exp>Napięcie znamionowe</exp>
</expression>
<expression id="plugin_bat_006" name="bat_present_voltage">
<expression id="plugin_bat_005" name="bat_present_voltage">
<exp>Napięcie aktualne</exp>
</expression>
<expression id="plugin_bat_007" name="bat_item">
<exp>Parametry</exp>
<expression id="plugin_bat_006" name="bat_battery">
<exp>Bateria</exp>
</expression>
<expression id="plugin_bat_008" name="bat_value">
<exp>Wartości</exp>
<expression id="plugin_bat_007" name="bat_value">
<exp>Wartość</exp>
</expression>
<expression id="plugin_bat_009" name="bat_charging_state">
<expression id="plugin_bat_008" name="bat_charging_state">
<exp>Stan ładowania</exp>
</expression>
<expression id="plugin_bat_010" name="bat_battery_type">
<expression id="plugin_bat_009" name="bat_battery_type">
<exp>Typ ogniw</exp>
</expression>
<expression id="plugin_bat_011" name="bat_battery_temperature">
<expression id="plugin_bat_010" name="bat_battery_temperature">
<exp>Temperatura ogniw</exp>
</expression>
<expression id="plugin_bat_012" name="bat_battery_condition">
<expression id="plugin_bat_011" name="bat_battery_condition">
<exp>Kondycja ogniw</exp>
</expression>
<expression id="plugin_bat_013" name="bat_cycle_count">
<expression id="plugin_bat_012" name="bat_cycle_count">
<exp>Cykli ładowania</exp>
</expression>
<expression id="plugin_bat_013" name="bat_full_capacity">
<exp>Pojemność pełna</exp>
</expression>
<expression id="plugin_bat_014" name="bat_manufacturer">
<exp>Producent</exp>
</expression>
<expression id="plugin_bat_015" name="bat_model">
<exp>Model</exp>
</expression>
<expression id="plugin_bat_016" name="bat_serialnumber">
<exp>Numer seryjny</exp>
</expression>
</tns:translationPlugin>

View File

@@ -9,40 +9,49 @@
<expression id="plugin_bat_001" name="bat_title">
<exp>Stare Baterie</exp>
</expression>
<expression id="plugin_bat_002" name="bat_date">
<exp>Ultimul refresh</exp>
</expression>
<expression id="plugin_bat_003" name="bat_design_capacity">
<expression id="plugin_bat_002" name="bat_design_capacity">
<exp>Capacitate Design</exp>
</expression>
<expression id="plugin_bat_004" name="bat_remaining_capacity">
<expression id="plugin_bat_003" name="bat_remaining_capacity">
<exp>Capacitate rămasă</exp>
</expression>
<expression id="plugin_bat_005" name="bat_design_voltage">
<expression id="plugin_bat_004" name="bat_design_voltage">
<exp>Voltaj design</exp>
</expression>
<expression id="plugin_bat_006" name="bat_present_voltage">
<expression id="plugin_bat_005" name="bat_present_voltage">
<exp>Voltaj prezent</exp>
</expression>
<expression id="plugin_bat_007" name="bat_item">
<exp>Elemente</exp>
<expression id="plugin_bat_006" name="bat_battery">
<exp>Baterie</exp>
</expression>
<expression id="plugin_bat_008" name="bat_value">
<exp>Valori</exp>
<expression id="plugin_bat_007" name="bat_value">
<exp>valoare</exp>
</expression>
<expression id="plugin_bat_009" name="bat_charging_state">
<expression id="plugin_bat_008" name="bat_charging_state">
<exp>Stare de Încărcare</exp>
</expression>
<expression id="plugin_bat_010" name="bat_battery_type">
<expression id="plugin_bat_009" name="bat_battery_type">
<exp>Tip Baterie</exp>
</expression>
<expression id="plugin_bat_011" name="bat_battery_temperature">
<expression id="plugin_bat_010" name="bat_battery_temperature">
<exp>Temperatura Baterie</exp>
</expression>
<expression id="plugin_bat_012" name="bat_battery_condition">
<expression id="plugin_bat_011" name="bat_battery_condition">
<exp>Condiții Baterie</exp>
</expression>
<expression id="plugin_bat_013" name="bat_cycle_count">
<expression id="plugin_bat_012" name="bat_cycle_count">
<exp>Cycle Count</exp>
</expression>
<expression id="plugin_bat_013" name="bat_full_capacity">
<exp>Capacitate maximă</exp>
</expression>
<expression id="plugin_bat_014" name="bat_manufacturer">
<exp>Manufacturer</exp>
</expression>
<expression id="plugin_bat_015" name="bat_model">
<exp>Model</exp>
</expression>
<expression id="plugin_bat_016" name="bat_serialnumber">
<exp>Serial Number</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: en.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!-- $Id: ru.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: Russian Created by: Denis Sevostyanov (den007)
-->
@@ -9,40 +9,49 @@
<expression id="plugin_bat_001" name="bat_title">
<exp>Состояние батареи</exp>
</expression>
<expression id="plugin_bat_002" name="bat_date">
<exp>Последние обновление</exp>
</expression>
<expression id="plugin_bat_003" name="bat_design_capacity">
<expression id="plugin_bat_002" name="bat_design_capacity">
<exp>Проектная мощность</exp>
</expression>
<expression id="plugin_bat_004" name="bat_remaining_capacity">
<expression id="plugin_bat_003" name="bat_remaining_capacity">
<exp>Оставшийся объем</exp>
</expression>
<expression id="plugin_bat_005" name="bat_design_voltage">
<expression id="plugin_bat_004" name="bat_design_voltage">
<exp>Проектное напряжение</exp>
</expression>
<expression id="plugin_bat_006" name="bat_present_voltage">
<expression id="plugin_bat_005" name="bat_present_voltage">
<exp>Фактическое напряжение</exp>
</expression>
<expression id="plugin_bat_007" name="bat_item">
<exp>Элементы</exp>
<expression id="plugin_bat_006" name="bat_battery">
<exp>Aккумулятор</exp>
</expression>
<expression id="plugin_bat_008" name="bat_value">
<expression id="plugin_bat_007" name="bat_value">
<exp>Значение</exp>
</expression>
<expression id="plugin_bat_009" name="bat_charging_state">
<expression id="plugin_bat_008" name="bat_charging_state">
<exp>Состояние зарядки</exp>
</expression>
<expression id="plugin_bat_010" name="bat_battery_type">
<expression id="plugin_bat_009" name="bat_battery_type">
<exp>Тип батареи</exp>
</expression>
<expression id="plugin_bat_011" name="bat_battery_temperature">
<expression id="plugin_bat_010" name="bat_battery_temperature">
<exp>Температура батареи</exp>
</expression>
<expression id="plugin_bat_012" name="bat_battery_condition">
<expression id="plugin_bat_011" name="bat_battery_condition">
<exp>Состояние аккумулятора</exp>
</expression>
<expression id="plugin_bat_013" name="bat_cycle_count">
<expression id="plugin_bat_012" name="bat_cycle_count">
<exp>Циклы</exp>
</expression>
<expression id="plugin_bat_013" name="bat_full_capacity">
<exp>Полная мощность</exp>
</expression>
<expression id="plugin_bat_014" name="bat_manufacturer">
<exp>Manufacturer</exp>
</expression>
<expression id="plugin_bat_015" name="bat_model">
<exp>Model</exp>
</expression>
<expression id="plugin_bat_016" name="bat_serialnumber">
<exp>Serial Number</exp>
</expression>
</tns:translationPlugin>

View File

@@ -0,0 +1,76 @@
<?php
/**
* DiskLoad Plugin, which displays disks load
*
* @category PHP
* @package PSI_Plugin_DiskLoad
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
* @copyright 2023 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version $Id: class.diskload.inc.php 661 2023-02-10 09:13:52Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
class DiskLoad extends PSI_Plugin
{
/**
* variable, which holds the result before the xml is generated out of this array
* @var array
*/
private $_result;
/**
* read the data into an internal array and also call the parent constructor
*
* @param String $enc encoding
*/
public function __construct($enc)
{
parent::__construct(__CLASS__, $enc);
$this->_result = array();
}
/**
* doing all tasks to get the required informations that the plugin needs
* result is stored in an internal array
*
* @return void
*/
public function execute()
{
if (((PSI_OS == 'WINNT') && !defined('PSI_EMU_HOSTNAME')) || (defined('PSI_EMU_HOSTNAME') && !defined('PSI_EMU_PORT'))) {
$diskphys = array();
$disklogi = array();
try {
$wmi = WINNT::getcimv2wmi();
$diskphys = WINNT::getWMI($wmi, 'Win32_PerfFormattedData_PerfDisk_PhysicalDisk', array('Name', 'PercentIdleTime'));
$disklogi = WINNT::getWMI($wmi, 'Win32_PerfFormattedData_PerfDisk_LogicalDisk', array('Name', 'PercentIdleTime'));
} catch (Exception $e) {
}
foreach ($diskphys as $disk_item) if (isset($disk_item['Name']) && (trim($disk_item['Name']) !== '') && (trim($disk_item['Name']) !== '_Total') && isset($disk_item['PercentIdleTime']) && (trim($disk_item['PercentIdleTime']) !== '')) {
$this->_result[] = $disk_item;
}
foreach ($disklogi as $disk_item) if (isset($disk_item['Name']) && (trim($disk_item['Name']) !== '') && (trim($disk_item['Name']) !== '_Total') && isset($disk_item['PercentIdleTime']) && (trim($disk_item['PercentIdleTime']) !== '')) {
$this->_result[] = $disk_item;
}
}
}
/**
* generates the XML content for the plugin
*
* @return SimpleXMLElement entire XML content for the plugin
*/
public function xml()
{
foreach ($this->_result as $disk_item) {
$xmldiskload_disk = $this->xml->addChild("Disk");
$xmldiskload_disk ->addAttribute('Name', trim($disk_item['Name']));
$xmldiskload_disk ->addAttribute('Load', min(max(100 - trim($disk_item['PercentIdleTime']), 0), 100));
}
return $this->xml->getSimpleXmlElement();
}
}

View File

@@ -0,0 +1,26 @@
<div class="col-lg-6" id="block_diskload" style="display:none;">
<div class="card" id="panel_diskload" style="display:none;">
<div class="card-header"><span class="lang_plugin_diskload_001">Disk Load Information</span>
<span class="hostname_diskload"></span>
<div id="reload_diskload" class="reload" title="reload"></div>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="diskload" class="table table-hover table-sm">
<thead>
<tr>
<th id="diskload_Name"><span class="lang_plugin_diskload_002">Disk</span></th>
<th class="rightCell"><span class="lang_plugin_diskload_003">Load</span></th>
</tr>
</thead>
<tbody id="diskload-data">
<tr>
<th><span data-bind="Name"></span></th>
<td><span data-bind="Load"></span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,115 @@
/***************************************************************************
* Copyright (C) 2008 by phpSysInfo - A PHP System Information Script *
* http://phpsysinfo.sourceforge.net/ *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
//
// $Id: diskload.js 661 2012-08-27 11:26:39Z namiltd $
//
/*global $, jQuery, buildBlock, datetime, plugin_translate, genlang */
"use strict";
var diskload_show = false;
/**
* insert content into table
* @param {jQuery} xml plugin-XML
*/
function diskload_populate(xml) {
var html = "", datetimeFormat = "", hostname = "";
hostname = $("Plugins Plugin_DiskLoad", xml).attr('Hostname');
if (hostname !== undefined) {
$('span[class=Hostname_diskload]').html(hostname);
}
$("Options", xml).each(function getByteFormat(id) {
datetimeFormat = $(this).attr("datetimeFormat");
});
$("Plugins Plugin_DiskLoad Disk", xml).each(function diskload_getDisk(idp) {
html += " <tr>\n";
html += " <td style=\"font-weight:normal\">" + $(this).attr("Name") + "</td>\n";
html += " <td style=\"font-weight:normal\">" + createBar($(this).attr("Load")) + "</td>\n";
html += " </tr>\n";
diskload_show = true;
});
$("#Plugin_DiskLoadTable-tbody").empty().append(html);
$('#Plugin_DiskLoadTable tr:nth-child(even)').addClass('even');
}
/**
* build the table where content is inserted
* @param {jQuery} xml plugin-XML
*/
function diskload_buildTable(xml) {
var html = "";
html += "<div style=\"overflow-x:auto;\">\n";
html += " <table id=\"Plugin_DiskLoadTable\" class=\"stripeMe\" style=\"border-collapse:collapse;\">\n";
html += " <thead>\n";
html += " <tr>\n";
html += " <th>" + genlang(2, "diskload") + "</th>\n";
html += " <th style=\"width:37%;\">" + genlang(3, "diskload") + "</th>\n";
html += " </tr>\n";
html += " </thead>\n";
html += " <tbody id=\"Plugin_DiskLoadTable-tbody\">\n";
html += " </tbody>\n";
html += " </table>\n";
html += "</div>\n";
$("#Plugin_DiskLoad").append(html);
}
/**
* load the xml via ajax
*/
function diskload_request() {
$("#Reload_DiskLoadTable").attr("title", "reload");
$.ajax({
url: "xml.php?plugin=DiskLoad",
dataType: "xml",
error: function diskload_error() {
$.jGrowl("Error loading XML document for Plugin DiskLoad!");
},
success: function diskload_buildblock(xml) {
populateErrors(xml);
diskload_populate(xml);
if (diskload_show) {
plugin_translate("DiskLoad");
$("#Plugin_DiskLoad").show();
}
}
});
}
$(document).ready(function diskload_buildpage() {
$("#footer").before(buildBlock("DiskLoad", 1, true));
$("#Plugin_DiskLoad").addClass("halfsize");
diskload_buildTable();
diskload_request();
$("#Reload_DiskLoadTable").click(function diskload_reload(id) {
diskload_request();
$(this).attr("title", datetime());
});
});

View File

@@ -0,0 +1,28 @@
function renderPlugin_diskload(data) {
var directives = {
Load: {
html: function () {
return '<div class="progress"><div class="progress-bar progress-bar-info" style="width:' + this.Load + '%;"></div>' +
'</div><div class="percent">' + this.Load + '%</div>';
}
}
};
if (data.Plugins.Plugin_DiskLoad !== undefined) {
var disks = items(data.Plugins.Plugin_DiskLoad.Disk);
if (disks.length > 0) {
var do_disks = [];
do_disks.push_attrs(disks);
$('#diskload-data').render(do_disks, directives);
//$('#diskload_Name').removeClass("sorttable_sorted"); // reset sort order
//sorttable.innerSortFunction.apply($('#diskload_Name')[0], []);
$('#block_diskload').show();
} else {
$('#block_diskload').hide();
}
} else {
$('#block_diskload').hide();
}
}

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: en.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: English Created by: Mieczyslaw Nalewaj
-->
<tns:translationPlugin language="english" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_diskload_001" name="diskload_title">
<exp>Disk Load Information</exp>
</expression>
<expression id="plugin_diskload_002" name="diskload_disk">
<exp>Disk</exp>
</expression>
<expression id="plugin_diskload_003" name="diskload_load">
<exp>Load percent</exp>
</expression>
</tns:translationPlugin>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: pl.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: Polish Created by: Mieczyslaw Nalewaj
-->
<tns:translationPlugin language="polish" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_diskload_001" name="diskload_title">
<exp>Informacja o obciążeniu dysków</exp>
</expression>
<expression id="plugin_diskload_002" name="diskload_disk">
<exp>Dysk</exp>
</expression>
<expression id="plugin_diskload_003" name="diskload_load">
<exp>Obciążenie</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,176 +0,0 @@
<?php
/**
* DMRaid Plugin
*
* PHP version 5
*
* @category PHP
* @package PSI_Plugin_DMRaid
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @version SVN: $Id: class.dmraid.inc.php 661 2012-08-27 11:26:39Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* dmraid Plugin, which displays software RAID status
*
* @category PHP
* @package PSI_Plugin_DMRaid
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class DMRaid extends PSI_Plugin
{
/**
* variable, which holds the content of the command
* @var array
*/
private $_filecontent = "";
/**
* variable, which holds the result before the xml is generated out of this array
* @var array
*/
private $_result = array();
/**
* read the data into an internal array and also call the parent constructor
*
* @param String $enc encoding
*/
public function __construct($enc)
{
$buffer = "";
parent::__construct(__CLASS__, $enc);
switch (strtolower(PSI_PLUGIN_DMRAID_ACCESS)) {
case 'command':
CommonFunctions::executeProgram("dmraid", "-s -vv 2>&1", $buffer);
break;
case 'data':
CommonFunctions::rfts(APP_ROOT."/data/dmraid.txt", $buffer);
break;
default:
$this->global_error->addConfigError("__construct()", "PSI_PLUGIN_DMRAID_ACCESS");
break;
}
if (trim($buffer) != "") {
$this->_filecontent = preg_split("/(\r?\n\*\*\* )|(\r?\n--> )/", $buffer, -1, PREG_SPLIT_NO_EMPTY);
} else {
$this->_filecontent = array();
}
}
/**
* doing all tasks to get the required informations that the plugin needs
* result is stored in an internal array<br>the array is build like a tree,
* so that it is possible to get only a specific process with the childs
*
* @return void
*/
public function execute()
{
if (empty($this->_filecontent)) {
return;
}
$group = "";
foreach ($this->_filecontent as $block) {
if (preg_match('/^(NOTICE: )|(ERROR: )/m', $block)) {
$group = "";
$lines = preg_split("/\r?\n/", $block, -1, PREG_SPLIT_NO_EMPTY);
foreach ($lines as $line) {
if (preg_match('/^NOTICE: added\s+\/dev\/(.+)\s+to RAID set\s+\"(.+)\"/', $line, $partition)) {
$this->_result['devices'][$partition[2]]['partitions'][$partition[1]]['status'] = "";
} elseif (preg_match('/^ERROR: .* device\s+\/dev\/(.+)\s+(.+)\s+in RAID set\s+\"(.+)\"/', $line, $partition)) {
if ($partition[2]=="broken") {
$this->_result['devices'][$partition[3]]['partitions'][$partition[1]]['status'] = 'F';
} else {
$this->_result['devices'][$partition[3]]['partitions'][$partition[1]]['status'] = 'W';
}
}
}
} else {
if (preg_match('/^Group superset\s+(.+)/m', $block, $arrname)) {
$group = trim($arrname[1]);
}
if (preg_match('/^name\s*:\s*(.*)/m', $block, $arrname)) {
if ($group=="") {
$group = trim($arrname[1]);
}
$this->_result['devices'][$group]['name'] = $arrname[1];
if (preg_match('/^size\s*:\s*(.*)/m', $block, $size)) {
$this->_result['devices'][$group]['size'] = trim($size[1]);
}
if (preg_match('/^stride\s*:\s*(.*)/m', $block, $stride)) {
$this->_result['devices'][$group]['stride'] = trim($stride[1]);
}
if (preg_match('/^type\s*:\s*(.*)/m', $block, $type)) {
$this->_result['devices'][$group]['type'] = trim($type[1]);
}
if (preg_match('/^status\s*:\s*(.*)/m', $block, $status)) {
$this->_result['devices'][$group]['status'] = trim($status[1]);
}
if (preg_match('/^subsets\s*:\s*(.*)/m', $block, $subsets)) {
$this->_result['devices'][$group]['subsets'] = trim($subsets[1]);
}
if (preg_match('/^devs\s*:\s*(.*)/m', $block, $devs)) {
$this->_result['devices'][$group]['devs'] = trim($devs[1]);
}
if (preg_match('/^spares\s*:\s*(.*)/m', $block, $spares)) {
$this->_result['devices'][$group]['spares'] = trim($spares[1]);
}
$group = "";
}
}
}
}
/**
* generates the XML content for the plugin
*
* @return SimpleXMLObject entire XML content for the plugin
*/
public function xml()
{
if (empty($this->_result)) {
return $this->xml->getSimpleXmlElement();
}
$hideRaids = array();
if (defined('PSI_PLUGIN_DMRAID_HIDE_RAID_DEVICES') && is_string(PSI_PLUGIN_DMRAID_HIDE_RAID_DEVICES)) {
if (preg_match(ARRAY_EXP, PSI_PLUGIN_DMRAID_HIDE_RAID_DEVICES)) {
$hideRaids = eval(PSI_PLUGIN_DMRAID_HIDE_RAID_DEVICES);
} else {
$hideRaids = array(PSI_PLUGIN_DMRAID_HIDE_RAID_DEVICES);
}
}
foreach ($this->_result['devices'] as $key=>$device) {
if (!in_array($key, $hideRaids, true)) {
$dev = $this->xml->addChild("Raid");
$dev->addAttribute("Device_Name", $key);
$dev->addAttribute("Type", $device["type"]);
$dev->addAttribute("Disk_Status", $device["status"]);
$dev->addAttribute("Name", $device["name"]);
$dev->addAttribute("Size", $device["size"]);
$dev->addAttribute("Stride", $device["stride"]);
$dev->addAttribute("Subsets", $device["subsets"]);
$dev->addAttribute("Devs", $device["devs"]);
$dev->addAttribute("Spares", $device["spares"]);
$disks = $dev->addChild("Disks");
if (isset($device['partitions']) && sizeof($device['partitions']>0)) foreach ($device['partitions'] as $diskkey=>$disk) {
$disktemp = $disks->addChild("Disk");
$disktemp->addAttribute("Name", $diskkey);
if ($device["status"]=='ok') {
$disktemp->addAttribute("Status", $disk['status']);
} else {
$disktemp->addAttribute("Status", 'W');
}
}
}
}
return $this->xml->getSimpleXmlElement();
}
}

View File

@@ -1,14 +0,0 @@
/*
$Id: dmraid.css 661 2012-08-27 11:26:39Z namiltd $
*/
.plugin_dmraid_biun {
text-align: center;
margin-bottom: 5px;
margin-right: 20px;
float: left;
width: 64px;
}
img.plugin_dmraid_biun {
margin: auto;
}

View File

@@ -1,9 +0,0 @@
<div class="col-lg-12" id="block_dmraid" style="display:none">
<div class="panel panel-primary">
<div class="panel-heading">RAID Status</div>
<div class="panel-body">
<table id="dmraid" class="table borderless table-condensed">
</table>
</div>
</div>
</div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -1,176 +0,0 @@
/***************************************************************************
* Copyright (C) 2008 by phpSysInfo - A PHP System Information Script *
* http://phpsysinfo.sourceforge.net/ *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
//
// $Id: dmraid.js 679 2012-09-04 10:10:11Z namiltd $
//
/*global $, jQuery, buildBlock, genlang, createBar, plugin_translate, datetime */
"use strict";
var dmraid_show = false;
/**
* get the details of the raid
* @param {jQuery} xml part of the plugin-XML
* @param {number} id id of the device
*/
function dmraid_buildinfos(xml, id) {
var html = "", devname = "", devstatus = "", devtype = "",devsize = 0, devstride = 0, devsubsets = 0, devdevs = 0, devspares = 0, button = "";
devname = $(xml).attr("Name");
devstatus = $(xml).attr("Disk_Status");
devtype = $(xml).attr("Type");
devsize = parseInt($(xml).attr("Size"), 10);
devstride = parseInt($(xml).attr("Stride"), 10);
devsubsets = parseInt($(xml).attr("Subsets"), 10);
devdevs = parseInt($(xml).attr("Devs"), 10);
devspares = parseInt($(xml).attr("Spares"), 10);
html += "<tr><td>" + genlang(4, false, "DMRaid") + "</td><td>" + devname + "</td></tr>";
html += "<tr><td>" + genlang(5, false, "DMRaid") + "</td><td>" + devstatus + "</td></tr>";
html += "<tr><td>" + genlang(6, false, "DMRaid") + "</td><td>" + devtype + "</td></tr>";
html += "<tr><td>" + genlang(7, false, "DMRaid") + "</td><td>" + devsize + "</td></tr>";
html += "<tr><td>" + genlang(8, false, "DMRaid") + "</td><td>" + devstride + "</td></tr>";
html += "<tr><td>" + genlang(9, false, "DMRaid") + "</td><td>" + devsubsets + "</td></tr>";
html += "<tr><td>" + genlang(10, false, "DMRaid") + "</td><td>" + devdevs + "</td></tr>";
html += "<tr><td>" + genlang(11, false, "DMRaid") + "</td><td>" + devspares + "</td></tr>";
button += "<h3 style=\"cursor: pointer\" id=\"sPlugin_DMRaid_Info" + id + "\"><img src=\"./gfx/bullet_toggle_plus.png\" alt=\"plus\" style=\"vertical-align:middle;\" />" + genlang(3, false, "DMRaid") + "</h3>";
button += "<h3 style=\"cursor: pointer; display: none;\" id=\"hPlugin_DMRaid_Info" + id + "\"><img src=\"./gfx/bullet_toggle_minus.png\" alt=\"minus\" style=\"vertical-align:middle;\" />" + genlang(3, false, "DMRaid") + "</h3>";
button += "<table id=\"Plugin_DMRaid_InfoTable" + id + "\" style=\"border-spacing:0; display:none;\">" + html + "</table>";
return button;
}
/**
* choose the right diskdrive icon
* @param {jQuery} xml part of the plugin-XML
*/
function dmraid_diskicon(xml) {
var html = "";
$("Disks Disk", xml).each(function dmraid_getdisk(id) {
var diskstatus = "", diskname = "", img = "", alt = "";
html += "<div class=\"plugin_dmraid_biun\">";
diskstatus = $(this).attr("Status");
diskname = $(this).attr("Name");
switch (diskstatus) {
case " ":
case "":
img = "harddriveok.png";
alt = "ok";
break;
case "F":
img = "harddrivefail.png";
alt = "fail";
break;
case "S":
img = "harddrivespare.png";
alt = "spare";
break;
case "W":
img = "harddrivewarn.png";
alt = "fail";
break;
default:
alert("--" + diskstatus + "--");
img = "error.png";
alt = "error";
break;
}
html += "<img class=\"plugin_dmraid_biun\" src=\"./plugins/dmraid/gfx/" + img + "\" alt=\"" + alt + "\" />";
html += "<small>" + diskname + "</small>";
html += "</div>";
});
return html;
}
/**
* fill the plugin block
* @param {jQuery} xml plugin-XML
*/
function dmraid_populate(xml) {
var htmltypes = "";
$("#Plugin_DMRaidTable").empty();
$("Plugins Plugin_DMRaid Raid", xml).each(function dmraid_getdevice(id) {
var htmldisks = "", htmldisklist = "", topic = "", name = "", buildedaction = "";
name = $(this).attr("Device_Name");
htmldisklist += dmraid_diskicon(this);
htmldisks += "<table style=\"width:100%;\">";
htmldisks += "<tr><td>" + htmldisklist + "</td></tr>";
htmldisks += "<tr><td>" + dmraid_buildinfos($(this), id) + "<td></tr>";
htmldisks += "</table>";
if (id) {
topic = "";
}
else {
topic = genlang(2, false, "DMRaid");
}
$("#Plugin_DMRaidTable").append("<tr><td>" + topic + "</td><td><div class=\"plugin_dmraid_biun\" style=\"text-align:left;\"><b>" + name + "</b></div>" + htmldisks + "</td></tr>");
$("#sPlugin_DMRaid_Info" + id).click(function dmraid_showinfo() {
$("#Plugin_DMRaid_InfoTable" + id).slideDown("slow");
$("#sPlugin_DMRaid_Info" + id).hide();
$("#hPlugin_DMRaid_Info" + id).show();
});
$("#hPlugin_DMRaid_Info" + id).click(function dmraid_hideinfo() {
$("#Plugin_DMRaid_InfoTable" + id).slideUp("slow");
$("#hPlugin_DMRaid_Info" + id).hide();
$("#sPlugin_DMRaid_Info" + id).show();
});
dmraid_show = true;
});
}
/**
* load the xml via ajax
*/
function dmraid_request() {
$.ajax({
url: "xml.php?plugin=DMRaid",
dataType: "xml",
error: function dmraid_error() {
$.jGrowl("Error loading XML document for Plugin DMRaid");
},
success: function dmraid_buildblock(xml) {
populateErrors(xml);
dmraid_populate(xml);
if (dmraid_show) {
plugin_translate("DMRaid");
$("#Plugin_DMRaid").show();
}
}
});
}
$(document).ready(function dmraid_buildpage() {
var html = "";
$("#footer").before(buildBlock("DMRaid", 1, true));
html += " <table id=\"Plugin_DMRaidTable\" style=\"border-spacing:0;\">\n";
html += " </table>\n";
$("#Plugin_DMRaid").append(html);
$("#Plugin_DMRaid").css("width", "915px");
dmraid_request();
$("#Reload_DMRaidTable").click(function dmraid_reload(id) {
dmraid_request();
$("#Reload_DMRaidTable").attr("title",datetime());
});
});

View File

@@ -1,95 +0,0 @@
function renderPlugin_dmraid(data) {
function raid_diskicon(data) {
var html = "";
var img = "", alt = "";
html += "<div style=\"text-align: center; float: left; margin-bottom: 5px; margin-right: 20px; width: 64px;\">";
switch (data["Status"]) {
case " ":
case "":
img = "harddriveok.png";
alt = "ok";
break;
case "F":
img = "harddrivefail.png";
alt = "fail";
break;
case "S":
img = "harddrivespare.png";
alt = "spare";
break;
case "W":
img = "harddrivewarn.png";
alt = "warning";
break;
default:
alert("--" + data["Status"] + "--");
img = "error.png";
alt = "error";
break;
}
html += "<img src=\"./plugins/dmraid/gfx/" + img + "\" alt=\"" + alt + "\" />";
html += "<small>" + data["Name"] + "</small>";
html += "</div>";
return html;
}
if (data['Plugins']['Plugin_DMRaid'] !== undefined) {
var dmitems = items(data['Plugins']['Plugin_DMRaid']['Raid']);
if (dmitems.length > 0) {
var html = '';
for (i = 0; i < dmitems.length ; i++) {
if (i) {
html += "<tr><td></td><td>";
} else {
html += "<tr><th>RAID-Devices</th><td>";
}
if (dmitems[i]['Disks'] !== undefined) {
html += "<table style=\"width:100%;\">";
html += "<tr><td>";
var diskitems = items(dmitems[i]['Disks']['Disk']);
for (j = 0; j < diskitems.length ; j++) {
html += raid_diskicon(diskitems[j]["@attributes"]);
}
html += "</td></tr><tr><td>";
html += "<table id=\"dmraid-" + i + "\"class=\"table table-hover table-condensed\">";
html += "<tr class=\"treegrid-dmraid-" + i + "\"><td><b>" + dmitems[i]["@attributes"]["Device_Name"] + "</b></td><td></td></tr>";
html += "<tr class=\"treegrid-parent-dmraid-" + i + "\"><th>Name</td><td>" + dmitems[i]["@attributes"]["Name"] + "</td></tr>";
html += "<tr class=\"treegrid-parent-dmraid-" + i + "\"><th>Status</th><td>" + dmitems[i]["@attributes"]["Disk_Status"] + "</td></tr>";
html += "<tr class=\"treegrid-parent-dmraid-" + i + "\"><th>RAID-Type</th><td>" + dmitems[i]["@attributes"]["Type"] + "</td></tr>";
html += "<tr class=\"treegrid-parent-dmraid-" + i + "\"><th>Size</th><td>" + parseInt(dmitems[i]["@attributes"]["Size"]) + "</td></tr>";
html += "<tr class=\"treegrid-parent-dmraid-" + i + "\"><th>Stride</th><td>" + parseInt(dmitems[i]["@attributes"]["Stride"]) + "</td></tr>";
html += "<tr class=\"treegrid-parent-dmraid-" + i + "\"><th>Subsets</th><td>" + parseInt(dmitems[i]["@attributes"]["Subsets"]) + "</td></tr>";
html += "<tr class=\"treegrid-parent-dmraid-" + i + "\"><th>Devices</th><td>" + parseInt(dmitems[i]["@attributes"]["Devs"]) + "</td></tr>";
html += "<tr class=\"treegrid-parent-dmraid-" + i + "\"><th>Spares</th><td>" + parseInt(dmitems[i]["@attributes"]["Spares"]) + "</td></tr>";
html += "</table>";
html += "</td></tr>";
html += "</table>";
}
html +="</td></tr>";
}
$('#dmraid').empty().append(html);
for (i = 0; i < dmitems.length ; i++) {
if (dmitems[i]['Disks'] !== undefined) {
$('#dmraid-'+i).treegrid({
initialState: 'collapsed',
expanderExpandedClass: 'normalicon normalicon-down',
expanderCollapsedClass: 'normalicon normalicon-right'
});
}
}
$('#block_dmraid').show();
} else {
$('#block_dmraid').hide();
}
} else {
$('#block_dmraid').hide();
}
}

View File

@@ -1,42 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: en.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: English Created by: Michael Cramer
-->
<tns:translationPlugin language="english" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_dmraid_001" name="dmraid_title">
<exp>RAID Status</exp>
</expression>
<expression id="plugin_dmraid_002" name="dmraid_devices">
<exp>RAID-Devices</exp>
</expression>
<expression id="plugin_dmraid_003" name="dmraid_infos">
<exp>Additional Information </exp>
</expression>
<expression id="plugin_dmraid_004" name="dmraid_name">
<exp>Name</exp>
</expression>
<expression id="plugin_dmraid_005" name="dmraid_status">
<exp>Status</exp>
</expression>
<expression id="plugin_dmraid_006" name="dmraid_type">
<exp>RAID-Type</exp>
</expression>
<expression id="plugin_dmraid_007" name="dmraid_size">
<exp>Size</exp>
</expression>
<expression id="plugin_dmraid_008" name="dmraid_stride">
<exp>Stride</exp>
</expression>
<expression id="plugin_dmraid_009" name="dmraid_subsets">
<exp>Subsets</exp>
</expression>
<expression id="plugin_dmraid_010" name="dmraid_devs">
<exp>Devices</exp>
</expression>
<expression id="plugin_dmraid_011" name="dmraid_spares">
<exp>Spares</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
phpSysInfo language file Language: French Created by: phpsysinfo
-->
<tns:translationPlugin language="french" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_dmraid_001" name="dmraid_title">
<exp>Statut RAID</exp>
</expression>
<expression id="plugin_dmraid_002" name="dmraid_devices">
<exp>Périphériques RAID</exp>
</expression>
<expression id="plugin_dmraid_003" name="dmraid_infos">
<exp>Informations additionnelles</exp>
</expression>
<expression id="plugin_dmraid_004" name="dmraid_name">
<exp>Nom</exp>
</expression>
<expression id="plugin_dmraid_005" name="dmraid_status">
<exp>Status</exp>
</expression>
<expression id="plugin_dmraid_006" name="dmraid_type">
<exp>Type de RAID</exp>
</expression>
<expression id="plugin_dmraid_007" name="dmraid_size">
<exp>Taille</exp>
</expression>
<expression id="plugin_dmraid_008" name="dmraid_stride">
<exp>Granularité</exp>
</expression>
<expression id="plugin_dmraid_009" name="dmraid_subsets">
<exp>Sous-ensembles</exp>
</expression>
<expression id="plugin_dmraid_010" name="dmraid_devs">
<exp>Périphériques</exp>
</expression>
<expression id="plugin_dmraid_011" name="dmraid_spares">
<exp>Rechanges</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,42 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: ro.xml 661 2014-05-02 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: Romană Created by: Iulian Alexe
-->
<tns:translationPlugin language="romana" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_dmraid_001" name="dmraid_title">
<exp>Stare RAID</exp>
</expression>
<expression id="plugin_dmraid_002" name="dmraid_devices">
<exp>Dispozitive RAID</exp>
</expression>
<expression id="plugin_dmraid_003" name="dmraid_infos">
<exp>Informații Aditionale </exp>
</expression>
<expression id="plugin_dmraid_004" name="dmraid_name">
<exp>Nume</exp>
</expression>
<expression id="plugin_dmraid_005" name="dmraid_status">
<exp>Stare</exp>
</expression>
<expression id="plugin_dmraid_006" name="dmraid_type">
<exp>Tip RAID</exp>
</expression>
<expression id="plugin_dmraid_007" name="dmraid_size">
<exp>Dimensiune</exp>
</expression>
<expression id="plugin_dmraid_008" name="dmraid_stride">
<exp>Pas</exp>
</expression>
<expression id="plugin_dmraid_009" name="dmraid_subsets">
<exp>Subseturi</exp>
</expression>
<expression id="plugin_dmraid_010" name="dmraid_devs">
<exp>Dispozitive</exp>
</expression>
<expression id="plugin_dmraid_011" name="dmraid_spares">
<exp>Piese</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
phpSysInfo language file Language: Russian Created by: Denis Sevostyanov (den007)
-->
<tns:translationPlugin language="english" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_dmraid_001" name="dmraid_title">
<exp>RAID Статус</exp>
</expression>
<expression id="plugin_dmraid_002" name="dmraid_devices">
<exp>RAID-Устройств</exp>
</expression>
<expression id="plugin_dmraid_003" name="dmraid_infos">
<exp>Дополнительная Информация</exp>
</expression>
<expression id="plugin_dmraid_004" name="dmraid_name">
<exp>Имя</exp>
</expression>
<expression id="plugin_dmraid_005" name="dmraid_status">
<exp>Статус</exp>
</expression>
<expression id="plugin_dmraid_006" name="dmraid_type">
<exp>RAID-Тип</exp>
</expression>
<expression id="plugin_dmraid_007" name="dmraid_size">
<exp>Размер</exp>
</expression>
<expression id="plugin_dmraid_008" name="dmraid_stride">
<exp>Шаг</exp>
</expression>
<expression id="plugin_dmraid_009" name="dmraid_subsets">
<exp>Подмножество</exp>
</expression>
<expression id="plugin_dmraid_010" name="dmraid_devs">
<exp>Устройство</exp>
</expression>
<expression id="plugin_dmraid_011" name="dmraid_spares">
<exp>Резервировано</exp>
</expression>
</tns:translationPlugin>

View File

@@ -0,0 +1,134 @@
<?php
/**
* Docker plugin, which displays docker informations
*
* @category PHP
* @package PSI_Plugin_Docker
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
* @copyright 2014 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 1.0
* @link http://phpsysinfo.sourceforge.net
*/
class Docker extends PSI_Plugin
{
private $_lines;
public function __construct($enc)
{
parent::__construct(__CLASS__, $enc);
$this->_lines = array();
}
/**
* get docker information
*
* @return array docker in array with label
*/
private function getDocker()
{
$result = array();
$i = 0;
foreach ($this->_lines as $line) {
if ($i > 0) {
$buffer = preg_split("/\s\s+/", $line);
$result[$i]['Name'] = $buffer[0];
$result[$i]['CPUUsage'] = str_replace(',', '.', trim($buffer[1], '%'));
preg_match('/([\d\.]+)(B|KiB|MiB|GiB|TiB|PiB)\s+\/\s+([\d\.]+)(B|KiB|MiB|GiB|TiB|PiB)/', str_replace(',', '.', trim($buffer[2])), $tmpbuf);
switch ($tmpbuf[2]) {
case 'B':
$result[$i]['MemoryUsed'] = $tmpbuf[1];
break;
case 'KiB':
$result[$i]['MemoryUsed'] = 1024*$tmpbuf[1];
break;
case 'MiB':
$result[$i]['MemoryUsed'] = 1024*1024*$tmpbuf[1];
break;
case 'GiB':
$result[$i]['MemoryUsed'] = 1024*1024*1024*$tmpbuf[1];
break;
case 'TiB':
$result[$i]['MemoryUsed'] = 1024*1024*1024*1024*$tmpbuf[1];
break;
case 'PiB':
$result[$i]['MemoryUsed'] = 1024*1024*1024*1024*1025*$tmpbuf[1];
}
switch ($tmpbuf[4]) {
case 'B':
$result[$i]['MemoryLimit'] = $tmpbuf[3];
break;
case 'KiB':
$result[$i]['MemoryLimit'] = 1024*$tmpbuf[3];
break;
case 'MiB':
$result[$i]['MemoryLimit'] = 1024*1024*$tmpbuf[3];
break;
case 'GiB':
$result[$i]['MemoryLimit'] = 1024*1024*1024*$tmpbuf[3];
break;
case 'TiB':
$result[$i]['MemoryLimit'] = 1024*1024*1024*1024*$tmpbuf[3];
break;
case 'PiB':
$result[$i]['MemoryLimit'] = 1024*1024*1024*1024*1025*$tmpbuf[3];
}
$result[$i]['MemoryUsage'] = str_replace(',', '.', trim($buffer[3], '%'));
$result[$i]['NetIO'] = trim($buffer[4]);
$result[$i]['BlockIO'] = trim($buffer[5]);
$result[$i]['PIDs'] = trim($buffer[6]);
}
$i++;
}
return $result;
}
public function execute()
{
$this->_lines = array();
if ((PSI_OS != 'WINNT') && (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT'))) {
switch (strtolower(PSI_PLUGIN_DOCKER_ACCESS)) {
case 'command':
$lines = "";
if (CommonFunctions::executeProgram('docker', 'stats --no-stream --format \'table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}\t{{.NetIO}}\t{{.BlockIO}}\t{{.PIDs}}\'', $lines) && !empty($lines))
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
break;
case 'data':
if (!defined('PSI_EMU_HOSTNAME') && CommonFunctions::rftsdata("docker.tmp", $lines) && !empty($lines))
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
break;
default:
$this->global_error->addConfigError("execute()", "[docker] ACCESS");
}
}
}
public function xml()
{
if (empty($this->_lines))
return $this->xml->getSimpleXmlElement();
$arrBuff = $this->getDocker();
if (sizeof($arrBuff) > 0) {
$docker = $this->xml->addChild("Docker");
foreach ($arrBuff as $arrValue) {
$item = $docker->addChild('Item');
$item->addAttribute('Name', $arrValue['Name']);
$item->addAttribute('CPUUsage', $arrValue['CPUUsage']);
$item->addAttribute('MemoryUsage', $arrValue['MemoryUsage']);
$item->addAttribute('MemoryUsed', Round($arrValue['MemoryUsed']));
$item->addAttribute('MemoryLimit', Round($arrValue['MemoryLimit']));
$item->addAttribute('NetIO', $arrValue['NetIO']);
$item->addAttribute('BlockIO', $arrValue['BlockIO']);
$item->addAttribute('PIDs', $arrValue['PIDs']);
}
}
return $this->xml->getSimpleXmlElement();
}
}

View File

@@ -0,0 +1,38 @@
<div class="col-lg-12" id="block_docker" style="display:none;">
<div class="card" id="panel_docker" style="display:none;">
<div class="card-header"><span class="lang_plugin_docker_001">Docker</span>
<span class="hostname_docker"></span>
<div id="reload_docker" class="reload" title="reload"></div>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="docker" class="table table-hover table-sm sortable">
<thead>
<tr>
<th id="docker_Name"><span class="lang_plugin_docker_101">Name</span></th>
<th><span class="lang_plugin_docker_102">CPU Usage</span></th>
<th><span class="lang_plugin_docker_103">Memory Usage</span></th>
<th class="rightCell sorttable_numeric"><span class="lang_plugin_docker_104">Memory Used</span></th>
<th class="rightCell sorttable_numeric"><span class="lang_plugin_docker_105">Memory Limit</span></th>
<th class="rightCell"><span class="lang_plugin_docker_106">Net I/O</span></th>
<th class="rightCell"><span class="lang_plugin_docker_107">Block I/O</span></th>
<th class="rightCell sorttable_numeric"><span class="lang_plugin_docker_108">PIDs</span></th>
</tr>
</thead>
<tbody id="docker-data">
<tr>
<th><span data-bind="Name"></span></th>
<td><span data-bind="CPUUsage"></span></td>
<td><span data-bind="MemoryUsage"></span></td>
<td class="rightCell"><span data-bind="MemoryUsed"></span></td>
<td class="rightCell"><span data-bind="MemoryLimit"></span></td>
<td class="rightCell"><span data-bind="NetIO"></span></td>
<td class="rightCell"><span data-bind="BlockIO"></span></td>
<td class="rightCell"><span data-bind="PIDs"></span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,155 @@
/***************************************************************************
* Copyright (C) 2008 by phpSysInfo - A PHP System Information Script *
* http://phpsysinfo.sourceforge.net/ *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
//$Id: docker.js 661 2014-01-08 11:26:39 aolah76 $
/*global $, jQuery, buildBlock, datetime, plugin_translate, genlang, createBar */
"use strict";
var docker_show = false, docker_table;
/**
* insert content into table
* @param {jQuery} xml plugin-XML
*/
function docker_populate(xml) {
var hostname = "";
docker_table.fnClearTable();
hostname = $("Plugins Plugin_Docker", xml).attr('Hostname');
if (hostname !== undefined) {
$('span[class=Hostname_Docker]').html(hostname);
}
$("Plugins Plugin_Docker Docker Item", xml).each(function docker_getitem(id) {
var name = "", cpuu= 0, memu = 0, used = 0, limit = 0, netio = "", blockio = "", pids = 0;
name = $(this).attr("Name");
cpuu = parseInt($(this).attr("CPUUsage"), 10);
memu = parseInt($(this).attr("MemoryUsage"), 10);
used = parseInt($(this).attr("MemoryUsed"), 10);
limit = parseInt($(this).attr("MemoryLimit"), 10);
netio = $(this).attr("NetIO");
blockio = $(this).attr("BlockIO");
pids = parseInt($(this).attr("PIDs"), 10);
docker_table.fnAddData(["<span style=\"display:none;\">" + name + "</span>" + name, "<span style=\"display:none;\">" + cpuu + "</span>" + createBar(cpuu), "<span style=\"display:none;\">" + memu + "</span>" + createBar(memu), "<span style=\"display:none;\">" + used + "</span>" + formatBytes(used, xml), "<span style=\"display:none;\">" + limit + "</span>" + formatBytes(limit, xml), "<span style=\"display:none;\">" + netio + "</span>" + netio, "<span style=\"display:none;\">" + blockio + "</span>" + blockio, "<span style=\"display:none;\">" + pids + "</span>" + pids]);
docker_show = true;
});
}
function docker_buildTable() {
var html = "";
html += "<div style=\"overflow-x:auto;\">\n";
html += " <table id=\"Plugin_DockerTable\" class=\"stripeMe\" style=\"border-collapse:collapse;\">\n";
html += " <thead>\n";
html += " <tr>\n";
html += " <th>" + genlang(101, "docker") + "</th>\n";
html += " <th>" + genlang(102, "docker") + "</th>\n";
html += " <th>" + genlang(103, "docker") + "</th>\n";
html += " <th class=\"right\">" + genlang(104, "docker") + "</th>\n";
html += " <th class=\"right\">" + genlang(105, "docker") + "</th>\n";
html += " <th class=\"right\">" + genlang(106, "docker") + "</th>\n";
html += " <th class=\"right\">" + genlang(107, "docker") + "</th>\n";
html += " <th class=\"right\">" + genlang(108, "docker") + "</th>\n";
html += " </tr>\n";
html += " </thead>\n";
html += " <tbody id=\"Plugin_DockerTable-tbody\">\n";
html += " </tbody>\n";
html += " </table>\n";
html += "</div>\n";
$("#Plugin_Docker").append(html);
docker_table = $("#Plugin_DockerTable").dataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": true,
"bInfo": false,
"bProcessing": true,
"bAutoWidth": false,
"bStateSave": true,
"aoColumns": [{
"sType": 'span-string'
}, {
"sType": 'span-number'
}, {
"sType": 'span-number'
}, {
"sType": 'span-number',
"sClass": "right"
}, {
"sType": 'span-number',
"sClass": "right"
}, {
"sType": 'span-string',
"sClass": "right"
}, {
"sType": 'span-string',
"sClass": "right"
}, {
"sType": 'span-number',
"sClass": "right"
}]
});
}
/**
* load the xml via ajax
*/
function docker_request() {
$("#Reload_DockerTable").attr("title", "reload");
$.ajax({
url: "xml.php?plugin=docker",
dataType: "xml",
error: function docker_error() {
$.jGrowl("Error loading XML document for Plugin docker!");
},
success: function docker_buildblock(xml) {
populateErrors(xml);
docker_populate(xml);
if (docker_show) {
plugin_translate("Docker");
$("#Plugin_Docker").show();
}
}
});
}
$(document).ready(function docker_buildpage() {
$("#footer").before(buildBlock("Docker", 1, true));
$("#Plugin_Docker").addClass("fullsize");
docker_buildTable();
docker_request();
$("#Reload_DockerTable").click(function docker_reload(id) {
docker_request();
$(this).attr("title", datetime());
});
});

View File

@@ -0,0 +1,46 @@
function renderPlugin_docker(data) {
var directives = {
CPUUsage: {
html: function () {
return '<div class="progress">' +
'<div class="progress-bar progress-bar-info" style="width:' + round(this.CPUUsage,2) + '%;"></div>' +
'</div><div class="percent">' + round(this.CPUUsage,2) + '%</div>';
}
},
MemoryUsage: {
html: function () {
return '<div class="progress">' +
'<div class="progress-bar progress-bar-info" style="width:' + round(this.MemoryUsage,2) + '%;"></div>' +
'</div><div class="percent">' + round(this.MemoryUsage,2) + '%</div>';
}
},
MemoryUsed: {
html: function () {
return formatBytes(this.MemoryUsed, data.Options["@attributes"].byteFormat);
}
},
MemoryLimit: {
html: function () {
return formatBytes(this.MemoryLimit, data.Options["@attributes"].byteFormat);
}
}
};
if ((data.Plugins.Plugin_Docker !== undefined) && (data.Plugins.Plugin_Docker.Docker !== undefined)) {
var doitems = items(data.Plugins.Plugin_Docker.Docker.Item);
if (doitems.length > 0) {
var do_memory = [];
do_memory.push_attrs(doitems);
$('#docker-data').render(do_memory, directives);
$('#docker_Name').removeClass("sorttable_sorted"); // reset sort order
sorttable.innerSortFunction.apply($('#docker_Name')[0], []);
$('#block_docker').show();
} else {
$('#block_docker').hide();
}
} else {
$('#block_docker').hide();
}
}

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: en.xml 661 2014-01-08 11:26:39Z aolah76 $ -->
<!--
phpSysInfo language file Language: English Created by: Ambrus Sandor Olah
-->
<tns:translationPlugin language="english" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_docker_001" name="docker_title">
<exp>Docker</exp>
</expression>
<expression id="plugin_docker_101" name="docker_name">
<exp>Container Name</exp>
</expression>
<expression id="plugin_docker_102" name="docker_cpuusage">
<exp>CPU Usage</exp>
</expression>
<expression id="plugin_docker_103" name="docker_memusage">
<exp>Memory Usage</exp>
</expression>
<expression id="plugin_docker_104" name="docker_memused">
<exp>Memory Used</exp>
</expression>
<expression id="plugin_docker_105" name="docker_memlimit">
<exp>Memory Limit</exp>
</expression>
<expression id="plugin_docker_106" name="docker_netio">
<exp>Net I/O</exp>
</expression>
<expression id="plugin_docker_107" name="docker_blockio">
<exp>Block I/O</exp>
</expression>
<expression id="plugin_docker_108" name="docker_pids">
<exp>PIDs</exp>
</expression>
</tns:translationPlugin>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: gr.xml 661 2014-01-08 11:26:39Z aolah76 $ -->
<!--
phpSysInfo language file Language: Greek Created by: ChriZathens
-->
<tns:translationPlugin language="greek" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_docker_001" name="docker_title">
<exp>Docker</exp>
</expression>
<expression id="plugin_docker_101" name="docker_name">
<exp>Όνομα Κοντέινερ</exp>
</expression>
<expression id="plugin_docker_102" name="docker_cpuusage">
<exp>Χρήση Επεξεργαστή</exp>
</expression>
<expression id="plugin_docker_103" name="docker_memusage">
<exp>Χρήση Μνήμης</exp>
</expression>
<expression id="plugin_docker_104" name="docker_memused">
<exp>Μνήμη σε Χρήση</exp>
</expression>
<expression id="plugin_docker_105" name="docker_memlimit">
<exp>Όριο Μνήμης</exp>
</expression>
<expression id="plugin_docker_106" name="docker_netio">
<exp>I/O Δικτύου</exp>
</expression>
<expression id="plugin_docker_107" name="docker_blockio">
<exp>I/O Μπλοκ</exp>
</expression>
<expression id="plugin_docker_108" name="docker_pids">
<exp>PIDs</exp>
</expression>
</tns:translationPlugin>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: pl.xml 661 2014-01-08 11:26:39Z aolah76 $ -->
<!--
phpSysInfo language file Language: Polish Created by: Mieczysław Nalewaj
-->
<tns:translationPlugin language="polish" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_docker_001" name="docker_title">
<exp>Docker</exp>
</expression>
<expression id="plugin_docker_101" name="docker_name">
<exp>Nazwa Kontenera</exp>
</expression>
<expression id="plugin_docker_102" name="docker_cpuusage">
<exp>Procent procesora</exp>
</expression>
<expression id="plugin_docker_103" name="docker_memusage">
<exp>Procent pamięci</exp>
</expression>
<expression id="plugin_docker_104" name="docker_memused">
<exp>Pamięć</exp>
</expression>
<expression id="plugin_docker_105" name="docker_memlimit">
<exp>Limit pamięci</exp>
</expression>
<expression id="plugin_docker_106" name="docker_netio">
<exp>I/O sieci</exp>
</expression>
<expression id="plugin_docker_107" name="docker_blockio">
<exp>I/O bloków</exp>
</expression>
<expression id="plugin_docker_108" name="docker_pids">
<exp>PIDów</exp>
</expression>
</tns:translationPlugin>

View File

@@ -0,0 +1,99 @@
<?php
/**
* HyperV Plugin, which displays Hyper-V machines state
*
* @category PHP
* @package PSI_Plugin_HyperV
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
* @copyright 2017 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version $Id: class.hyperv.inc.php 661 2012-08-27 11:26:39Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
class HyperV extends PSI_Plugin
{
/**
* variable, which holds the content of the command
* @var array
*/
private $_filecontent = array();
/**
* read the data into an internal array and also call the parent constructor
*
* @param String $enc target encoding
*/
public function __construct($enc)
{
parent::__construct(__CLASS__, $enc);
}
/**
* doing all tasks to get the required informations that the plugin needs
* result is stored in an internal array<br>the array is build like a tree,
* so that it is possible to get only a specific process with the childs
*
* @return void
*/
public function execute()
{
if (((PSI_OS == 'WINNT') && !defined('PSI_EMU_HOSTNAME')) || (defined('PSI_EMU_HOSTNAME') && !defined('PSI_EMU_PORT'))) switch (strtolower(PSI_PLUGIN_HYPERV_ACCESS)) {
case 'command':
try {
$buffer = WINNT::_get_Win32_OperatingSystem();
if ($buffer && isset($buffer[0]) && isset($buffer[0]['Version'])) {
if (version_compare($buffer[0]['Version'], "6.2", ">=")) { // minimal windows 2012 or windows 8
$wmi = WINNT::initWMI('root\virtualization\v2');
} elseif (version_compare($buffer[0]['Version'], "6.0", ">=")) { // minimal windows 2008
$wmi = WINNT::initWMI('root\virtualization');
} else {
$this->global_error->addError("HyperV plugin", "Unsupported Windows version");
break;
}
} else {
$this->global_error->addError("HyperV plugin", "Unsupported Windows version");
break;
}
$result = WINNT::getWMI($wmi, 'MSVM_ComputerSystem', array('InstallDate', 'EnabledState', 'ElementName'));
foreach ($result as $machine) {
if ($machine['InstallDate'] !== null) {
$this->_filecontent[] = array($machine['ElementName'], $machine['EnabledState']);
}
}
} catch (Exception $e) {
}
break;
case 'data':
if (!defined('PSI_EMU_HOSTNAME')) {
CommonFunctions::rftsdata("hyperv.tmp", $buffer);
$processes = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY);
foreach ($processes as $process) {
$ps = preg_split("/[\s]?\|[\s]?/", $process, -1, PREG_SPLIT_NO_EMPTY);
if (count($ps) == 2) {
$this->_filecontent[] = array(trim($ps[0]), trim($ps[1]));
}
}
}
break;
default:
$this->global_error->addConfigError("execute()", "[hyperv] ACCESS");
}
}
/**
* generates the XML content for the plugin
*
* @return SimpleXMLElement entire XML content for the plugin
*/
public function xml()
{
foreach ($this->_filecontent as $machine) {
$xmlmach = $this->xml->addChild("Machine");
$xmlmach->addAttribute("Name", $machine[0]);
$xmlmach->addAttribute("State", $machine[1]);
}
return $this->xml->getSimpleXmlElement();
}
}

View File

@@ -0,0 +1,6 @@
/*
$Id: hyperv.css 661 2012-08-27 11:26:39Z namiltd $
*/
#Plugin_HyperVTable thead tr th {
cursor: pointer;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 992 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

View File

@@ -0,0 +1,26 @@
<div class="col-lg-6" id="block_hyperv" style="display:none;">
<div class="card" id="panel_hyperv" style="display:none;">
<div class="card-header"><span class="lang_plugin_hyperv_001">Hyper-V Status</span>
<span class="hostname_hyperv"></span>
<div id="reload_hyperv" class="reload" title="reload"></div>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="hyperv" class="table table-hover table-sm sortable">
<thead>
<tr>
<th id="hyperv_Name"><span class="lang_plugin_hyperv_002">Machine Name</span></th>
<th class="rightCell"><span class="lang_plugin_hyperv_003">State</span></th>
</tr>
</thead>
<tbody id="hyperv-data">
<tr>
<th><span data-bind="Name"></span></th>
<td class="rightCell"><span class="badge badge-success" data-bind="State1"></span><span class="badge badge-danger" data-bind="State0"></span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,132 @@
/***************************************************************************
* Copyright (C) 2008 by phpSysInfo - A PHP System Information Script *
* http://phpsysinfo.sourceforge.net/ *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
//
// $Id: hyperv.js 679 2012-09-04 10:10:11Z namiltd $
//
/*global $, jQuery, buildBlock, datetime, plugin_translate, genlang */
"use strict";
var hyperv_show = false, hyperv_table;
//appendcss("./plugins/hyperv/css/hyperv.css");
/**
* insert content into table
* @param {jQuery} xml plugin-XML
*/
function hyperv_populate(xml) {
var name = "", status = 0, state = "", hostname = "";
hyperv_table.fnClearTable();
hostname = $("Plugins Plugin_HyperV", xml).attr('Hostname');
if (hostname !== undefined) {
$('span[class=Hostname_HyperV]').html(hostname);
}
$("Plugins Plugin_HyperV Machine", xml).each(function hyperv_getprocess(idp) {
name = $(this).attr("Name");
status = parseInt($(this).attr("State"), 10);
if (!isNaN(status) && (status === 2)) {
state = "<span style=\"display:none;\">" + status.toString() + "</span><img src=\"./plugins/hyperv/gfx/online.gif\" alt=\"online\" title=\"\" style=\"width:18px;\" />";
}
else {
state = "<span style=\"display:none;\">" + status.toString() + "</span><img src=\"./plugins/hyperv/gfx/offline.gif\" alt=\"offline\" title=\"\" style=\"width:18px;\" />";
}
hyperv_table.fnAddData(["<span style=\"display:none;\">" + name + "</span>" + name, state]);
hyperv_show = true;
});
}
/**
* fill the plugin block with table structure
*/
function hyperv_buildTable() {
var html = "";
html += "<div style=\"overflow-x:auto;\">\n";
html += " <table id=\"Plugin_HyperVTable\" style=\"border-collapse:collapse;\">\n";
html += " <thead>\n";
html += " <tr>\n";
html += " <th>" + genlang(2, "HyperV") + "</th>\n";
html += " <th>" + genlang(3, "HyperV") + "</th>\n";
html += " </tr>\n";
html += " </thead>\n";
html += " <tbody>\n";
html += " </tbody>\n";
html += " </table>\n";
html += "</div>\n";
$("#Plugin_HyperV").append(html);
hyperv_table = $("#Plugin_HyperVTable").dataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": true,
"bInfo": false,
"bProcessing": true,
"bAutoWidth": false,
"bStateSave": true,
"aoColumns": [{
"sType": 'span-string'
}, {
"sType": 'span-number'
}]
});
}
/**
* load the xml via ajax
*/
function hyperv_request() {
$("#Reload_HyperVTable").attr("title", "reload");
$.ajax({
url: "xml.php?plugin=HyperV",
dataType: "xml",
error: function hyperv_error() {
$.jGrowl("Error loading XML document for Plugin HyperV!");
},
success: function hyperv_buildblock(xml) {
populateErrors(xml);
hyperv_populate(xml);
if (hyperv_show) {
plugin_translate("HyperV");
$("#Plugin_HyperV").show();
}
}
});
}
$(document).ready(function hyperv_buildpage() {
$("#footer").before(buildBlock("HyperV", 1, true));
$("#Plugin_HyperV").addClass("halfsize");
hyperv_buildTable();
hyperv_request();
$("#Reload_HyperVTable").click(function hyperv_reload(id) {
hyperv_request();
$(this).attr("title", datetime());
});
});

View File

@@ -0,0 +1,32 @@
function renderPlugin_hyperv(data) {
var directives = {
State1: {
text: function () {
return (this.State === "2") ? "ON" : "";
}
},
State0: {
text: function () {
return (this.State === "2") ? "" : "OFF";
}
}
};
if (data.Plugins.Plugin_HyperV !== undefined) {
var hvitems = items(data.Plugins.Plugin_HyperV.Machine);
if (hvitems.length > 0) {
var hv_memory = [];
hv_memory.push_attrs(hvitems);
$('#hyperv-data').render(hv_memory, directives);
$('#hyperv_Name').removeClass("sorttable_sorted"); // reset sort order
sorttable.innerSortFunction.apply($('#hyperv_Name')[0], []);
$('#block_hyperv').show();
} else {
$('#block_hyperv').hide();
}
} else {
$('#block_hyperv').hide();
}
}

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: en.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: English Created by: Mieczysław Nalewaj
-->
<tns:translationPlugin language="english" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_hyperv_001" name="hyperv_title">
<exp>Hyper-V Status</exp>
</expression>
<expression id="plugin_hyperv_002" name="hyperv_name">
<exp>Machine Name</exp>
</expression>
<expression id="plugin_hyperv_003" name="hyperv_state">
<exp>State</exp>
</expression>
</tns:translationPlugin>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: gr.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: Greek Created by: ChriZathens
-->
<tns:translationPlugin language="greek" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_hyperv_001" name="hyperv_title">
<exp>Κατάσταση Hyper-V</exp>
</expression>
<expression id="plugin_hyperv_002" name="hyperv_name">
<exp>Όνομα Μηχανής</exp>
</expression>
<expression id="plugin_hyperv_003" name="hyperv_state">
<exp>Κατάσταση</exp>
</expression>
</tns:translationPlugin>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: pl.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: Polish Created by: Mieczysław Nalewaj
-->
<tns:translationPlugin language="polish" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_hyperv_001" name="hyperv_title">
<exp>Status Hyper-V</exp>
</expression>
<expression id="plugin_hyperv_002" name="hyperv_name">
<exp>Nazwa maszyny</exp>
</expression>
<expression id="plugin_hyperv_003" name="hyperv_state">
<exp>Stan</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,269 +0,0 @@
<?php
/**
* ipmiinfo Plugin
*
* PHP version 5
*
* @category PHP
* @package PSI_Plugin_ipmiinfo
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @version SVN: $Id: class.ipmiinfo.inc.php 661 2012-08-27 11:26:39Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* ipmiinfo plugin, which displays all ipmi informations available
*
* @category PHP
* @package PSI_Plugin_ipmiinfo
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class ipmiinfo extends PSI_Plugin
{
private $_lines;
public function __construct($enc)
{
parent::__construct(__CLASS__, $enc);
$this->_lines = array();
}
/**
* get temperature information
*
* @return array temperatures in array with label
*/
private function temperatures()
{
$result = array();
$i = 0;
foreach ($this->_lines as $line) {
$buffer = preg_split("/\s*\|\s*/", $line);
if ($buffer[2] == "degrees C" && $buffer[3] != "na") {
$result[$i]['label'] = $buffer[0];
$result[$i]['value'] = $buffer[1];
$result[$i]['state'] = $buffer[3];
if ($buffer[8] != "na") $result[$i]['max'] = $buffer[8];
$i++;
}
}
return $result;
}
/**
* get voltages information
*
* @return array voltage in array with label
*/
private function voltages()
{
$result = array();
$i = 0;
foreach ($this->_lines as $line) {
$buffer = preg_split("/\s*\|\s*/", $line);
if ($buffer[2] == "Volts" && $buffer[3] != "na") {
$result[$i]['label'] = $buffer[0];
$result[$i]['value'] = $buffer[1];
$result[$i]['state'] = $buffer[3];
if ($buffer[5] != "na") $result[$i]['min'] = $buffer[5];
if ($buffer[8] != "na") $result[$i]['max'] = $buffer[8];
$i++;
}
}
return $result;
}
/**
* get fans information
*
* @return array fans in array with label
*/
private function fans()
{
$result = array();
$i = 0;
foreach ($this->_lines as $line) {
$buffer = preg_split("/\s*\|\s*/", $line);
if ($buffer[2] == "RPM" && $buffer[3] != "na") {
$result[$i]['label'] = $buffer[0];
$result[$i]['value'] = $buffer[1];
$result[$i]['state'] = $buffer[3];
if ($buffer[8] != "na") $result[$i]['min'] = $buffer[8];
$i++;
}
}
return $result;
}
/**
* get powers information
*
* @return array misc in array with label
*/
private function powers()
{
$result = array();
$i = 0;
foreach ($this->_lines as $line) {
$buffer = preg_split("/\s*\|\s*/", $line);
if ($buffer[2] == "Watts" && $buffer[3] != "na") {
$result[$i]['label'] = $buffer[0];
$result[$i]['value'] = $buffer[1];
$result[$i]['state'] = $buffer[3];
if ($buffer[8] != "na") $result[$i]['max'] = $buffer[8];
$i++;
}
}
return $result;
}
/**
* get currents information
*
* @return array misc in array with label
*/
private function currents()
{
$result = array();
$i = 0;
foreach ($this->_lines as $line) {
$buffer = preg_split("/\s*\|\s*/", $line);
if ($buffer[2] == "Amps" && $buffer[3] != "na") {
$result[$i]['label'] = $buffer[0];
$result[$i]['value'] = $buffer[1];
$result[$i]['state'] = $buffer[3];
if ($buffer[8] != "na") $result[$i]['max'] = $buffer[8];
$i++;
}
}
return $result;
}
/**
* get misc information
*
* @return array misc in array with label
*/
private function misc()
{
$result = array();
$i = 0;
foreach ($this->_lines as $line) {
$buffer = preg_split("/\s*\|\s*/", $line);
if ($buffer[2] == "discrete" && $buffer[3] != "na") {
$result[$i]['label'] = $buffer[0];
$result[$i]['value'] = $buffer[1];
$result[$i]['state'] = $buffer[3];
$i++;
}
}
return $result;
}
public function execute()
{
$this->_lines = array();
switch (strtolower(PSI_PLUGIN_IPMIINFO_ACCESS)) {
case 'command':
$lines = "";
if (CommonFunctions::executeProgram('ipmitool', 'sensor', $lines) && !empty($lines))
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
break;
case 'data':
if (CommonFunctions::rfts(APP_ROOT."/data/ipmiinfo.txt", $lines) && !empty($lines))
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
break;
default:
$this->error->addConfigError('__construct()', 'PSI_PLUGIN_IPMIINFO_ACCESS');
break;
}
}
public function xml()
{
if (empty($this->_lines))
return $this->xml->getSimpleXmlElement();
$arrBuff = $this->temperatures();
if (sizeof($arrBuff) > 0) {
$temp = $this->xml->addChild("Temperatures");
foreach ($arrBuff as $arrValue) {
$item = $temp->addChild('Item');
$item->addAttribute('Label', $arrValue['label']);
$item->addAttribute('Value', $arrValue['value']);
$item->addAttribute('State', $arrValue['state']);
if (isset($arrValue['Max'])) $item->addAttribute('Max', $arrValue['Max']);
}
}
$arrBuff = $this->voltages();
if (sizeof($arrBuff) > 0) {
$volt = $this->xml->addChild('Voltages');
foreach ($arrBuff as $arrValue) {
$item = $volt->addChild('Item');
$item->addAttribute('Label', $arrValue['label']);
$item->addAttribute('Value', $arrValue['value']);
$item->addAttribute('State', $arrValue['state']);
if (isset($arrValue['Min'])) $item->addAttribute('Min', $arrValue['min']);
if (isset($arrValue['Max'])) $item->addAttribute('Max', $arrValue['max']);
}
}
$arrBuff = $this->fans();
if (sizeof($arrBuff) > 0) {
$fan = $this->xml->addChild('Fans');
foreach ($arrBuff as $arrValue) {
$item = $fan->addChild('Item');
$item->addAttribute('Label', $arrValue['label']);
$item->addAttribute('Value', $arrValue['value']);
$item->addAttribute('State', $arrValue['state']);
if (isset($arrValue['Min'])) $item->addAttribute('Min', $arrValue['min']);
}
}
$arrBuff = $this->powers();
if (sizeof($arrBuff) > 0) {
$misc = $this->xml->addChild('Powers');
foreach ($arrBuff as $arrValue) {
$item = $misc->addChild('Item');
$item->addAttribute('Label', $arrValue['label']);
$item->addAttribute('Value', $arrValue['value']);
$item->addAttribute('State', $arrValue['state']);
if (isset($arrValue['Max'])) $item->addAttribute('Max', $arrValue['max']);
}
}
$arrBuff = $this->currents();
if (sizeof($arrBuff) > 0) {
$misc = $this->xml->addChild('Currents');
foreach ($arrBuff as $arrValue) {
$item = $misc->addChild('Item');
$item->addAttribute('Label', $arrValue['label']);
$item->addAttribute('Value', $arrValue['value']);
$item->addAttribute('State', $arrValue['state']);
if (isset($arrValue['Max'])) $item->addAttribute('Max', $arrValue['max']);
}
}
$arrBuff = $this->misc();
if (sizeof($arrBuff) > 0) {
$misc = $this->xml->addChild('Misc');
foreach ($arrBuff as $arrValue) {
$item = $misc->addChild('Item');
$item->addAttribute('Label', $arrValue['label']);
$item->addAttribute('Value', $arrValue['value']);
$item->addAttribute('State', $arrValue['state']);
}
}
return $this->xml->getSimpleXmlElement();
}
}

View File

@@ -1,15 +0,0 @@
<div class="col-lg-6" id="block_ipmiinfo" style="display:none">
<div class="panel panel-primary">
<div class="panel-heading">IPMI Status</div>
<div class="panel-body">
<table id="ipmiinfo" class="table table-hover table-condensed">
<tbody id="ipmiinfo-data">
<tr>
<td><span data-bind="Label"></span></td>
<td><span data-bind="Value"></span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>

View File

@@ -1,153 +0,0 @@
/***************************************************************************
* Copyright (C) 2008 by phpSysInfo - A PHP System Information Script *
* http://phpsysinfo.sourceforge.net/ *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
//$Id: ipmiinfo.js 661 2012-08-27 11:26:39Z namiltd $
/*global $, jQuery, buildBlock, datetime, plugin_translate, genlang, createBar */
"use strict";
var ipmiinfo_show = false;
/**
* insert content into table
* @param {jQuery} xml plugin-XML
*/
function ipmiinfo_populate(xml) {
var html = "";
$("#Plugin_ipmiinfoTable").html(" ");
$("Plugins Plugin_ipmiinfo Temperatures Item", xml).each(function ipmiinfo_getitem(idp) {
if(idp==0) {
html += "<tr><th colspan=\"2\" style=\"font-weight:bold\">" + genlang(3, true, "ipmiinfo") + "</th></tr>\n";
}
html += " <tr>\n";
html += " <td style=\"font-weight:normal\">" + $(this).attr("Label") + "</td>\n";
html += " <td style=\"font-weight:normal\">" + $(this).attr("Value") + "</td>\n";
html += " </tr>\n";
ipmiinfo_show = true;
});
$("Plugins Plugin_ipmiinfo Fans Item", xml).each(function ipmiinfo_getitem(idp) {
if(idp==0) {
html += "<tr><th colspan=\"2\" style=\"font-weight:bold\">" + genlang(4, true, "ipmiinfo") + "</th></tr>\n";
}
html += " <tr>\n";
html += " <td style=\"font-weight:normal\">" + $(this).attr("Label") + "</td>\n";
html += " <td style=\"font-weight:normal\">" + $(this).attr("Value") + "</td>\n";
html += " </tr>\n";
ipmiinfo_show = true;
});
$("Plugins Plugin_ipmiinfo Voltages Item", xml).each(function ipmiinfo_getitem(idp) {
if(idp==0) {
html += "<tr><th colspan=\"2\" style=\"font-weight:bold\">" + genlang(5, true, "ipmiinfo") + "</th></tr>\n";
}
html += " <tr>\n";
html += " <td style=\"font-weight:normal\">" + $(this).attr("Label") + "</td>\n";
html += " <td style=\"font-weight:normal\">" + $(this).attr("Value") + "</td>\n";
html += " </tr>\n";
ipmiinfo_show = true;
});
$("Plugins Plugin_ipmiinfo Currents Item", xml).each(function ipmiinfo_getitem(idp) {
if(idp==0) {
html += "<tr><th colspan=\"2\" style=\"font-weight:bold\">" + genlang(7, true, "ipmiinfo") + "</th></tr>\n";
}
html += " <tr>\n";
html += " <td style=\"font-weight:normal\">" + $(this).attr("Label") + "</td>\n";
html += " <td style=\"font-weight:normal\">" + $(this).attr("Value") + "</td>\n";
html += " </tr>\n";
ipmiinfo_show = true;
});
$("Plugins Plugin_ipmiinfo Powers Item", xml).each(function ipmiinfo_getitem(idp) {
if(idp==0) {
html += "<tr><th colspan=\"2\" style=\"font-weight:bold\">" + genlang(8, true, "ipmiinfo") + "</th></tr>\n";
}
html += " <tr>\n";
html += " <td style=\"font-weight:normal\">" + $(this).attr("Label") + "</td>\n";
html += " <td style=\"font-weight:normal\">" + $(this).attr("Value") + "</td>\n";
html += " </tr>\n";
ipmiinfo_show = true;
});
$("Plugins Plugin_ipmiinfo Misc Item", xml).each(function ipmiinfo_getitem(idp) {
if(idp==0) {
html += "<tr><th colspan=\"2\" style=\"font-weight:bold\">" + genlang(6, true, "ipmiinfo") + "</th></tr>\n";
}
html += " <tr>\n";
html += " <td style=\"font-weight:normal\">" + $(this).attr("Label") + "</td>\n";
html += " <td style=\"font-weight:normal\">" + $(this).attr("Value") + "</td>\n";
html += " </tr>\n";
ipmiinfo_show = true;
});
$("#Plugin_ipmiinfoTable").append(html);
$('#Plugin_ipmiinfoTable tr:nth-child(even)').addClass('even');
}
function ipmiinfo_buildTable() {
var html = "";
html += "<table id=\"Plugin_ipmiinfoTable\" class=\"stripeMe\" style=\"border-spacing:0;\">\n";
html += " <thead>\n";
html += " </thead>\n";
html += " <tbody>\n";
html += " </tbody>\n";
html += "</table>\n";
$("#Plugin_ipmiinfo").append(html);
}
/**
* load the xml via ajax
*/
function ipmiinfo_request() {
$.ajax({
url: "xml.php?plugin=ipmiinfo",
dataType: "xml",
error: function ipmiinfo_error() {
$.jGrowl("Error loading XML document for Plugin ipmiinfo!");
},
success: function ipmiinfo_buildblock(xml) {
populateErrors(xml);
ipmiinfo_populate(xml);
if (ipmiinfo_show) {
plugin_translate("ipmiinfo");
$("#Plugin_ipmiinfo").show();
}
}
});
}
$(document).ready(function ipmiinfo_buildpage() {
$("#footer").before(buildBlock("ipmiinfo", 1, true));
$("#Plugin_ipmiinfo").css("width", "451px");
ipmiinfo_buildTable();
ipmiinfo_request();
$("#Reload_ipmiinfoTable").click(function ipmiinfo_reload(id) {
ipmiinfo_request();
$("#Reload_ipmiinfoTable").attr("title",datetime());
});
});

View File

@@ -1,36 +0,0 @@
function renderPlugin_ipmiinfo(data) {
var directives = {
Label: {
html: function () {
if (this["Value"] == undefined) {
return '<b>' + this["Label"] + '</b>';
} else {
return this["Label"];
}
}
}
};
if (data['Plugins']['Plugin_ipmiinfo'] !== undefined) {
var data_ipmiinfo = [];
var valuelist = {Temperatures:"Temperatures [C]", Voltages:"Voltages [V]", Fans:"Fans [RPM]", Powers:"Powers [W]", Currents:"Currents [A]", Misc:"Misc [0/1]"};
for (var ipmiinfo_value in valuelist) {
if (data['Plugins']['Plugin_ipmiinfo'][ipmiinfo_value] !== undefined) {
var datas = items(data['Plugins']['Plugin_ipmiinfo'][ipmiinfo_value]["Item"]);
if (datas.length > 0) {
data_ipmiinfo.push({Label:valuelist[ipmiinfo_value]});
data_ipmiinfo.push_attrs(datas);
}
}
}
if (data_ipmiinfo.length > 0) {
$('#ipmiinfo-data').render(data_ipmiinfo, directives);
$('#block_ipmiinfo').show();
} else {
$('#block_ipmiinfo').hide();
}
} else {
$('#block_ipmiinfo').hide();
}
}

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: cz.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: Czech Created by: Tomáš Růžička
-->
<tns:translationPlugin language="czech" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_ipmiinfo_001" name="ipmiinfo_title">
<exp>IPMI informace</exp>
</expression>
<expression id="plugin_ipmiinfo_002" name="ipmiinfo_date">
<exp>Aktualizováno</exp>
</expression>
<expression id="plugin_ipmiinfo_003" name="ipmiinfo_temperatures">
<exp>Teploty [°C]</exp>
</expression>
<expression id="plugin_ipmiinfo_004" name="ipmiinfo_fans">
<exp>Větráky [RPM]</exp>
</expression>
<expression id="plugin_ipmiinfo_005" name="ipmiinfo_voltages">
<exp>Napětí [V]</exp>
</expression>
<expression id="plugin_ipmiinfo_006" name="ipmiinfo_misc">
<exp>Různé [0/1]</exp>
</expression>
<expression id="plugin_ipmiinfo_007" name="ipmiinfo_currents">
<exp>Currents [A]</exp>
</expression>
<expression id="plugin_ipmiinfo_008" name="ipmiinfo_powers">
<exp>Powers [W]</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: en.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: German Created by: Matthias Freund (MAFLO321)
-->
<tns:translationPlugin language="german" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_ipmiinfo_001" name="ipmiinfo_title">
<exp>IPMI Status</exp>
</expression>
<expression id="plugin_ipmiinfo_002" name="ipmiinfo_date">
<exp>Letzte Aktualisierung</exp>
</expression>
<expression id="plugin_ipmiinfo_003" name="ipmiinfo_temperatures">
<exp>Temperaturen [°C]</exp>
</expression>
<expression id="plugin_ipmiinfo_004" name="ipmiinfo_fans">
<exp>Lüfter [RPM]</exp>
</expression>
<expression id="plugin_ipmiinfo_005" name="ipmiinfo_voltages">
<exp>Spannungen [V]</exp>
</expression>
<expression id="plugin_ipmiinfo_006" name="ipmiinfo_misc">
<exp>Misc [0/1]</exp>
</expression>
<expression id="plugin_ipmiinfo_007" name="ipmiinfo_currents">
<exp>Currents [A]</exp>
</expression>
<expression id="plugin_ipmiinfo_008" name="ipmiinfo_powers">
<exp>Powers [W]</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: en.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: English Created by: Mieczyslaw Nalewaj
-->
<tns:translationPlugin language="english" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_ipmiinfo_001" name="ipmiinfo_title">
<exp>IPMI Status</exp>
</expression>
<expression id="plugin_ipmiinfo_002" name="ipmiinfo_date">
<exp>Last refresh</exp>
</expression>
<expression id="plugin_ipmiinfo_003" name="ipmiinfo_temperatures">
<exp>Temperatures [°C]</exp>
</expression>
<expression id="plugin_ipmiinfo_004" name="ipmiinfo_fans">
<exp>Fans [RPM]</exp>
</expression>
<expression id="plugin_ipmiinfo_005" name="ipmiinfo_voltages">
<exp>Voltages [V]</exp>
</expression>
<expression id="plugin_ipmiinfo_006" name="ipmiinfo_misc">
<exp>Misc [0/1]</exp>
</expression>
<expression id="plugin_ipmiinfo_007" name="ipmiinfo_currents">
<exp>Currents [A]</exp>
</expression>
<expression id="plugin_ipmiinfo_008" name="ipmiinfo_powers">
<exp>Powers [W]</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: fr.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: English Created by: Erkan VALENTIN
-->
<tns:translationPlugin language="french" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_ipmiinfo_001" name="ipmiinfo_title">
<exp>Etat IPMI</exp>
</expression>
<expression id="plugin_ipmiinfo_002" name="ipmiinfo_date">
<exp>Dernière actualisation</exp>
</expression>
<expression id="plugin_ipmiinfo_003" name="ipmiinfo_temperatures">
<exp>Températures [°c]</exp>
</expression>
<expression id="plugin_ipmiinfo_004" name="ipmiinfo_fans">
<exp>Ventilateurs [RPM]</exp>
</expression>
<expression id="plugin_ipmiinfo_005" name="ipmiinfo_voltages">
<exp>Tensions [V]</exp>
</expression>
<expression id="plugin_ipmiinfo_006" name="ipmiinfo_misc">
<exp>Divers [0/1]</exp>
</expression>
<expression id="plugin_ipmiinfo_007" name="ipmiinfo_currents">
<exp>Currents [A]</exp>
</expression>
<expression id="plugin_ipmiinfo_008" name="ipmiinfo_powers">
<exp>Powers [W]</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: pl.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: Polish Created by: Mieczyslaw Nalewaj
-->
<tns:translationPlugin language="polish" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_ipmiinfo_001" name="ipmiinfo_title">
<exp>IPMI Status</exp>
</expression>
<expression id="plugin_ipmiinfo_002" name="ipmiinfo_date">
<exp>Ostatnie odświeżenie</exp>
</expression>
<expression id="plugin_ipmiinfo_003" name="ipmiinfo_temperatures">
<exp>Temperatury [°C]</exp>
</expression>
<expression id="plugin_ipmiinfo_004" name="ipmiinfo_fans">
<exp>Wentylatory [RPM]</exp>
</expression>
<expression id="plugin_ipmiinfo_005" name="ipmiinfo_voltages">
<exp>Napięcia [V]</exp>
</expression>
<expression id="plugin_ipmiinfo_006" name="ipmiinfo_misc">
<exp>Różne [0/1]</exp>
</expression>
<expression id="plugin_ipmiinfo_007" name="ipmiinfo_currents">
<exp>Prądy [A]</exp>
</expression>
<expression id="plugin_ipmiinfo_008" name="ipmiinfo_powers">
<exp>Moce [W]</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: ro.xml 661 2014-05-02 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: Romană Created by: Mieczyslaw Nalewaj
-->
<tns:translationPlugin language="romana" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_ipmiinfo_001" name="ipmiinfo_title">
<exp>Stare IPMI</exp>
</expression>
<expression id="plugin_ipmiinfo_002" name="ipmiinfo_date">
<exp>Ultimul refresh</exp>
</expression>
<expression id="plugin_ipmiinfo_003" name="ipmiinfo_temperatures">
<exp>Temperaturi [°C]</exp>
</expression>
<expression id="plugin_ipmiinfo_004" name="ipmiinfo_fans">
<exp>Ventilatoare [RPM]</exp>
</expression>
<expression id="plugin_ipmiinfo_005" name="ipmiinfo_voltages">
<exp>Tensiuni [V]</exp>
</expression>
<expression id="plugin_ipmiinfo_006" name="ipmiinfo_misc">
<exp>Diverse [0/1]</exp>
</expression>
<expression id="plugin_ipmiinfo_007" name="ipmiinfo_currents">
<exp>Amperi [A]</exp>
</expression>
<expression id="plugin_ipmiinfo_008" name="ipmiinfo_powers">
<exp>Wați [W]</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: en.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: Russian Created by: Denis Sevostyanov (den007)
-->
<tns:translationPlugin language="russian" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_ipmiinfo_001" name="ipmiinfo_title">
<exp>IPMI Статус</exp>
</expression>
<expression id="plugin_ipmiinfo_002" name="ipmiinfo_date">
<exp>Последнее обновление</exp>
</expression>
<expression id="plugin_ipmiinfo_003" name="ipmiinfo_temperatures">
<exp>Температура [°C]</exp>
</expression>
<expression id="plugin_ipmiinfo_004" name="ipmiinfo_fans">
<exp>Вентиляторы [ОБ/мин]</exp>
</expression>
<expression id="plugin_ipmiinfo_005" name="ipmiinfo_voltages">
<exp>Напряжение [V]</exp>
</expression>
<expression id="plugin_ipmiinfo_006" name="ipmiinfo_misc">
<exp>Разное [0/1]</exp>
</expression>
<expression id="plugin_ipmiinfo_007" name="ipmiinfo_currents">
<exp>Ток [A]</exp>
</expression>
<expression id="plugin_ipmiinfo_008" name="ipmiinfo_powers">
<exp>Напряжение [W]</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,236 +0,0 @@
<?php
/**
* MDStatus Plugin
*
* PHP version 5
*
* @category PHP
* @package PSI_Plugin_MDStatus
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @version SVN: $Id: class.mdstatus.inc.php 661 2012-08-27 11:26:39Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* mdstatus Plugin, which displays a snapshot of the kernel's RAID/md state
* a simple view which shows supported types and RAID-Devices which are determined by
* parsing the "/proc/mdstat" file, another way is to provide
* a file with the output of the /proc/mdstat file, so there is no need to run a execute by the
* webserver, the format of the command is written down in the phpsysinfo.ini file, where also
* the method of getting the information is configured
*
* @category PHP
* @package PSI_Plugin_MDStatus
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class MDStatus extends PSI_Plugin
{
/**
* variable, which holds the content of the command
* @var array
*/
private $_filecontent = "";
/**
* variable, which holds the result before the xml is generated out of this array
* @var array
*/
private $_result = array();
/**
* read the data into an internal array and also call the parent constructor
*
* @param String $enc encoding
*/
public function __construct($enc)
{
$buffer = "";
parent::__construct(__CLASS__, $enc);
switch (strtolower(PSI_PLUGIN_MDSTATUS_ACCESS)) {
case 'file':
CommonFunctions::rfts("/proc/mdstat", $buffer);
break;
case 'data':
CommonFunctions::rfts(APP_ROOT."/data/mdstat.txt", $buffer);
break;
default:
$this->global_error->addConfigError("__construct()", "PSI_PLUGIN_MDSTATUS_ACCESS");
break;
}
if (trim($buffer) != "") {
$this->_filecontent = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY);
} else {
$this->_filecontent = array();
}
}
/**
* doing all tasks to get the required informations that the plugin needs
* result is stored in an internal array<br>the array is build like a tree,
* so that it is possible to get only a specific process with the childs
*
* @return void
*/
public function execute()
{
if (empty($this->_filecontent)) {
return;
}
// get the supported types
if (preg_match('/[a-zA-Z]* : (\[([a-z0-9])*\]([ \n]))+/', $this->_filecontent[0], $res)) {
$parts = preg_split("/ : /", $res[0]);
$parts = preg_split("/ /", $parts[1]);
$count = 0;
foreach ($parts as $types) {
if (trim($types) != "") {
$this->_result['supported_types'][$count++] = substr(trim($types), 1, -1);
}
}
}
// get disks
if (preg_match("/^read_ahead/", $this->_filecontent[1])) {
$count = 2;
} else {
$count = 1;
}
$cnt_filecontent = count($this->_filecontent);
do {
$parts = preg_split("/ : /", $this->_filecontent[$count]);
$dev = trim($parts[0]);
if (count($parts) == 2) {
$details = preg_split('/ /', $parts[1]);
if (!strstr($details[0], 'inactive')) {
$this->_result['devices'][$dev]['level'] = $details[1];
} else {
$this->_result['devices'][$dev]['level'] = "none";
}
$this->_result['devices'][$dev]['status'] = $details[0];
for ($i = 2, $cnt_details = count($details); $i < $cnt_details; $i++) {
preg_match('/(([a-z0-9])+)(\[([0-9]+)\])(\([SF ]\))?/', trim($details[$i]), $partition);
if (count($partition) == 5 || count($partition) == 6) {
$this->_result['devices'][$dev]['partitions'][$partition[1]]['raid_index'] = substr(trim($partition[3]), 1, -1);
if (isset($partition[5])) {
$search = array("(", ")");
$replace = array("", "");
$this->_result['devices'][$dev]['partitions'][$partition[1]]['status'] = str_replace($search, $replace, trim($partition[5]));
} else {
$this->_result['devices'][$dev]['partitions'][$partition[1]]['status'] = " ";
}
}
}
$count++;
$optionline = $this->_filecontent[$count - 1].$this->_filecontent[$count];
if (preg_match('/([^\sk]*)k chunk/', $optionline, $chunksize)) {
$this->_result['devices'][$dev]['chunk_size'] = $chunksize[1];
} else {
$this->_result['devices'][$dev]['chunk_size'] = -1;
}
if ($pos = strpos($optionline, "super non-persistent")) {
$this->_result['devices'][$dev]['pers_superblock'] = 0;
} else {
$this->_result['devices'][$dev]['pers_superblock'] = 1;
}
if ($pos = strpos($optionline, "algorithm")) {
$this->_result['devices'][$dev]['algorithm'] = trim(substr($optionline, $pos + 9, 2));
} else {
$this->_result['devices'][$dev]['algorithm'] = -1;
}
if (preg_match('/(\[[0-9]?\/[0-9]\])/', $optionline, $res)) {
$slashpos = strpos($res[0], '/');
$this->_result['devices'][$dev]['registered'] = substr($res[0], 1, $slashpos - 1);
$this->_result['devices'][$dev]['active'] = substr($res[0], $slashpos + 1, strlen($res[0]) - $slashpos - 2);
} else {
$this->_result['devices'][$dev]['registered'] = -1;
$this->_result['devices'][$dev]['active'] = -1;
}
if (preg_match(('/([a-z]+)( *)=( *)([0-9\.]+)%/'), $this->_filecontent[$count + 1], $res) || (preg_match(('/([a-z]+)( *)=( *)([0-9\.]+)/'), $optionline, $res))) {
list($this->_result['devices'][$dev]['action']['name'], $this->_result['devices'][$dev]['action']['percent']) = preg_split("/=/", str_replace("%", "", $res[0]));
if (preg_match(('/([a-z]*=[0-9\.]+[a-z]+)/'), $this->_filecontent[$count + 1], $res)) {
$time = preg_split("/=/", $res[0]);
list($this->_result['devices'][$dev]['action']['finish_time'], $this->_result['devices'][$dev]['action']['finish_unit']) = sscanf($time[1], '%f%s');
} else {
$this->_result['devices'][$dev]['action']['finish_time'] = -1;
$this->_result['devices'][$dev]['action']['finish_unit'] = -1;
}
} else {
$this->_result['devices'][$dev]['action']['name'] = -1;
$this->_result['devices'][$dev]['action']['percent'] = -1;
$this->_result['devices'][$dev]['action']['finish_time'] = -1;
$this->_result['devices'][$dev]['action']['finish_unit'] = -1;
}
} else {
$count++;
}
} while ($cnt_filecontent > $count);
$lastline = $this->_filecontent[$cnt_filecontent - 2];
if (strpos($lastline, "unused devices") !== false) {
$parts = preg_split("/:/", $lastline);
$search = array("<", ">");
$replace = array("", "");
$this->_result['unused_devs'] = trim(str_replace($search, $replace, $parts[1]));
} else {
$this->_result['unused_devs'] = -1;
}
}
/**
* generates the XML content for the plugin
*
* @return SimpleXMLObject entire XML content for the plugin
*/
public function xml()
{
if (empty($this->_result)) {
return $this->xml->getSimpleXmlElement();
}
$hideRaids = array();
if (defined('PSI_PLUGIN_MDSTATUS_HIDE_RAID_DEVICES') && is_string(PSI_PLUGIN_MDSTATUS_HIDE_RAID_DEVICES)) {
if (preg_match(ARRAY_EXP, PSI_PLUGIN_MDSTATUS_HIDE_RAID_DEVICES)) {
$hideRaids = eval(PSI_PLUGIN_MDSTATUS_HIDE_RAID_DEVICES);
} else {
$hideRaids = array(PSI_PLUGIN_MDSTATUS_HIDE_RAID_DEVICES);
}
}
$sup = $this->xml->addChild("Supported_Types");
foreach ($this->_result['supported_types'] as $type) {
$typ = $sup->addChild("Type");
$typ->addAttribute("Name", $type);
}
if (isset($this->_result['devices'])) foreach ($this->_result['devices'] as $key=>$device) {
if (!in_array($key, $hideRaids, true)) {
$dev = $this->xml->addChild("Raid");
$dev->addAttribute("Device_Name", $key);
$dev->addAttribute("Level", $device["level"]);
$dev->addAttribute("Disk_Status", $device["status"]);
$dev->addAttribute("Chunk_Size", $device["chunk_size"]);
$dev->addAttribute("Persistend_Superblock", $device["pers_superblock"]);
$dev->addAttribute("Algorithm", $device["algorithm"]);
$dev->addAttribute("Disks_Registered", $device["registered"]);
$dev->addAttribute("Disks_Active", $device["active"]);
$action = $dev->addChild("Action");
$action->addAttribute("Percent", $device['action']['percent']);
$action->addAttribute("Name", $device['action']['name']);
$action->addAttribute("Time_To_Finish", $device['action']['finish_time']);
$action->addAttribute("Time_Unit", $device['action']['finish_unit']);
$disks = $dev->addChild("Disks");
foreach ($device['partitions'] as $diskkey=>$disk) {
$disktemp = $disks->addChild("Disk");
$disktemp->addAttribute("Name", $diskkey);
$disktemp->addAttribute("Status", $disk['status']);
$disktemp->addAttribute("Index", $disk['raid_index']);
}
}
}
if ($this->_result['unused_devs'] !== - 1) {
$unDev = $this->xml->addChild("Unused_Devices");
$unDev->addAttribute("Devices", $this->_result['unused_devs']);
}
return $this->xml->getSimpleXmlElement();
}
}

View File

@@ -1,14 +0,0 @@
/*
$Id: mdstatus.css 661 2012-08-27 11:26:39Z namiltd $
*/
.plugin_mdstatus_biun {
text-align: center;
margin-bottom: 5px;
margin-right: 20px;
float: left;
width: 64px;
}
img.plugin_mdstatus_biun {
margin: auto;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -1,225 +0,0 @@
/***************************************************************************
* Copyright (C) 2008 by phpSysInfo - A PHP System Information Script *
* http://phpsysinfo.sourceforge.net/ *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
//
// $Id: mdstatus.js 679 2012-09-04 10:10:11Z namiltd $
//
/*global $, jQuery, buildBlock, genlang, createBar, plugin_translate, datetime */
"use strict";
//appendcss("./plugins/MDStatus/css/MDStatus.css");
var mdstatus_show = false;
/**
* get the details of the raid
* @param {jQuery} xml part of the plugin-XML
* @param {number} id id of the device
*/
function mdstatus_buildinfos(xml, id) {
var html = "", devstatus = "", devlevel = "", devchunk = 0, devsuper = 0, devalgo = 0, devactive = 0, devregis = 0, button = "";
devstatus = $(xml).attr("Disk_Status");
devlevel = $(xml).attr("Level");
devchunk = parseInt($(xml).attr("Chunk_Size"), 10);
devsuper = parseInt($(xml).attr("Persistent_Superblock"), 10);
devalgo = parseInt($(xml).attr("Algorithm"), 10);
devactive = parseInt($(xml).attr("Disks_Active"), 10);
devregis = parseInt($(xml).attr("Disks_Registered"), 10);
html += "<tr><td>" + genlang(5, false, "MDStatus") + "</td><td>" + devstatus + "</td></tr>";
html += "<tr><td>" + genlang(6, false, "MDStatus") + "</td><td>" + devlevel + "</td></tr>";
if (devchunk !== -1) {
html += "<tr><td>" + genlang(7, false, "MDStatus") + "</td><td>" + devchunk + "K</td></tr>";
}
if (devalgo !== -1) {
html += "<tr><td>" + genlang(8, false, "MDStatus") + "</td><td>" + devalgo + "</td></tr>";
}
if (devsuper !== -1) {
html += "<tr><td>" + genlang(9, false, "MDStatus") + "</td><td>" + genlang(10, false, "MDStatus") + "</td></tr>";
}
else {
html += "<tr><td>" + genlang(9, false, "MDStatus") + "</td><td>" + genlang(11, false, "MDStatus") + "</td></tr>";
}
if (devactive !== -1 && devregis !== -1) {
html += "<tr><td>" + genlang(12, false, "MDStatus") + "</td><td>" + devregis + "/" + devactive + "</td></tr>";
}
button += "<h3 style=\"cursor: pointer\" id=\"sPlugin_MDStatus_Info" + id + "\"><img src=\"./gfx/bullet_toggle_plus.png\" alt=\"plus\" style=\"vertical-align:middle;\" />" + genlang(4, false, "MDStatus") + "</h3>";
button += "<h3 style=\"cursor: pointer; display: none;\" id=\"hPlugin_MDStatus_Info" + id + "\"><img src=\"./gfx/bullet_toggle_minus.png\" alt=\"minus\" style=\"vertical-align:middle;\" />" + genlang(4, false, "MDStatus") + "</h3>";
button += "<table id=\"Plugin_MDStatus_InfoTable" + id + "\" style=\"border-spacing:0; display:none;\">" + html + "</table>";
return button;
}
/**
* generate a html string with the current action on the disks
* @param {jQuery} xml part of the plugin-XML
*/
function mdstatus_buildaction(xml) {
var html = "", name = "", time = "", tunit = "", percent = 0;
$("Action", xml).each(function mdstatus_getaction(id) {
name = $(this).attr("Name");
if (parseInt(name, 10) !== -1) {
time = $(this).attr("Time_To_Finish");
tunit = $(this).attr("Time_Unit");
percent = parseFloat($(this).attr("Percent"));
html += "<div style=\"padding-left:10px;\">";
html += genlang(13, false, "MDStatus") + ":&nbsp;" + name + "<br/>";
html += createBar(percent);
html += "<br/>";
html += genlang(14, false, "MDStatus") + "&nbsp;" + time + "&nbsp;" + tunit;
html += "</div>";
}
});
return html;
}
/**
* choose the right diskdrive icon
* @param {jQuery} xml part of the plugin-XML
*/
function mdstatus_diskicon(xml) {
var html = "";
$("Disks Disk", xml).each(function mdstatus_getdisk(id) {
var diskstatus = "", diskname = "", img = "", alt = "";
html += "<div class=\"plugin_mdstatus_biun\">";
diskstatus = $(this).attr("Status");
diskname = $(this).attr("Name");
switch (diskstatus) {
case " ":
case "":
img = "harddriveok.png";
alt = "ok";
break;
case "F":
img = "harddrivefail.png";
alt = "fail";
break;
case "S":
img = "harddrivespare.png";
alt = "spare";
break;
default:
alert("--" + diskstatus + "--");
img = "error.png";
alt = "error";
break;
}
html += "<img class=\"plugin_mdstatus_biun\" src=\"./plugins/mdstatus/gfx/" + img + "\" alt=\"" + alt + "\" />";
html += "<small>" + diskname + "</small>";
html += "</div>";
});
return html;
}
/**
* fill the plugin block
* @param {jQuery} xml plugin-XML
*/
function mdstatus_populate(xml) {
var htmltypes = "";
$("#Plugin_MDStatusTable").empty();
$("Plugins Plugin_MDStatus Supported_Types Type", xml).each(function mdstatus_getsupportedtypes(id) {
// htmltypes += "<li>" + $(this).attr("Name") + "</li>";
htmltypes += "<b>" + $(this).attr("Name") + " </b>";
});
if (htmltypes.length > 0) {
htmltypes = "<ul>" + htmltypes + "</ul>";
$("#Plugin_MDStatusTable").append("<tr><td style=\"width:160px;\">" + genlang(2, false, "MDStatus") + "</td><td>" + htmltypes + "</td></tr>");
mdstatus_show = true;
}
$("Plugins Plugin_MDStatus Raid", xml).each(function mdstatus_getdevice(id) {
var htmldisks = "", htmldisklist = "", topic = "", name = "", buildedaction = "";
name = $(this).attr("Device_Name");
htmldisklist += mdstatus_diskicon(this);
htmldisks += "<table style=\"width:100%;\">";
htmldisks += "<tr><td>" + htmldisklist + "</td></tr>";
buildedaction = mdstatus_buildaction($(this));
if (buildedaction) {
htmldisks += "<tr><td>" + buildedaction + "</td></tr>";
}
htmldisks += "<tr><td>" + mdstatus_buildinfos($(this), id) + "<td></tr>";
htmldisks += "</table>";
if (id) {
topic = "";
}
else {
topic = genlang(3, false, "MDStatus");
}
$("#Plugin_MDStatusTable").append("<tr><td>" + topic + "</td><td><div class=\"plugin_mdstatus_biun\" style=\"text-align:left;\"><b>" + name + "</b></div>" + htmldisks + "</td></tr>");
$("#sPlugin_MDStatus_Info" + id).click(function mdstatus_showinfo() {
$("#Plugin_MDStatus_InfoTable" + id).slideDown("slow");
$("#sPlugin_MDStatus_Info" + id).hide();
$("#hPlugin_MDStatus_Info" + id).show();
});
$("#hPlugin_MDStatus_Info" + id).click(function mdstatus_hideinfo() {
$("#Plugin_MDStatus_InfoTable" + id).slideUp("slow");
$("#hPlugin_MDStatus_Info" + id).hide();
$("#sPlugin_MDStatus_Info" + id).show();
});
mdstatus_show = true;
});
if ($("Plugins Plugin_MDStatus Unused_Devices", xml).length > 0) {
$("#Plugin_MDStatusTable").append("<tr><td>" + genlang(15, false, "MDStatus") + "</td><td>" + $(this).attr("Devices") + "</td></tr>");
mdstatus_show = true;
}
}
/**
* load the xml via ajax
*/
function mdstatus_request() {
$.ajax({
url: "xml.php?plugin=MDStatus",
dataType: "xml",
error: function mdstatus_error() {
$.jGrowl("Error loading XML document for Plugin MDStatus");
},
success: function mdstatus_buildblock(xml) {
populateErrors(xml);
mdstatus_populate(xml);
if (mdstatus_show) {
plugin_translate("MDStatus");
$("#Plugin_MDStatus").show();
}
}
});
}
$(document).ready(function mdstatus_buildpage() {
var html = "";
$("#footer").before(buildBlock("MDStatus", 1, true));
html += " <table id=\"Plugin_MDStatusTable\" style=\"border-spacing:0;\">\n";
html += " </table>\n";
$("#Plugin_MDStatus").append(html);
$("#Plugin_MDStatus").css("width", "915px");
mdstatus_request();
$("#Reload_MDStatusTable").click(function mdstatus_reload(id) {
mdstatus_request();
$("#Reload_MDStatusTable").attr("title",datetime());
});
});

View File

@@ -1,146 +0,0 @@
function renderPlugin_mdstatus(data) {
function raid_buildaction(data) {
var html = "", name = "", percent = 0;
if (data !== undefined) {
name = data['Name'];
if ((name !== undefined) && (parseInt(name) !== -1)) {
percent = Math.round(parseFloat(data['Percent']));
html += "<div>Current Action:" + String.fromCharCode(160) + name + "<br/>";
html += '<table width=100%><tr><td width=50%><div class="progress">' +
'<div class="progress-bar progress-bar-info" style="width: ' + percent + '%;"></div>' +
'</div><div class="percent">' + percent + '%</div></td><td></td></tr></table>';
html += "Finishing in:" + String.fromCharCode(160) + data['Time_To_Finish'] + String.fromCharCode(160) + data['Time_Unit'];
html += "</div>";
}
}
return html;
}
function raid_diskicon(data) {
var html = "";
var img = "", alt = "";
html += "<div style=\"text-align: center; float: left; margin-bottom: 5px; margin-right: 20px; width: 64px;\">";
switch (data["Status"]) {
case " ":
case "":
img = "harddriveok.png";
alt = "ok";
break;
case "F":
img = "harddrivefail.png";
alt = "fail";
break;
case "S":
img = "harddrivespare.png";
alt = "spare";
break;
case "W":
img = "harddrivewarn.png";
alt = "warning";
break;
default:
alert("--" + data["Status"] + "--");
img = "error.png";
alt = "error";
break;
}
html += "<img src=\"./plugins/dmraid/gfx/" + img + "\" alt=\"" + alt + "\" />";
html += "<small>" + data["Name"] + "</small>";
html += "</div>";
return html;
}
if (data['Plugins']['Plugin_MDStatus'] !== undefined) {
$('#mdstatus').empty();
if (data['Plugins']['Plugin_MDStatus']['Supported_Types'] !== undefined) {
var stitems = items(data['Plugins']['Plugin_MDStatus']['Supported_Types']['Type']);
if (stitems.length > 0) {
var htmltypes = "<tr><th>Supported RAID-Types</th><th>";
for (i = 0; i < stitems.length ; i++) {
htmltypes += stitems[i]["@attributes"]["Name"] + " ";
}
htmltypes += "</th><tr>";
$('#mdstatus').append(htmltypes);
$('#block_mdstatus').show();
} else {
$('#block_mdstatus').hide();
}
} else {
$('#block_mdstatus').hide();
}
var mditems = items(data['Plugins']['Plugin_MDStatus']['Raid']);
if (mditems.length > 0) {
var html = '';
for (i = 0; i < mditems.length ; i++) {
if (i) {
html += "<tr><td></td><td>";
} else {
html += "<tr><th>RAID-Devices</th><td>";
}
if (mditems[i]['Disks'] !== undefined) {
var devchunk = parseInt(mditems[i]["@attributes"]["Chunk_Size"]);
var devsuper = parseInt(mditems[i]["@attributes"]["Persistent_Superblock"]);
var devalgo = parseInt(mditems[i]["@attributes"]["Algorithm"]);
var devactive = parseInt(mditems[i]["@attributes"]["Disks_Active"]);
var devregis = parseInt(mditems[i]["@attributes"]["Disks_Registered"]);
html += "<table style=\"width:100%;\">";
html += "<tr><td>";
var diskitems = items(mditems[i]['Disks']['Disk']);
for (j = 0; j < diskitems.length ; j++) {
html += raid_diskicon(diskitems[j]["@attributes"]);
}
html += "</td></tr><tr><td>";
if (mditems[i]['Action'] !== undefined) {
var buildedaction = raid_buildaction(mditems[i]['Action']['@attributes']);
if (buildedaction) {
html += "<tr><td>" + buildedaction + "</td></tr>";
}
}
html += "<table id=\"mdstatus-" + i + "\"class=\"table table-hover table-condensed\">";
html += "<tr class=\"treegrid-mdstatus-" + i + "\"><td><b>" + mditems[i]["@attributes"]["Device_Name"] + "</b></td><td></td></tr>";
html += "<tr class=\"treegrid-parent-mdstatus-" + i + "\"><th>Status</th><td>" + mditems[i]["@attributes"]["Disk_Status"] + "</td></tr>";
html += "<tr class=\"treegrid-parent-mdstatus-" + i + "\"><th>RAID-Level</th><td>" + mditems[i]["@attributes"]["Level"] + "</td></tr>";
if (devchunk !== -1) {
html += "<tr class=\"treegrid-parent-mdstatus-" + i + "\"><th>Chunk Size</th><td>" + devchunk + "K</td></tr>";
}
if (devalgo !== -1) {
html += "<tr class=\"treegrid-parent-mdstatus-" + i + "\"><th>Algorithm</th><td>" + devalgo + "</td></tr>";
}
if (devsuper !== -1) {
html += "<tr class=\"treegrid-parent-mdstatus-" + i + "\"><th>Persistent Superblock</th><td>available</td></tr>";
} else {
html += "<tr class=\"treegrid-parent-mdstatus-" + i + "\"><th>Persistent Superblock</th><td>not available</td></tr>";
}
if (devactive !== -1 && devregis !== -1) {
html += "<tr class=\"treegrid-parent-mdstatus-" + i + "\"><th>Registered/" + String.fromCharCode(8203) + "Active Disks</th><td>" + devregis + "/" + String.fromCharCode(8203) + devactive + "</td></tr>";
}
html += "</table>";
html += "</td></tr>";
html += "</table>";
}
html +="</td></tr>";
}
$('#mdstatus').append(html);
for (i = 0; i < mditems.length ; i++) {
if (mditems[i]['Disks'] !== undefined) {
$('#mdstatus-'+i).treegrid({
initialState: 'collapsed',
expanderExpandedClass: 'normalicon normalicon-down',
expanderCollapsedClass: 'normalicon normalicon-right'
});
}
}
}
} else {
$('#block_mdstatus').hide();
}
}

View File

@@ -1,57 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: cz.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: Czech Created by: Tomáš Růžička
-->
<tns:translationPlugin language="czech" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_mdstatus_001" name="mdstatus_title">
<exp>Stav RAIDu</exp>
</expression>
<expression id="plugin_mdstatus_002" name="mdstatus_support">
<exp>Poodporované typy RAID</exp>
</expression>
<expression id="plugin_mdstatus_003" name="mdstatus_devices">
<exp>RAID-zařízení</exp>
</expression>
<expression id="plugin_mdstatus_004" name="mdstatus_infos">
<exp>Dodatečné informace</exp>
</expression>
<expression id="plugin_mdstatus_005" name="mdstatus_status">
<exp>Stav</exp>
</expression>
<expression id="plugin_mdstatus_006" name="mdstatus_level">
<exp>Úroveň RAIDu</exp>
</expression>
<expression id="plugin_mdstatus_007" name="mdstatus_chunk">
<exp>Velikost proužku</exp>
</expression>
<expression id="plugin_mdstatus_008" name="mdstatus_algo">
<exp>Algoritmus</exp>
</expression>
<expression id="plugin_mdstatus_009" name="mdstatus_superb">
<exp>Persistentní Superblock</exp>
</expression>
<expression id="plugin_mdstatus_010" name="mdstatus_avail">
<exp>dostupný</exp>
</expression>
<expression id="plugin_mdstatus_011" name="mdstatus_navail">
<exp>nedostupný</exp>
</expression>
<expression id="plugin_mdstatus_012" name="mdstatus_regact">
<exp>Registrovné/aktivní disky</exp>
</expression>
<expression id="plugin_mdstatus_013" name="mdstatus_curact">
<exp>Aktuální činnost</exp>
</expression>
<expression id="plugin_mdstatus_014" name="mdstatus_finishin">
<exp>Čas dokončení</exp>
</expression>
<expression id="plugin_mdstatus_015" name="mdstatus_unused">
<exp>Nevyužité disky</exp>
</expression>
<expression id="plugin_mdstatus_016" name="mdstatus_refresh">
<exp>Aktualizováno</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,57 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: de.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: German Created by: Michael Cramer
-->
<tns:translationPlugin language="german" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_mdstatus_001" name="mdstatus_title">
<exp>RAID Status</exp>
</expression>
<expression id="plugin_mdstatus_002" name="mdstatus_support">
<exp>Unterstützte RAID-Typen</exp>
</expression>
<expression id="plugin_mdstatus_003" name="mdstatus_devices">
<exp>RAID-Geräte</exp>
</expression>
<expression id="plugin_mdstatus_004" name="mdstatus_infos">
<exp>Zusätzliche Informationen</exp>
</expression>
<expression id="plugin_mdstatus_005" name="mdstatus_status">
<exp>Status</exp>
</expression>
<expression id="plugin_mdstatus_006" name="mdstatus_level">
<exp>RAID-Level</exp>
</expression>
<expression id="plugin_mdstatus_007" name="mdstatus_chunk">
<exp>Blockgröße</exp>
</expression>
<expression id="plugin_mdstatus_008" name="mdstatus_algo">
<exp>Algorithmus</exp>
</expression>
<expression id="plugin_mdstatus_009" name="mdstatus_superb">
<exp>Persistenter Superblock</exp>
</expression>
<expression id="plugin_mdstatus_010" name="mdstatus_avail">
<exp>verfügbar</exp>
</expression>
<expression id="plugin_mdstatus_011" name="mdstatus_navail">
<exp>nicht verfügbar</exp>
</expression>
<expression id="plugin_mdstatus_012" name="mdstatus_regact">
<exp>Registrierte/Aktive Platten</exp>
</expression>
<expression id="plugin_mdstatus_013" name="mdstatus_curact">
<exp>Aktuelle Aktion</exp>
</expression>
<expression id="plugin_mdstatus_014" name="mdstatus_finishin">
<exp>Fertig in</exp>
</expression>
<expression id="plugin_mdstatus_015" name="mdstatus_unused">
<exp>Unbenutzte Platten</exp>
</expression>
<expression id="plugin_mdstatus_016" name="mdstatus_refresh">
<exp>Zuletzt aktualisiert</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,57 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: en.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: English Created by: Michael Cramer
-->
<tns:translationPlugin language="english" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_mdstatus_001" name="mdstatus_title">
<exp>RAID Status</exp>
</expression>
<expression id="plugin_mdstatus_002" name="mdstatus_support">
<exp>Supported RAID-Types</exp>
</expression>
<expression id="plugin_mdstatus_003" name="mdstatus_devices">
<exp>RAID-Devices</exp>
</expression>
<expression id="plugin_mdstatus_004" name="mdstatus_infos">
<exp>Additional Information</exp>
</expression>
<expression id="plugin_mdstatus_005" name="mdstatus_status">
<exp>Status</exp>
</expression>
<expression id="plugin_mdstatus_006" name="mdstatus_level">
<exp>RAID-Level</exp>
</expression>
<expression id="plugin_mdstatus_007" name="mdstatus_chunk">
<exp>Chunk Size</exp>
</expression>
<expression id="plugin_mdstatus_008" name="mdstatus_algo">
<exp>Algorithm</exp>
</expression>
<expression id="plugin_mdstatus_009" name="mdstatus_superb">
<exp>Persistent Superblock</exp>
</expression>
<expression id="plugin_mdstatus_010" name="mdstatus_avail">
<exp>available</exp>
</expression>
<expression id="plugin_mdstatus_011" name="mdstatus_navail">
<exp>not available</exp>
</expression>
<expression id="plugin_mdstatus_012" name="mdstatus_regact">
<exp>Registered/Active Disks</exp>
</expression>
<expression id="plugin_mdstatus_013" name="mdstatus_curact">
<exp>Current Action</exp>
</expression>
<expression id="plugin_mdstatus_014" name="mdstatus_finishin">
<exp>Finishing in</exp>
</expression>
<expression id="plugin_mdstatus_015" name="mdstatus_unused">
<exp>Unused Disks</exp>
</expression>
<expression id="plugin_mdstatus_016" name="mdstatus_refresh">
<exp>Last refresh</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,57 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: fr.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: French Created by: Erkan VALENTIN
-->
<tns:translationPlugin language="french" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_mdstatus_001" name="mdstatus_title">
<exp>Statut RAID</exp>
</expression>
<expression id="plugin_mdstatus_002" name="mdstatus_support">
<exp>Type de RAID supporté</exp>
</expression>
<expression id="plugin_mdstatus_003" name="mdstatus_devices">
<exp>Périphériques RAID</exp>
</expression>
<expression id="plugin_mdstatus_004" name="mdstatus_infos">
<exp>Informations additionnelles</exp>
</expression>
<expression id="plugin_mdstatus_005" name="mdstatus_status">
<exp>Statut</exp>
</expression>
<expression id="plugin_mdstatus_006" name="mdstatus_level">
<exp>Type de RAID</exp>
</expression>
<expression id="plugin_mdstatus_007" name="mdstatus_chunk">
<exp>Granularité</exp>
</expression>
<expression id="plugin_mdstatus_008" name="mdstatus_algo">
<exp>Algorithme</exp>
</expression>
<expression id="plugin_mdstatus_009" name="mdstatus_superb">
<exp>Superblocs persistants</exp>
</expression>
<expression id="plugin_mdstatus_010" name="mdstatus_avail">
<exp>disponible</exp>
</expression>
<expression id="plugin_mdstatus_011" name="mdstatus_navail">
<exp>non disponible</exp>
</expression>
<expression id="plugin_mdstatus_012" name="mdstatus_regact">
<exp>Disques Enregistrés/Actives</exp>
</expression>
<expression id="plugin_mdstatus_013" name="mdstatus_curact">
<exp>Action courante</exp>
</expression>
<expression id="plugin_mdstatus_014" name="mdstatus_finishin">
<exp>Temps restant</exp>
</expression>
<expression id="plugin_mdstatus_015" name="mdstatus_unused">
<exp>Disques inutilisés</exp>
</expression>
<expression id="plugin_mdstatus_016" name="mdstatus_refresh">
<exp>Dernière actualisation</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,57 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: gr.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: Greek Created by: mojiro
-->
<tns:translationPlugin language="english" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_mdstatus_001" name="mdstatus_title">
<exp>Κατάσταση RAID</exp>
</expression>
<expression id="plugin_mdstatus_002" name="mdstatus_support">
<exp>Υποστηριζόμενοι τύποι RAID</exp>
</expression>
<expression id="plugin_mdstatus_003" name="mdstatus_devices">
<exp>Αλυσίδες RAID</exp>
</expression>
<expression id="plugin_mdstatus_004" name="mdstatus_infos">
<exp>Πρόσθετες πληροφορίες</exp>
</expression>
<expression id="plugin_mdstatus_005" name="mdstatus_status">
<exp>Κατάσταση</exp>
</expression>
<expression id="plugin_mdstatus_006" name="mdstatus_level">
<exp>Τύπος RAID</exp>
</expression>
<expression id="plugin_mdstatus_007" name="mdstatus_chunk">
<exp>Μέγεθος Chunk</exp>
</expression>
<expression id="plugin_mdstatus_008" name="mdstatus_algo">
<exp>Αλγόριθμος</exp>
</expression>
<expression id="plugin_mdstatus_009" name="mdstatus_superb">
<exp>Μόνιμο Superblock</exp>
</expression>
<expression id="plugin_mdstatus_010" name="mdstatus_avail">
<exp>διαθέσιμο</exp>
</expression>
<expression id="plugin_mdstatus_011" name="mdstatus_navail">
<exp>μη διαθέσιμο</exp>
</expression>
<expression id="plugin_mdstatus_012" name="mdstatus_regact">
<exp>Δηλωμένοι/Ενεργοί Δίσκοι</exp>
</expression>
<expression id="plugin_mdstatus_013" name="mdstatus_curact">
<exp>Τρέχουσα ενέργεια</exp>
</expression>
<expression id="plugin_mdstatus_014" name="mdstatus_finishin">
<exp>Ολοκληρώνεται σε</exp>
</expression>
<expression id="plugin_mdstatus_015" name="mdstatus_unused">
<exp>Αχρησιμοποίητοι Δίσκοι</exp>
</expression>
<expression id="plugin_mdstatus_016" name="mdstatus_refresh">
<exp>Ενημέρωση</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,57 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: ro.xml 661 2014-05-02 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: Romană Created by: Iulian Alexe
-->
<tns:translationPlugin language="romana" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_mdstatus_001" name="mdstatus_title">
<exp>Stare RAID</exp>
</expression>
<expression id="plugin_mdstatus_002" name="mdstatus_support">
<exp>Tipuri de RAID suportate</exp>
</expression>
<expression id="plugin_mdstatus_003" name="mdstatus_devices">
<exp>Dispozitive RAID</exp>
</expression>
<expression id="plugin_mdstatus_004" name="mdstatus_infos">
<exp>Informații Aditionale</exp>
</expression>
<expression id="plugin_mdstatus_005" name="mdstatus_status">
<exp>Stare</exp>
</expression>
<expression id="plugin_mdstatus_006" name="mdstatus_level">
<exp>Nivele RAID</exp>
</expression>
<expression id="plugin_mdstatus_007" name="mdstatus_chunk">
<exp>Chunk Size</exp>
</expression>
<expression id="plugin_mdstatus_008" name="mdstatus_algo">
<exp>Algoritm</exp>
</expression>
<expression id="plugin_mdstatus_009" name="mdstatus_superb">
<exp>Superblock persistente</exp>
</expression>
<expression id="plugin_mdstatus_010" name="mdstatus_avail">
<exp>disponibil</exp>
</expression>
<expression id="plugin_mdstatus_011" name="mdstatus_navail">
<exp>indisponibil</exp>
</expression>
<expression id="plugin_mdstatus_012" name="mdstatus_regact">
<exp>Înregistrate/Discuri Active</exp>
</expression>
<expression id="plugin_mdstatus_013" name="mdstatus_curact">
<exp>Acțiune curentă</exp>
</expression>
<expression id="plugin_mdstatus_014" name="mdstatus_finishin">
<exp>finisare în</exp>
</expression>
<expression id="plugin_mdstatus_015" name="mdstatus_unused">
<exp>Discuri defolosite</exp>
</expression>
<expression id="plugin_mdstatus_016" name="mdstatus_refresh">
<exp>Ultimul refresh</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,57 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: en.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: Russian Created by: Denis Sevostyanov (den007)
-->
<tns:translationPlugin language="russian" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_mdstatus_001" name="mdstatus_title">
<exp>RAID Статус</exp>
</expression>
<expression id="plugin_mdstatus_002" name="mdstatus_support">
<exp>Поддерживаются типы RAID</exp>
</expression>
<expression id="plugin_mdstatus_003" name="mdstatus_devices">
<exp>RAID-Устройства</exp>
</expression>
<expression id="plugin_mdstatus_004" name="mdstatus_infos">
<exp>Дополнительные сведения</exp>
</expression>
<expression id="plugin_mdstatus_005" name="mdstatus_status">
<exp>Статус</exp>
</expression>
<expression id="plugin_mdstatus_006" name="mdstatus_level">
<exp>RAID-Уровень</exp>
</expression>
<expression id="plugin_mdstatus_007" name="mdstatus_chunk">
<exp>Размер блока</exp>
</expression>
<expression id="plugin_mdstatus_008" name="mdstatus_algo">
<exp>Алгоритм</exp>
</expression>
<expression id="plugin_mdstatus_009" name="mdstatus_superb">
<exp>Постоянный суперблок</exp>
</expression>
<expression id="plugin_mdstatus_010" name="mdstatus_avail">
<exp>доступен</exp>
</expression>
<expression id="plugin_mdstatus_011" name="mdstatus_navail">
<exp>не доступен</exp>
</expression>
<expression id="plugin_mdstatus_012" name="mdstatus_regact">
<exp>Зарегистрировано/Активных Дисков</exp>
</expression>
<expression id="plugin_mdstatus_013" name="mdstatus_curact">
<exp>Текущее действие</exp>
</expression>
<expression id="plugin_mdstatus_014" name="mdstatus_finishin">
<exp>Окончание в</exp>
</expression>
<expression id="plugin_mdstatus_015" name="mdstatus_unused">
<exp>Неиспользуемые диски</exp>
</expression>
<expression id="plugin_mdstatus_016" name="mdstatus_refresh">
<exp>Последнее обновление</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,9 +0,0 @@
<div class="col-lg-12" id="block_mdstatus" style="display:none">
<div class="panel panel-primary">
<div class="panel-heading">RAID Status</div>
<div class="panel-body">
<table id="mdstatus" class="table borderless table-condensed">
</table>
</div>
</div>
</div>

View File

@@ -0,0 +1,143 @@
<?php
/**
* PingTime Plugin
*
* PHP version 5
*
* @category PHP
* @package PSI_Plugin_PingTest
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
* @copyright 2017 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.pingtest.inc.php 1 2017-09-01 09:01:15Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
class PingTest extends PSI_Plugin
{
/**
* variable, which holds the content of the command
* @var array
*/
private $_filecontent = array();
/**
* variable, which holds the result before the xml is generated out of this array
* @var array
*/
private $_result = array();
/**
* read the data into an internal array and also call the parent constructor
*
* @param String $enc target encoding
*/
public function __construct($enc)
{
parent::__construct(__CLASS__, $enc);
if (defined('PSI_PLUGIN_PINGTEST_ADDRESSES') && is_string(PSI_PLUGIN_PINGTEST_ADDRESSES)) {
if (preg_match(ARRAY_EXP, PSI_PLUGIN_PINGTEST_ADDRESSES)) {
$addresses = eval(PSI_PLUGIN_PINGTEST_ADDRESSES);
} else {
$addresses = array(PSI_PLUGIN_PINGTEST_ADDRESSES);
}
switch (strtolower(PSI_PLUGIN_PINGTEST_ACCESS)) {
case 'command':
if (PHP_OS == 'WINNT') {
$params = "-n 1";
if (defined('PSI_PLUGIN_PINGTEST_TIMEOUT')) {
if (($tout = max(intval(PSI_PLUGIN_PINGTEST_TIMEOUT), 0)) > 0) {
$params .= " -w ".(1000*$tout);
}
} else {
$params .= " -w 2000";
}
} else {
$params = "-c 1";
if (defined('PSI_PLUGIN_PINGTEST_TIMEOUT')) {
if (($tout = max(intval(PSI_PLUGIN_PINGTEST_TIMEOUT), 0)) > 0) {
$params .= " -W ".$tout;
}
} else {
$params .= " -W 2";
}
}
foreach ($addresses as $address) {
CommonFunctions::executeProgram("ping".((strpos($address, ':') === false)?'':((PHP_OS != 'WINNT')?'6':'')), $params." ".$address, $buffer, PSI_DEBUG);
if ((strlen($buffer) > 0) && preg_match("/[=<]([\d\.]+)\s*ms/", $buffer, $tmpout)) {
$this->_filecontent[] = array($address, $tmpout[1]);
}
}
break;
case 'data':
CommonFunctions::rftsdata("pingtest.tmp", $buffer);
$addresses = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY);
foreach ($addresses as $address) {
$pt = preg_split("/[\s]?\|[\s]?/", $address, -1, PREG_SPLIT_NO_EMPTY);
if (count($pt) == 2) {
$this->_filecontent[] = array(trim($pt[0]), trim($pt[1]));
}
}
break;
default:
$this->global_error->addConfigError("__construct()", "[pingtest] ACCESS");
}
}
}
/**
* doing all tasks to get the required informations that the plugin needs
* result is stored in an internal array
*
* @return void
*/
public function execute()
{
if (defined('PSI_PLUGIN_PINGTEST_ADDRESSES') && is_string(PSI_PLUGIN_PINGTEST_ADDRESSES)) {
if (preg_match(ARRAY_EXP, PSI_PLUGIN_PINGTEST_ADDRESSES)) {
$addresses = eval(PSI_PLUGIN_PINGTEST_ADDRESSES);
} else {
$addresses = array(PSI_PLUGIN_PINGTEST_ADDRESSES);
}
foreach ($addresses as $address) {
$this->_result[] = array($address, $this->address_inarray($address, $this->_filecontent));
}
}
}
/**
* generates the XML content for the plugin
*
* @return SimpleXMLElement entire XML content for the plugin
*/
public function xml()
{
foreach ($this->_result as $pt) {
$xmlps = $this->xml->addChild("Ping");
$xmlps->addAttribute("Address", $pt[0]);
$xmlps->addAttribute("PingTime", $pt[1]);
}
return $this->xml->getSimpleXmlElement();
}
/**
* checks an array if pingtest address is in
*
* @param mixed $needle what to find
* @param array $haystack where to find
*
* @return pingtime - found<br>"lost" - not found
*/
private function address_inarray($needle, $haystack)
{
foreach ($haystack as $stalk) {
if ($needle === $stalk[0]) {
return $stalk[1];
}
}
return "lost";
}
}

View File

@@ -0,0 +1,6 @@
/*
$Id: pingtest.css 1 2017-09-02 10:17:22Z namiltd $
*/
#Plugin_PingTestTable thead tr th {
cursor: pointer;
}

View File

@@ -0,0 +1,131 @@
/***************************************************************************
* Copyright (C) 2008 by phpSysInfo - A PHP System Information Script *
* http://phpsysinfo.sourceforge.net/ *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
//
// $Id: pingtest.js 1 2017-09-01 08:23:45Z namiltd $
//
/*global $, jQuery, buildBlock, datetime, plugin_translate, genlang */
"use strict";
var pingtest_show = false, pingtest_table;
/**
* insert content into table
* @param {jQuery} xml plugin-XML
*/
function pingtest_populate(xml) {
var address = "", pingtime = 0, state = "", hostname = "";
pingtest_table.fnClearTable();
hostname = $("Plugins Plugin_PingTest", xml).attr('Hostname');
if (hostname !== undefined) {
$('span[class=Hostname_PingTest]').html(hostname);
}
$("Plugins Plugin_PingTest Ping", xml).each(function pingtest_getprocess(idp) {
address = $(this).attr("Address");
pingtime = parseInt($(this).attr("PingTime"), 10);
if (!isNaN(pingtime)) {
state = "<span style=\"display:none;\">" + pingtime.toString() + "</span>" + pingtime.toString() + "&nbsp;ms";
}
else {
state = "<span style=\"display:none;\">1000000</span>" + genlang(4, "PingTest");
}
pingtest_table.fnAddData(["<span style=\"display:none;\">" + address + "</span>" + address, state]);
pingtest_show = true;
});
}
/**
* fill the plugin block with table structure
*/
function pingtest_buildTable() {
var html = "";
html += "<div style=\"overflow-x:auto;\">\n";
html += " <table id=\"Plugin_PingTestTable\" style=\"border-collapse:collapse;\">\n";
html += " <thead>\n";
html += " <tr>\n";
html += " <th>" + genlang(2, "PingTest") + "</th>\n";
html += " <th>" + genlang(3, "PingTest") + "</th>\n";
html += " </tr>\n";
html += " </thead>\n";
html += " <tbody>\n";
html += " </tbody>\n";
html += " </table>\n";
html += "</div>\n";
$("#Plugin_PingTest").append(html);
pingtest_table = $("#Plugin_PingTestTable").dataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": true,
"bInfo": false,
"bProcessing": true,
"bAutoWidth": false,
"bStateSave": true,
"aoColumns": [{
"sType": 'span-ip'
}, {
"sType": 'span-number'
}]
});
}
/**
* load the xml via ajax
*/
function pingtest_request() {
$("#Reload_PingTestTable").attr("title", "reload");
$.ajax({
url: "xml.php?plugin=PingTest",
dataType: "xml",
error: function pingtest_error() {
$.jGrowl("Error loading XML document for Plugin PingTest!");
},
success: function pingtest_buildblock(xml) {
populateErrors(xml);
pingtest_populate(xml);
if (pingtest_show) {
plugin_translate("PingTest");
$("#Plugin_PingTest").show();
}
}
});
}
$(document).ready(function pingtest_buildpage() {
$("#footer").before(buildBlock("PingTest", 1, true));
$("#Plugin_PingTest").addClass("halfsize");
pingtest_buildTable();
pingtest_request();
$("#Reload_PingTestTable").click(function pingtest_reload(id) {
pingtest_request();
$(this).attr("title", datetime());
});
});

View File

@@ -0,0 +1,27 @@
function renderPlugin_pingtest(data) {
var directives = {
PingTime: {
html: function () {
return ((this.PingTime === "lost") ? genlang(4, 'pingtest') : this.PingTime + String.fromCharCode(160) + "ms");
}
}
};
if (data.Plugins.Plugin_PingTest !== undefined) {
var psitems = items(data.Plugins.Plugin_PingTest.Ping);
if (psitems.length > 0) {
var pt_memory = [];
pt_memory.push_attrs(psitems);
$('#pingtest-data').render(pt_memory, directives);
$('#pingtest_Address').removeClass("sorttable_sorted"); // reset sort order
sorttable.innerSortFunction.apply($('#pingtest_Address')[0], []);
$('#block_pingtest').show();
} else {
$('#block_pingtest').hide();
}
} else {
$('#block_pingtest').hide();
}
}

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
phpSysInfo language file Language: Czech Created by: Ashus
-->
<tns:translationPlugin language="czech" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_pingtest_001" name="pingtest_title">
<exp>Ping</exp>
</expression>
<expression id="plugin_pingtest_002" name="pingtest_address">
<exp>Adresa</exp>
</expression>
<expression id="plugin_pingtest_003" name="pingtest_pingtime">
<exp>Odezva</exp>
</expression>
<expression id="plugin_pingtest_004" name="pingtest_lost">
<exp>ztráta</exp>
</expression>
</tns:translationPlugin>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: de.xml 661 2017-09-01 09:01:17Z namiltd $ -->
<!--
phpSysInfo language file Language: German Created by: Mieczyslaw Nalewaj
-->
<tns:translationPlugin language="german" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_pingtest_001" name="pingtest_title">
<exp>Ping-Test</exp>
</expression>
<expression id="plugin_pingtest_002" name="pingtest_address">
<exp>Adresse</exp>
</expression>
<expression id="plugin_pingtest_003" name="pingtest_pingtime">
<exp>Pingzeit</exp>
</expression>
<expression id="plugin_pingtest_004" name="pingtest_lost">
<exp>verloren</exp>
</expression>
</tns:translationPlugin>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: en.xml 661 2017-09-01 09:01:17Z namiltd $ -->
<!--
phpSysInfo language file Language: English Created by: Mieczyslaw Nalewaj
-->
<tns:translationPlugin language="english" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_pingtest_001" name="pingtest_title">
<exp>Ping Test</exp>
</expression>
<expression id="plugin_pingtest_002" name="pingtest_address">
<exp>Address</exp>
</expression>
<expression id="plugin_pingtest_003" name="pingtest_pingtime">
<exp>Ping Time</exp>
</expression>
<expression id="plugin_pingtest_004" name="pingtest_lost">
<exp>lost</exp>
</expression>
</tns:translationPlugin>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: gr.xml 661 2017-09-01 09:01:17Z namiltd $ -->
<!--
phpSysInfo language file Language: Greek Created by: ChriZathens
-->
<tns:translationPlugin language="greek" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_pingtest_001" name="pingtest_title">
<exp>Δοκιμή Ping</exp>
</expression>
<expression id="plugin_pingtest_002" name="pingtest_address">
<exp>Διεύθυνση</exp>
</expression>
<expression id="plugin_pingtest_003" name="pingtest_pingtime">
<exp>Χρόνος Απόκρισης</exp>
</expression>
<expression id="plugin_pingtest_004" name="pingtest_lost">
<exp>χάθηκε</exp>
</expression>
</tns:translationPlugin>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: pl.xml 661 2017-09-01 09:01:17Z namiltd $ -->
<!--
phpSysInfo language file Language: Polish Created by: Mieczyslaw Nalewaj
-->
<tns:translationPlugin language="polish" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_pingtest_001" name="pingtest_title">
<exp>Test Pingu</exp>
</expression>
<expression id="plugin_pingtest_002" name="pingtest_address">
<exp>Adres</exp>
</expression>
<expression id="plugin_pingtest_003" name="pingtest_pingtime">
<exp>Czas Pingu</exp>
</expression>
<expression id="plugin_pingtest_004" name="pingtest_lost">
<exp>zagubiony</exp>
</expression>
</tns:translationPlugin>

View File

@@ -0,0 +1,26 @@
<div class="col-lg-6" id="block_pingtest" style="display:none;">
<div class="card" id="panel_pingtest" style="display:none;">
<div class="card-header"><span class="lang_plugin_pingtest_001">Ping Test</span>
<span class="hostname_pingtest"></span>
<div id="reload_pingtest" class="reload" title="reload"></div>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="pingtest" class="table table-hover table-sm sortable">
<thead>
<tr>
<th class="sorttable_ip" id="pingtest_Address"><span class="lang_plugin_pingtest_002">Address</span></th>
<th class="rightCell"><span class="lang_plugin_pingtest_003">Ping Time</span></th>
</tr>
</thead>
<tbody id="pingtest-data">
<tr>
<th><span data-bind="Address"></span></th>
<td class="rightCell"><span data-bind="PingTime"></span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>

View File

@@ -1,19 +1,6 @@
<?php
/**
* PS Plugin
*
* PHP version 5
*
* @category PHP
* @package PSI_Plugin_PS
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @version SVN: $Id: class.ps.inc.php 692 2012-09-08 17:12:08Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* process Plugin, which displays all running processes
* PS Plugin, which displays all running processes
* a simple tree view which is filled with the running processes which are determined by
* calling the "ps" command line utility, another way is to provide
* a file with the output of the ps utility, so there is no need to run a execute by the
@@ -24,7 +11,7 @@
* @package PSI_Plugin_PS
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
@@ -43,30 +30,43 @@ class PS extends PSI_Plugin
/**
* read the data into an internal array and also call the parent constructor
*
* @param String $enc encoding
* @param string $enc encoding
*/
public function __construct($enc)
{
parent::__construct(__CLASS__, $enc);
$buffer = "";
switch (strtolower(PSI_PLUGIN_PS_ACCESS)) {
case 'command':
if (PSI_OS == 'WINNT') {
if (((PSI_OS == 'WINNT') && !defined('PSI_EMU_HOSTNAME')) || (defined('PSI_EMU_HOSTNAME') && !defined('PSI_EMU_PORT'))) {
try {
$objLocator = new COM("WbemScripting.SWbemLocator");
$wmi = $objLocator->ConnectServer();
$os_wmi = $wmi->InstancesOf('Win32_OperatingSystem');
$os_wmi = WINNT::_get_Win32_OperatingSystem();
$memtotal = 0;
foreach ($os_wmi as $os) {
$memtotal = $os->TotalVisibleMemorySize * 1024;
$memtotal = $os['TotalVisibleMemorySize'] * 1024;
break;
}
$process_wmi = $wmi->InstancesOf('Win32_Process');
$wmi = WINNT::getcimv2wmi();
$perf_wmi = WINNT::getWMI($wmi, 'Win32_PerfFormattedData_PerfProc_Process', array('IDProcess', 'CreatingProcessID', 'PercentProcessorTime'));
$proccpu = array();
foreach ($perf_wmi as $perf) {
$proccpu[trim($perf['IDProcess'])] = array('ParentProcessId'=>trim($perf['CreatingProcessID']), 'PercentProcessorTime'=>trim($perf['PercentProcessorTime']));
}
$process_wmi = WINNT::getWMI($wmi, 'Win32_Process', array('Caption', 'CommandLine', 'ProcessId', 'ParentProcessId', 'WorkingSetSize'));
foreach ($process_wmi as $process) {
if (strlen(trim($process->CommandLine)) > 0) {
$ps = trim($process->CommandLine);
if (isset($process['CommandLine']) && strlen(trim($process['CommandLine'])) > 0) {
$ps = trim($process['CommandLine']);
} else {
$ps = trim($process->Caption);
$ps = trim($process['Caption']);
}
if (trim($process->ProcessId) != 0) {
$memusage = round(trim($process->WorkingSetSize) * 100 / $memtotal, 1);
if (($procid = trim($process['ProcessId'])) != 0) {
$memusage = round(trim($process['WorkingSetSize']) * 100 / $memtotal, 1);
$parentid = trim($process['ParentProcessId']);
$cpu = 0;
if (isset($proccpu[$procid]) && ($proccpu[$procid]['ParentProcessId'] == $parentid)) {
$cpu = $proccpu[$procid]['PercentProcessorTime'];
}
//ParentProcessId
//Unique identifier of the process that creates a process. Process identifier numbers are reused, so they
//only identify a process for the lifetime of that process. It is possible that the process identified by
@@ -75,29 +75,29 @@ class PS extends PSI_Plugin
//use the CreationDate property to determine whether the specified parent was created after the process
//represented by this Win32_Process instance was created.
//=> subtrees of processes may be missing (WHAT TODO?!?)
$this->_filecontent[] = trim($process->ProcessId)." ".trim($process->ParentProcessId)." ".$memusage." ".$ps;
$this->_filecontent[] = $procid." ".$parentid." ".$memusage." ".$cpu." ".$ps;
}
}
} catch (Exception $e) {
}
} else {
CommonFunctions::executeProgram("ps", "axo pid,ppid,pmem,args", $buffer, PSI_DEBUG);
if (((PSI_OS == 'Linux') || (PSI_OS == 'Android')) && (!preg_match("/^[^\n]+\n.+/", $buffer))) { //alternative method if no data
} elseif ((PSI_OS != 'WINNT') && (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT'))) {
CommonFunctions::executeProgram("ps", "axo pid,ppid,pmem,pcpu,args", $buffer, PSI_DEBUG);
if (((PSI_OS == 'Linux') || (PSI_OS == 'Android')) && (!preg_match("/^[^\n]+\n\s*\d+\s+\d+\s+[\d\.]+\s+[\d\.]+\s+.+/", $buffer))) { //alternative method if no data
if (CommonFunctions::rfts('/proc/meminfo', $mbuf)) {
$bufe = preg_split("/\n/", $mbuf, -1, PREG_SPLIT_NO_EMPTY);
$totalmem = 0;
foreach ($bufe as $buf) {
if (preg_match('/^MemTotal:\s+(.*)\s*kB/i', $buf, $ar_buf)) {
if (preg_match('/^MemTotal:\s+(\d+)\s*kB/i', $buf, $ar_buf)) {
$totalmem = $ar_buf[1];
break;
}
}
$buffer = " PID PPID %MEM COMMAND\n";
$buffer = " PID PPID %MEM %CPU COMMAND\n";
$processlist = glob('/proc/*/status', GLOB_NOSORT);
if (($total = count($processlist)) > 0) {
$processlist = CommonFunctions::findglob('/proc/*/status', GLOB_NOSORT);
if (is_array($processlist) && (($total = count($processlist)) > 0)) {
natsort($processlist); //first sort
$prosess = array();
$process = array();
foreach ($processlist as $processitem) { //second sort
$process[] = $processitem;
}
@@ -129,7 +129,7 @@ class PS extends PSI_Plugin
$args = "[".$args."]";
}
}
$buffer .= $pid." ".$ppid." ".$pmem." ".$args."\n";
$buffer .= $pid." ".$ppid." ".$pmem." 0.0 ".$args."\n";
}
}
@@ -140,19 +140,16 @@ class PS extends PSI_Plugin
}
break;
case 'data':
CommonFunctions::rfts(APP_ROOT."/data/ps.txt", $buffer);
if (!defined('PSI_EMU_HOSTNAME')) {
CommonFunctions::rftsdata("ps.tmp", $buffer);
}
break;
default:
$this->global_error->addConfigError("__construct()", "PSI_PLUGIN_PS_ACCESS");
break;
$this->global_error->addConfigError("__construct()", "[ps] ACCESS");
}
if (PSI_OS != 'WINNT') {
if (trim($buffer) != "") {
$this->_filecontent = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY);
unset($this->_filecontent[0]);
} else {
$this->_filecontent = array();
}
if (trim($buffer) != "") {
$this->_filecontent = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY);
unset($this->_filecontent[0]);
}
}
/**
@@ -167,9 +164,10 @@ class PS extends PSI_Plugin
if (empty($this->_filecontent)) {
return;
}
$items = array();
foreach ($this->_filecontent as $roworig) {
$row = preg_split("/[\s]+/", trim($roworig), 4);
if (count($row) != 4) {
$row = preg_split("/[\s]+/", trim($roworig), 5);
if (count($row) != 5) {
break;
}
foreach ($row as $key=>$val) {
@@ -187,7 +185,8 @@ class PS extends PSI_Plugin
$items[$zombie]["0"] = $zombie;
$items[$zombie]["1"] = "0";
$items[$zombie]["2"] = "0";
$items[$zombie]["3"] = "unknown";
$items[$zombie]["3"] = "0";
$items[$zombie]["4"] = "unknown";
$items[0]['childs'][$zombie] = &$items[$zombie];
}
break; //first is sufficient
@@ -197,7 +196,7 @@ class PS extends PSI_Plugin
if (isset($items[0])) {
$this->_result = $items[0];
} else {
$_result = array();
$this->_result = array();
}
}
/**
@@ -217,9 +216,9 @@ class PS extends PSI_Plugin
/**
* recursive function to allow appending child processes to a parent process
*
* @param Array $child part of the array which should be appended to the XML
* @param array $child part of the array which should be appended to the XML
* @param SimpleXMLExtended $xml XML-Object to which the array content is appended
* @param Array &$positions array with parent positions in xml structure
* @param array &$positions array with parent positions in xml structure
*
* @return SimpleXMLExtended Object with the appended array content
*/
@@ -233,15 +232,17 @@ class PS extends PSI_Plugin
$parentid = array_search($value[1], $positions);
$xmlnode->addAttribute('ParentID', $parentid);
$xmlnode->addAttribute('PPID', $value[1]);
$xmlnode->addAttribute('MemoryUsage', $value[2]);
$xmlnode->addAttribute('Name', str_replace("...","",$value[3]));
if (PSI_OS !== 'WINNT') {
if ($parentid === 1){
$xmlnode->addAttribute('Expanded', 0);
}
if (defined('PSI_PLUGIN_PS_SHOW_KTHREADD_EXPANDED') && (PSI_PLUGIN_PS_SHOW_KTHREADD_EXPANDED === false) && ($value[3] === "[kthreadd]")) {
$xmlnode->addAttribute('Expanded', 0);
}
if (!defined('PSI_PLUGIN_PS_MEMORY_USAGE') || (PSI_PLUGIN_PS_MEMORY_USAGE !== false)) {
$xmlnode->addAttribute('MemoryUsage', str_replace(',', '.', $value[2]));
}
if (!defined('PSI_PLUGIN_PS_CPU_USAGE') || (PSI_PLUGIN_PS_CPU_USAGE !== false)) {
$xmlnode->addAttribute('CPUUsage', str_replace(',', '.', $value[3]));
}
$xmlnode->addAttribute('Name', $value[4]);
if ((PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME') &&
((($parentid === 1) && (!defined('PSI_PLUGIN_PS_SHOW_PID1CHILD_EXPANDED') || (PSI_PLUGIN_PS_SHOW_PID1CHILD_EXPANDED === false)))
|| ((!defined('PSI_PLUGIN_PS_SHOW_KTHREADD_EXPANDED') || (PSI_PLUGIN_PS_SHOW_KTHREADD_EXPANDED === false)) && ($value[4] === "[kthreadd]")))) {
$xmlnode->addAttribute('Expanded', 0);
}
}
if (isset($value['childs'])) {

View File

@@ -32,43 +32,69 @@ var ps_show = false;
* @param {jQuery} xml plugin-XML
*/
function ps_buildTable(xml) {
var html = "", tree = [], closed = [2];
var html = "", tree = [], closed = [], memwas = false, cpuwas = false, hostname = "";
$("#Plugin_PS #Plugin_PSTable").remove();
html += " <table id=\"Plugin_PSTable\" class=\"tablemain\" style=\"width:100%;\">\n";
html += " <thead>\n";
html += " <tr>\n";
html += " <th>" + genlang(3, false, "PS") + "</th>\n";
html += " <th style=\"width:80px;\">" + genlang(4, false, "PS") + "</th>\n";
html += " <th style=\"width:80px;\">" + genlang(5, false, "PS") + "</th>\n";
html += " <th style=\"width:110px;\">" + genlang(6, false, "PS") + "</th>\n";
html += " </tr>\n";
html += " </thead>\n";
html += " <tbody class=\"tree\">\n";
hostname = $("Plugins Plugin_PS", xml).attr('Hostname');
if (hostname !== undefined) {
$('span[class=Hostname_PS]').html(hostname);
}
html += " <div style=\"overflow-x:auto;\">\n";
html += " <table id=\"Plugin_PSTable\" class=\"tablemain\">\n";
html += " <thead>\n";
html += " <tr>\n";
html += " <th>" + genlang(2, "PS") + "</th>\n";
html += " <th style=\"width:6.6%;\">" + genlang(3, "PS") + "</th>\n";
html += " <th style=\"width:6.6%;\">" + genlang(4, "PS") + "</th>\n";
html += " <th style=\"width:15.25%;\">" + genlang(5, "PS") + "</th>\n";
html += " <th style=\"width:15.25%;\">" + genlang(6, "PS") + "</th>\n";
html += " </tr>\n";
html += " </thead>\n";
html += " <tbody class=\"tree\">\n";
$("Plugins Plugin_PS Process", xml).each(function ps_getprocess(id) {
var close = 0, pid = 0, ppid = 0, name = "", percent = 0, parentId = 0, expanded = 0;
name = $(this).attr("Name");
var close = 0, pid = 0, ppid = 0, name = "", percent = 0, parentId = 0, expanded = 0, cpu = 0;
name = $(this).attr("Name").replace(/AAAAAAAA/g, "A<wbr>A<wbr>A<wbr>A<wbr>A<wbr>A<wbr>A<wbr>A<wbr>").replace(/,/g, ",<wbr>").replace(/\s/g, " <wbr>").replace(/\./g, ".<wbr>").replace(/-/g, "<wbr>-").replace(/\//g, "<wbr>/"); /* split long name */
parentId = parseInt($(this).attr("ParentID"), 10);
pid = parseInt($(this).attr("PID"), 10);
ppid = parseInt($(this).attr("PPID"), 10);
percent = parseInt($(this).attr("MemoryUsage"), 10);
cpu = parseInt($(this).attr("CPUUsage"), 10);
expanded = parseInt($(this).attr("Expanded"), 10);
html += " <tr><td>" + name + "</td><td>" + pid + "</td><td>" + ppid + "</td><td>" + createBar(percent) + "</td></tr>\n";
html += " <tr><td><div class=\"treediv\"><span class=\"treespan\">" + name + "</div></span></td><td>" + pid + "</td><td>" + ppid + "</td><td>" + createBar(percent) + "</td><td>" + createBar(cpu) + "</td></tr>\n";
close = tree.push(parentId);
if (!isNaN(expanded) && (expanded === 0)) {
closed.push(close);
}
if (!memwas && !isNaN(percent)) {
memwas = true;
}
if (!cpuwas && !isNaN(cpu)) {
cpuwas = true;
}
ps_show = true;
});
html += " </tbody>\n";
html += " </table>\n";
html += " </tbody>\n";
html += " </table>\n";
html += " </div>\n";
$("#Plugin_PS").append(html);
if (memwas) {
$('#Plugin_PSTable td:nth-child(4),#Plugin_PSTable th:nth-child(4)').show();
} else {
$('#Plugin_PSTable td:nth-child(4),#Plugin_PSTable th:nth-child(4)').hide();
}
if (cpuwas) {
$('#Plugin_PSTable td:nth-child(5),#Plugin_PSTable th:nth-child(5)').show();
} else {
$('#Plugin_PSTable td:nth-child(5),#Plugin_PSTable th:nth-child(5)').hide();
}
$("#Plugin_PSTable").jqTreeTable(tree, {
openImg: "./gfx/treeTable/tv-collapsable.gif",
shutImg: "./gfx/treeTable/tv-expandable.gif",
@@ -90,6 +116,7 @@ function ps_buildTable(xml) {
* load the xml via ajax
*/
function ps_request() {
$("#Reload_PSTable").attr("title", "reload");
$.ajax({
url: "xml.php?plugin=PS",
dataType: "xml",
@@ -109,12 +136,12 @@ function ps_request() {
$(document).ready(function ps_buildpage() {
$("#footer").before(buildBlock("PS", 1, true));
$("#Plugin_PS").css("width", "915px");
$("#Plugin_PS").addClass("fullsize");
ps_request();
$("#Reload_PSTable").click(function ps_reload(id) {
ps_request();
$("#Reload_PSTable").attr("title",datetime());
$(this).attr("title", datetime());
});
});

View File

@@ -3,30 +3,77 @@ function renderPlugin_ps(data) {
var directives = {
MemoryUsage: {
html: function () {
return '<div class="progress"><div class="progress-bar progress-bar-info" style="width: ' + this["MemoryUsage"] + '%;"></div>' +
'</div><div class="percent">' + this["MemoryUsage"] + '%</div>';
return '<div class="progress"><div class="progress-bar progress-bar-info" style="width:' + this.MemoryUsage + '%;"></div>' +
'</div><div class="percent">' + this.MemoryUsage + '%</div>';
}
},
CPUUsage: {
html: function () {
return '<div class="progress"><div class="progress-bar progress-bar-info" style="width:' + this.CPUUsage + '%;"></div>' +
'</div><div class="percent">' + this.CPUUsage + '%</div>';
}
},
Name: {
html: function () {
return this["Name"];
return this.Name.replace(/AAAAAAAA/g, "A<wbr>A<wbr>A<wbr>A<wbr>A<wbr>A<wbr>A<wbr>A<wbr>").replace(/,/g, ",<wbr>").replace(/\s/g, " <wbr>").replace(/\./g, ".<wbr>").replace(/-/g, "<wbr>-").replace(/\//g, "<wbr>/"); /* split long name */
}
}
};
if (data['Plugins']['Plugin_PS'] !== undefined) {
var psitems = items(data['Plugins']['Plugin_PS']['Process']);
if (data.Plugins.Plugin_PS !== undefined) {
var psitems = items(data.Plugins.Plugin_PS.Process);
if (psitems.length > 0) {
var ps_memory = [];
var ps_item = [];
for (i = 0; i < psitems.length ; i++) {
var html = "", ps_item = [], expanded = 0, memwas = false, cpuwas = false;
for (var i = 0; i < psitems.length ; i++) {
ps_item = psitems[i]["@attributes"];
ps_item["number"] = i + 1;
ps_memory.push(ps_item);
if (ps_item.ParentID === "0") {
html+="<tr id=\"ps-" + (i+1) + "\" class=\"treegrid-ps-" + (i+1) + "\" style=\"display:none;\" >";
} else {
html+="<tr id=\"ps-" + (i+1) + "\" class=\"treegrid-ps-" + (i+1) + " treegrid-parent-ps-" + ps_item.ParentID + "\" style=\"display:none;\" >";
}
html+="<td><span class=\"treegrid-span\" data-bind=\"Name\"></span></td>";
html+="<td><span data-bind=\"PID\"></span></td>";
html+="<td><span data-bind=\"PPID\"></span></td>";
html+="<td style=\"width:10%;\"><span data-bind=\"MemoryUsage\"></span></td>";
html+="<td style=\"width:10%;\"><span data-bind=\"CPUUsage\"></span></td>";
html+="</tr>";
}
$("#ps-data").empty().append(html);
$('#ps').treegrid({
initialState: 'expanded',
expanderExpandedClass: 'normalicon normalicon-down',
expanderCollapsedClass: 'normalicon normalicon-right'
});
for (var j = 0; j < psitems.length ; j++) {
ps_item = psitems[j]["@attributes"];
$('#ps-'+(j+1)).render(ps_item, directives);
if (!memwas && (ps_item.MemoryUsage !== undefined)) {
memwas = true;
}
if (!cpuwas && (ps_item.CPUUsage !== undefined)) {
cpuwas = true;
}
expanded = ps_item.Expanded;
if ((expanded !== undefined) && (expanded === "0")) {
$('#ps-'+(j+1)).treegrid('collapse');
}
}
if (memwas) {
$('#ps td:nth-child(4),#ps th:nth-child(4)').show();
} else {
$('#ps td:nth-child(4),#ps th:nth-child(4)').hide();
}
if (cpuwas) {
$('#ps td:nth-child(5),#ps th:nth-child(5)').show();
} else {
$('#ps td:nth-child(5),#ps th:nth-child(5)').hide();
}
$('#ps-data').render(ps_memory, directives);
$('#ps_number').removeClass("sorttable_sorted"); // reset sort order
sorttable.innerSortFunction.apply($('#ps_number')[0], []);
$('#block_ps').show();
} else {

View File

@@ -9,19 +9,19 @@
<expression id="plugin_ps_001" name="ps_title">
<exp>Procesy</exp>
</expression>
<expression id="plugin_ps_002" name="ps_date">
<exp>Aktualizováno</exp>
</expression>
<expression id="plugin_ps_003" name="ps_command">
<expression id="plugin_ps_002" name="ps_command">
<exp>Příkaz</exp>
</expression>
<expression id="plugin_ps_004" name="ps_pid">
<expression id="plugin_ps_003" name="ps_pid">
<exp>PID</exp>
</expression>
<expression id="plugin_ps_005" name="ps_ppid">
<expression id="plugin_ps_004" name="ps_ppid">
<exp>Rodičovský PID</exp>
</expression>
<expression id="plugin_ps_006" name="ps_mem">
<expression id="plugin_ps_005" name="ps_mem">
<exp>Spotřeba paměti</exp>
</expression>
<expression id="plugin_ps_006" name="ps_cpu">
<exp>CPU Usage</exp>
</expression>
</tns:translationPlugin>

View File

@@ -9,19 +9,19 @@
<expression id="plugin_ps_001" name="ps_title">
<exp>Prozess Status</exp>
</expression>
<expression id="plugin_ps_002" name="ps_date">
<exp>Letzte Aktualisierung</exp>
</expression>
<expression id="plugin_ps_003" name="ps_command">
<expression id="plugin_ps_002" name="ps_command">
<exp>Befehl</exp>
</expression>
<expression id="plugin_ps_004" name="ps_pid">
<expression id="plugin_ps_003" name="ps_pid">
<exp>Prozess ID</exp>
</expression>
<expression id="plugin_ps_005" name="ps_ppid">
<expression id="plugin_ps_004" name="ps_ppid">
<exp>Eltern ID</exp>
</expression>
<expression id="plugin_ps_006" name="ps_mem">
<expression id="plugin_ps_005" name="ps_mem">
<exp>Speichernutzung</exp>
</expression>
<expression id="plugin_ps_006" name="ps_cpu">
<exp>CPU Usage</exp>
</expression>
</tns:translationPlugin>

View File

@@ -9,19 +9,19 @@
<expression id="plugin_ps_001" name="ps_title">
<exp>Process Status</exp>
</expression>
<expression id="plugin_ps_002" name="ps_date">
<exp>Last refresh</exp>
</expression>
<expression id="plugin_ps_003" name="ps_command">
<expression id="plugin_ps_002" name="ps_command">
<exp>Command</exp>
</expression>
<expression id="plugin_ps_004" name="ps_pid">
<expression id="plugin_ps_003" name="ps_pid">
<exp>Process ID</exp>
</expression>
<expression id="plugin_ps_005" name="ps_ppid">
<expression id="plugin_ps_004" name="ps_ppid">
<exp>Parent ID</exp>
</expression>
<expression id="plugin_ps_006" name="ps_mem">
<expression id="plugin_ps_005" name="ps_mem">
<exp>Memory Usage</exp>
</expression>
<expression id="plugin_ps_006" name="ps_cpu">
<exp>CPU Usage</exp>
</expression>
</tns:translationPlugin>

View File

@@ -9,19 +9,19 @@
<expression id="plugin_ps_001" name="ps_title">
<exp>Etat des processus</exp>
</expression>
<expression id="plugin_ps_002" name="ps_date">
<exp>Dernière actualisation</exp>
</expression>
<expression id="plugin_ps_003" name="ps_command">
<expression id="plugin_ps_002" name="ps_command">
<exp>Commande</exp>
</expression>
<expression id="plugin_ps_004" name="ps_pid">
<expression id="plugin_ps_003" name="ps_pid">
<exp>ID processus</exp>
</expression>
<expression id="plugin_ps_005" name="ps_ppid">
<expression id="plugin_ps_004" name="ps_ppid">
<exp>ID processus père</exp>
</expression>
<expression id="plugin_ps_006" name="ps_mem">
<expression id="plugin_ps_005" name="ps_mem">
<exp>Utilisation mémoire</exp>
</expression>
<expression id="plugin_ps_006" name="ps_cpu">
<exp>CPU Usage</exp>
</expression>
</tns:translationPlugin>

View File

@@ -3,25 +3,25 @@
<!--
phpSysInfo language file Language: Greek Created by: mojiro
-->
<tns:translationPlugin language="english" charset="utf-8"
<tns:translationPlugin language="greek" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_ps_001" name="ps_title">
<exp>Διεργασίες Συστήματος</exp>
</expression>
<expression id="plugin_ps_002" name="ps_date">
<exp>Ενημέρωση</exp>
</expression>
<expression id="plugin_ps_003" name="ps_command">
<expression id="plugin_ps_002" name="ps_command">
<exp>Εντολή</exp>
</expression>
<expression id="plugin_ps_004" name="ps_pid">
<expression id="plugin_ps_003" name="ps_pid">
<exp>ID Διεργασίας</exp>
</expression>
<expression id="plugin_ps_005" name="ps_ppid">
<expression id="plugin_ps_004" name="ps_ppid">
<exp>ID Κύριας Διεργασίας</exp>
</expression>
<expression id="plugin_ps_006" name="ps_mem">
<expression id="plugin_ps_005" name="ps_mem">
<exp>Χρήση Μνήμης</exp>
</expression>
<expression id="plugin_ps_006" name="ps_cpu">
<exp>Χρήση Επεξεργαστή</exp>
</expression>
</tns:translationPlugin>

View File

@@ -9,19 +9,19 @@
<expression id="plugin_ps_001" name="ps_title">
<exp>Status Procesów</exp>
</expression>
<expression id="plugin_ps_002" name="ps_date">
<exp>Ostatnie odświeżenie</exp>
</expression>
<expression id="plugin_ps_003" name="ps_command">
<expression id="plugin_ps_002" name="ps_command">
<exp>Polecenie</exp>
</expression>
<expression id="plugin_ps_004" name="ps_pid">
<expression id="plugin_ps_003" name="ps_pid">
<exp>PID</exp>
</expression>
<expression id="plugin_ps_005" name="ps_ppid">
<expression id="plugin_ps_004" name="ps_ppid">
<exp>PID rodzica</exp>
</expression>
<expression id="plugin_ps_006" name="ps_mem">
<expression id="plugin_ps_005" name="ps_mem">
<exp>Wykorzystanie pamięci</exp>
</expression>
<expression id="plugin_ps_006" name="ps_cpu">
<exp>Wykorzystanie procesora</exp>
</expression>
</tns:translationPlugin>

View File

@@ -9,19 +9,19 @@
<expression id="plugin_ps_001" name="ps_title">
<exp>Stare proces</exp>
</expression>
<expression id="plugin_ps_002" name="ps_date">
<exp>Ultimul refresh</exp>
</expression>
<expression id="plugin_ps_003" name="ps_command">
<expression id="plugin_ps_002" name="ps_command">
<exp>Comanda</exp>
</expression>
<expression id="plugin_ps_004" name="ps_pid">
<expression id="plugin_ps_003" name="ps_pid">
<exp>ID Proces</exp>
</expression>
<expression id="plugin_ps_005" name="ps_ppid">
<expression id="plugin_ps_004" name="ps_ppid">
<exp>ID Parinte</exp>
</expression>
<expression id="plugin_ps_006" name="ps_mem">
<expression id="plugin_ps_005" name="ps_mem">
<exp>Utilizare Memorie</exp>
</expression>
<expression id="plugin_ps_006" name="ps_cpu">
<exp>CPU Usage</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: en.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!-- $Id: ru.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: Russian Created by: Denis Sevostyanov (den007)
-->
@@ -9,19 +9,19 @@
<expression id="plugin_ps_001" name="ps_title">
<exp>Статус процессов</exp>
</expression>
<expression id="plugin_ps_002" name="ps_date">
<exp>Последнее обновление</exp>
</expression>
<expression id="plugin_ps_003" name="ps_command">
<expression id="plugin_ps_002" name="ps_command">
<exp>Команда</exp>
</expression>
<expression id="plugin_ps_004" name="ps_pid">
<expression id="plugin_ps_003" name="ps_pid">
<exp>ID процесса</exp>
</expression>
<expression id="plugin_ps_005" name="ps_ppid">
<expression id="plugin_ps_004" name="ps_ppid">
<exp>ID родителя</exp>
</expression>
<expression id="plugin_ps_006" name="ps_mem">
<expression id="plugin_ps_005" name="ps_mem">
<exp>Использовано памяти</exp>
</expression>
<expression id="plugin_ps_006" name="ps_cpu">
<exp>CPU Usage</exp>
</expression>
</tns:translationPlugin>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: uk.xml 661 2017-06-03 16:32:39Z namiltd $ -->
<!--
phpSysInfo language file Language: Ukrainian Created by: Rostyslav Gaitkulov (nightfly)
-->
<tns:translationPlugin language="ukrainian" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_ps_001" name="ps_title">
<exp>Стан процесів</exp>
</expression>
<expression id="plugin_ps_002" name="ps_command">
<exp>Команда</exp>
</expression>
<expression id="plugin_ps_003" name="ps_pid">
<exp>ID процесу</exp>
</expression>
<expression id="plugin_ps_004" name="ps_ppid">
<exp>ID батьківський</exp>
</expression>
<expression id="plugin_ps_005" name="ps_mem">
<exp>Використано пам`яті</exp>
</expression>
<expression id="plugin_ps_006" name="ps_cpu">
<exp>CPU Usage</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,27 +1,25 @@
<div class="col-lg-12" id="block_ps" style="display:none">
<div class="panel panel-primary">
<div class="panel-heading">Processes Status</div>
<div class="panel-body">
<table id="ps" class="table table-hover table-condensed sortable">
<thead>
<tr>
<th id="ps_number" class="sorttable_numeric">#</th>
<th>Command</th>
<th class="rightCell sorttable_numeric">Process ID</th>
<th class="rightCell sorttable_numeric">Parent ID</th>
<th class="rightCell sorttable_numeric">Memory Usage</th>
</tr>
</thead>
<tbody id="ps-data">
<tr>
<th><span data-bind="number"></span></th>
<td><span data-bind="Name"></span></td>
<td class="rightCell"><span data-bind="PID"></span></td>
<td class="rightCell"><span data-bind="PPID"></span></td>
<td class="rightCell"><span data-bind="MemoryUsage"></span></td>
</tr>
</tbody>
</table>
<div class="col-lg-12" id="block_ps" style="display:none;">
<div class="card" id="panel_ps" style="display:none;">
<div class="card-header"><span class="lang_plugin_ps_001">Processes Status</span>
<span class="hostname_ps"></span>
<div id="reload_ps" class="reload" title="reload"></div>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="ps" class="table table-hover table-sm">
<thead>
<tr>
<th><span class="lang_plugin_ps_002">Command</span></th>
<th><span class="lang_plugin_ps_003">Process ID</span></th>
<th><span class="lang_plugin_ps_004">Parent ID</span></th>
<th><span class="lang_plugin_ps_005">Memory Usage</span></th>
<th><span class="lang_plugin_ps_006">CPU Usage</span></th>
</tr>
</thead>
<tbody id="ps-data">
</tbody>
</table>
</div>
</div>
</div>
</div>

View File

@@ -1,19 +1,6 @@
<?php
/**
* PSStatus Plugin
*
* PHP version 5
*
* @category PHP
* @package PSI_Plugin_PSStatus
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @version SVN: $Id: class.psstatus.inc.php 692 2012-09-08 17:12:08Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* process Plugin, which displays the status of configured processes
* PSStatus Plugin, which displays the status of configured processes
* a simple view which shows a process name and the status
* status determined by calling the "pidof" command line utility, another way is to provide
* a file with the output of the pidof utility, so there is no need to run a executeable by the
@@ -25,7 +12,7 @@
* @package PSI_Plugin_PSStatus
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
@@ -43,6 +30,12 @@ class PSStatus extends PSI_Plugin
*/
private $_result = array();
/**
* variable, which holds the current codepage
* @var string
*/
private $_enc;
/**
* read the data into an internal array and also call the parent constructor
*
@@ -51,56 +44,85 @@ class PSStatus extends PSI_Plugin
public function __construct($enc)
{
parent::__construct(__CLASS__, $enc);
switch (strtolower(PSI_PLUGIN_PSSTATUS_ACCESS)) {
case 'command':
if (PSI_OS == 'WINNT') {
try {
$objLocator = new COM("WbemScripting.SWbemLocator");
$wmi = $objLocator->ConnectServer();
$process_wmi = $wmi->InstancesOf('Win32_Process');
foreach ($process_wmi as $process) {
$this->_filecontent[] = array(strtolower(trim($process->Caption)), trim($process->ProcessId));
}
} catch (Exception $e) {
$this->_enc = $enc;
if (defined('PSI_PLUGIN_PSSTATUS_PROCESSES') && is_string(PSI_PLUGIN_PSSTATUS_PROCESSES)) {
switch (strtolower(PSI_PLUGIN_PSSTATUS_ACCESS)) {
case 'command':
if (preg_match(ARRAY_EXP, PSI_PLUGIN_PSSTATUS_PROCESSES)) {
$processes = eval(PSI_PLUGIN_PSSTATUS_PROCESSES);
} else {
$processes = array(PSI_PLUGIN_PSSTATUS_PROCESSES);
}
} else {
if (defined('PSI_PLUGIN_PSSTATUS_PROCESSES') && is_string(PSI_PLUGIN_PSSTATUS_PROCESSES)) {
if (preg_match(ARRAY_EXP, PSI_PLUGIN_PSSTATUS_PROCESSES)) {
$processes = eval(PSI_PLUGIN_PSSTATUS_PROCESSES);
} else {
$processes = array(PSI_PLUGIN_PSSTATUS_PROCESSES);
}
if (defined('PSI_PLUGIN_PSSTATUS_USE_REGEX') && PSI_PLUGIN_PSSTATUS_USE_REGEX === true) {
if (((PSI_OS == 'WINNT') && !defined('PSI_EMU_HOSTNAME')) || (defined('PSI_EMU_HOSTNAME') && !defined('PSI_EMU_PORT'))) {
$short = true;
if (strcasecmp($enc, "UTF-8") == 0) {
foreach ($processes as $process) {
CommonFunctions::executeProgram("pgrep", "-n -x ".$process, $buffer, PSI_DEBUG);
if (strlen(trim($buffer)) > 0) {
$this->_filecontent[] = array($process, trim($buffer));
if (mb_strlen($process, "UTF-8") > 15) {
$short = false;
break;
}
}
} else {
foreach ($processes as $process) {
CommonFunctions::executeProgram("pidof", "-s ".$process, $buffer, PSI_DEBUG);
if (strlen(trim($buffer)) > 0) {
$this->_filecontent[] = array($process, trim($buffer));
if (strlen($process) > 15) {
$short = false;
break;
}
}
}
if (!defined('PSI_EMU_HOSTNAME') && $short && CommonFunctions::executeProgram('qprocess', '*', $strBuf, false) && (strlen($strBuf) > 0)) {
$psdata = preg_split("/\r?\n/", $strBuf, -1, PREG_SPLIT_NO_EMPTY);
if (!empty($psdata)) foreach ($psdata as $psline) {
$psvalues = preg_split("/ /", $psline, -1, PREG_SPLIT_NO_EMPTY);
if ((count($psvalues) == 5) && is_numeric($psvalues[3])) {
$this->_filecontent[] = array(strtolower($psvalues[4]), $psvalues[3]);
}
}
}
if (!$short || (count($this->_filecontent) == 0)) {
try {
$wmi = WINNT::getcimv2wmi();
$process_wmi = WINNT::getWMI($wmi, 'Win32_Process', array('Caption', 'ProcessId'));
foreach ($process_wmi as $process) {
$this->_filecontent[] = array(strtolower(trim($process['Caption'])), trim($process['ProcessId']));
}
} catch (Exception $e) {
}
}
} elseif ((PSI_OS != 'WINNT') && (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT'))) {
if (defined('PSI_PLUGIN_PSSTATUS_USE_REGEX') && PSI_PLUGIN_PSSTATUS_USE_REGEX) {
foreach ($processes as $process) {
CommonFunctions::executeProgram("pgrep", "-n -x \"".$process."\"", $buffer, PSI_DEBUG);
if (strlen($buffer) > 0) {
$this->_filecontent[] = array($process, $buffer);
}
}
} else {
foreach ($processes as $process) {
CommonFunctions::executeProgram("pidof", "-s -x \"".$process."\"", $buffer, PSI_DEBUG);
if (strlen($buffer) > 0) {
$this->_filecontent[] = array($process, $buffer);
}
}
}
}
}
break;
case 'data':
CommonFunctions::rfts(APP_ROOT."/data/psstatus.txt", $buffer);
$processes = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY);
foreach ($processes as $process) {
$ps = preg_split("/[\s]?\|[\s]?/", $process, -1, PREG_SPLIT_NO_EMPTY);
if (count($ps) == 2) {
$this->_filecontent[] = array(trim($ps[0]), trim($ps[1]));
break;
case 'data':
if (!defined('PSI_EMU_HOSTNAME')) {
CommonFunctions::rftsdata("psstatus.tmp", $buffer);
$processes = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY);
foreach ($processes as $process) {
$ps = preg_split("/[\s]?\|[\s]?/", $process, -1, PREG_SPLIT_NO_EMPTY);
if (count($ps) == 2) {
$this->_filecontent[] = array(trim($ps[0]), trim($ps[1]));
}
}
}
break;
default:
$this->global_error->addConfigError("__construct()", "[psstatus] ACCESS");
}
break;
default:
$this->global_error->addError("switch(PSI_PLUGIN_PSSTATUS_ACCESS)", "Bad psstatus configuration in phpsysinfo.ini");
break;
}
}
@@ -113,30 +135,31 @@ class PSStatus extends PSI_Plugin
*/
public function execute()
{
if (empty($this->_filecontent)) {
return;
}
if (defined('PSI_PLUGIN_PSSTATUS_PROCESSES') && is_string(PSI_PLUGIN_PSSTATUS_PROCESSES)) {
if (preg_match(ARRAY_EXP, PSI_PLUGIN_PSSTATUS_PROCESSES)) {
$processes = eval(PSI_PLUGIN_PSSTATUS_PROCESSES);
} else {
$processes = array(PSI_PLUGIN_PSSTATUS_PROCESSES);
}
if ((PSI_OS == 'WINNT') && (strtolower(PSI_PLUGIN_PSSTATUS_ACCESS) == 'command')) {
if ((((PSI_OS == 'WINNT') && !defined('PSI_EMU_HOSTNAME')) || (defined('PSI_EMU_HOSTNAME') && !defined('PSI_EMU_PORT'))) &&
(strtolower(PSI_PLUGIN_PSSTATUS_ACCESS) == 'command')) {
$strBuf = PSI_PLUGIN_PSSTATUS_PROCESSES;
if (defined('PSI_EMU_HOSTNAME')) {
WINNT::convertCP($strBuf, $this->_enc);
}
if (preg_match(ARRAY_EXP, $strBuf)) {
$processes = eval($strBuf);
} else {
$processes = array($strBuf);
}
foreach ($processes as $process) {
if ($this->_recursiveinarray(strtolower($process), $this->_filecontent)) {
$this->_result[] = array($process, true);
} else {
$this->_result[] = array($process, false);
}
$this->_result[] = array($process, $this->process_inarray(strtolower($process), $this->_filecontent));
}
} else {
if (preg_match(ARRAY_EXP, PSI_PLUGIN_PSSTATUS_PROCESSES)) {
$processes = eval(PSI_PLUGIN_PSSTATUS_PROCESSES);
} else {
$processes = array(PSI_PLUGIN_PSSTATUS_PROCESSES);
}
foreach ($processes as $process) {
if ($this->_recursiveinarray($process, $this->_filecontent)) {
$this->_result[] = array($process, true);
} else {
$this->_result[] = array($process, false);
}
$this->_result[] = array($process, $this->process_inarray($process, $this->_filecontent));
}
}
}
@@ -149,7 +172,7 @@ class PSStatus extends PSI_Plugin
*/
public function xml()
{
foreach ($this->_result as $ps) {
if (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT') || !empty($this->_filecontent)) foreach ($this->_result as $ps) {
$xmlps = $this->xml->addChild("Process");
$xmlps->addAttribute("Name", $ps[0]);
$xmlps->addAttribute("Status", $ps[1] ? 1 : 0);
@@ -159,17 +182,17 @@ class PSStatus extends PSI_Plugin
}
/**
* checks an array recursive if an value is in, extended version of in_array()
* checks an array if process name is in
*
* @param mixed $needle what to find
* @param array $haystack where to find
*
* @return boolean true - found<br>false - not found
*/
private function _recursiveinarray($needle, $haystack)
private function process_inarray($needle, $haystack)
{
foreach ($haystack as $stalk) {
if ($needle == $stalk || (is_array($stalk) && $this->_recursiveinarray($needle, $stalk))) {
if ($needle === $stalk[0]) {
return true;
}
}

View File

@@ -1,6 +1,6 @@
/*
$Id: psstatus.css 661 2012-08-27 11:26:39Z namiltd $
*/
#plugin_psstatusTable thead tr .header {
#Plugin_PSStatusTable thead tr th {
cursor: pointer;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 992 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 993 B

Some files were not shown because too many files have changed in this diff Show More