@d3ltoroxp
Ich mache sowas um von Proxmox den freien Ram auszulesen.
Aber mit ssh2.
Vielleicht kannst du damit was anfangen.
function GB_holen() {
const { Client } = require('ssh2');
const conn = new Client();
conn.on('ready', () => {
//console.log('Client :: ready');
conn.exec('free -m', function(err, stream) {
if (err) throw err;
stream.on('close', function(code, signal) {
conn.end();
}).on('data', function(data) {
//log('Ausgabe: ' + data);
var wert = data.toString(); var arr = wert.split("Swap");
wert = parseInt(wert.substring(arr[0].lastIndexOf(" ")+1,arr[0].length-1));
setState("javascript.0.System.Proxmox.VM_iob_Ram_frei", wert);
log('VM_iobroker: ' + wert + " MB Ram frei");
}).stderr.on('data', function(data) {
log('Fehler: ' + data);
});
});
}).connect({
host: '192.168.xxx.xx',
port: 22,
username: 'xxx',
password: 'xxx'
});
}
schedule('*/5 * * * *', function () {
GB_holen();
});