/** * @api {post} /api/v1/system/disk * @apiName getDiskUsage * @apiGroup System */ async function getDiskSpace(req, res) { const diskSpace = await gladys.system.getDiskSpace(); res.json(diskSpace); }
/** * @api {get} /api/v1/system/upgrade/download/status * @apiName getContainers * @apiGroup System */ async function getUpgradeDownloadStatus(req, res) { res.json({ error: gladys.system.downloadUpgradeError, upgrade_finished: gladys.system.downloadUpgradeFinished, last_event: gladys.system.downloadUpgradeLastEvent, }); }
updateInfo() { window.si.system().then(d => { window.si.chassis().then(e => { document.getElementById("mod_hardwareInspector_manufacturer").innerText = this._trimDataString(d.manufacturer); document.getElementById("mod_hardwareInspector_model").innerText = this._trimDataString(d.model, d.manufacturer, e.type); document.getElementById("mod_hardwareInspector_chassis").innerText = e.type; }); }); }
// Use this one metric's `collect` to set all metrics' values. collect() { const cpuUsage = process.cpuUsage(); const userUsageMicros = cpuUsage.user - lastCpuUsage.user; const systemUsageMicros = cpuUsage.system - lastCpuUsage.system; lastCpuUsage = cpuUsage; cpuUserUsageCounter.inc(userUsageMicros / 1e6); cpuSystemUsageCounter.inc(systemUsageMicros / 1e6); cpuUsageCounter.inc((userUsageMicros + systemUsageMicros) / 1e6); }
/** * @description Check if Gladys network on Docker is well configured for embedded broker. * @returns {Promise} Promise with true if network is usable. * @example * checkDockerNetwork(); */ async function checkDockerNetwork() { const gladysNetworkMode = await this.gladys.system.getNetworkMode(); return gladysNetworkMode === 'host'; }
/** * @api {post} /api/v1/system/shutdown * @apiName shutdownSystem * @apiGroup System */ async function shutdown(req, res) { res.json({ success: true, message: 'System will shutdown soon', }); gladys.system.shutdown(); }
/** * @api {post} /api/v1/system/info * @apiName getSystemInfos * @apiGroup System */ async function getSystemInfos(req, res) { const infos = await gladys.system.getInfos(); res.json(infos); }
/** * @api {get} /api/v1/system/container * @apiName getContainers * @apiGroup System */ async function getContainers(req, res) { const containers = await gladys.system.getContainers(); res.json(containers); }
/** * @description Check if Gladys network on Docker is well configured for embedded broker. * @returns {Promise} Promise with true if network is usable. * @example * checkDockerNetwork(); */ async function checkDockerNetwork() { const gladysNetworkMode = await this.gladys.system.getNetworkMode(); return gladysNetworkMode === 'host'; }
/** * @api {post} /api/v1/system/info * @apiName getSystemInfos * @apiGroup System */ async function getSystemInfos(req, res) { const infos = await gladys.system.getInfos(); res.json(infos); }
updateInfo() { window.si.system().then(d => { window.si.chassis().then(e => { document.getElementById("mod_hardwareInspector_manufacturer").innerText = this._trimDataString(d.manufacturer); document.getElementById("mod_hardwareInspector_model").innerText = this._trimDataString(d.model, d.manufacturer, e.type); document.getElementById("mod_hardwareInspector_chassis").innerText = e.type; }); }); }
/** * @api {post} /api/v1/system/disk * @apiName getDiskUsage * @apiGroup System */ async function getDiskSpace(req, res) { const diskSpace = await gladys.system.getDiskSpace(); res.json(diskSpace); }
/** * @api {get} /api/v1/system/container * @apiName getContainers * @apiGroup System */ async function getContainers(req, res) { const containers = await gladys.system.getContainers(); res.json(containers); }
/** * @api {get} /api/v1/system/upgrade/download/status * @apiName getContainers * @apiGroup System */ async function getUpgradeDownloadStatus(req, res) { res.json({ error: gladys.system.downloadUpgradeError, upgrade_finished: gladys.system.downloadUpgradeFinished, last_event: gladys.system.downloadUpgradeLastEvent, }); }
/** * @api {post} /api/v1/system/shutdown * @apiName shutdownSystem * @apiGroup System */ async function shutdown(req, res) { res.json({ success: true, message: 'System will shutdown soon', }); gladys.system.shutdown(); }