iobroker.js-controller
Version:
Updated by reinstall.js on 2018-06-11T15:19:56.688Z
414 lines (413 loc) • 10.2 kB
JavaScript
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var objects_exports = {};
__export(objects_exports, {
getHostObjects: () => getHostObjects
});
module.exports = __toCommonJS(objects_exports);
var import_fs_extra = __toESM(require("fs-extra"), 1);
var import_utils = require("../lib/utils.js");
var import_js_controller_common_db = require("@iobroker/js-controller-common-db");
function getHostObjects(options) {
const { id, hostname, isCompactGroupController, config } = options;
const objs = [];
if (!isCompactGroupController) {
objs.push({
_id: `${id}.compactModeEnabled`,
type: "state",
common: {
name: "Controller - compact mode enabled",
type: "boolean",
read: true,
write: false,
role: "indicator"
},
native: {}
});
objs.push({
_id: `${id}.compactgroupProcesses`,
type: "state",
common: {
name: "Controller - number of compact group controllers",
type: "number",
read: true,
write: false,
min: 0,
role: "value",
unit: "processes"
},
native: {}
});
objs.push({
_id: `${id}.nodeVersion`,
type: "state",
common: {
name: "Controller - Node.js version",
type: "string",
read: true,
write: false,
desc: "Node.js version of the host process.",
role: "state"
},
native: {}
});
objs.push({
_id: `${id}.osPackageUpdates`,
type: "state",
common: {
name: "Available OS package updates",
type: "array",
read: true,
write: false,
desc: 'The output of the "update" command from the package manager like apt or yum',
role: "state"
},
native: {}
});
}
objs.push({
_id: `${id}.instancesAsProcess`,
type: "state",
common: {
name: "Controller - number of instance processes",
type: "number",
read: true,
write: false,
min: 0,
role: "value",
unit: "processes"
},
native: {}
});
objs.push({
_id: `${id}.instancesAsCompact`,
type: "state",
common: {
name: "Controller - number of instances started in this host process",
type: "number",
read: true,
write: false,
min: 0,
role: "value",
unit: "instances"
},
native: {}
});
objs.push({
_id: `${id}.cpu`,
type: "state",
common: {
name: "Controller - cpu usage in % of one core",
type: "number",
read: true,
write: false,
min: 0,
role: "value",
unit: "% of one core"
},
native: {}
});
objs.push({
_id: `${id}.cputime`,
type: "state",
common: {
name: "Controller - accumulated cputime in seconds",
type: "number",
read: true,
write: false,
min: 0,
role: "value",
unit: "seconds"
},
native: {}
});
objs.push({
_id: `${id}.mem`,
type: "state",
common: {
type: "number",
role: "value",
name: `${hostname} - memory usage in %`,
unit: "%",
read: true,
write: false,
min: 0,
max: 100
},
native: {}
});
objs.push({
_id: `${id}.memHeapUsed`,
type: "state",
common: {
type: "number",
role: "value",
name: "Controller - heap memory used in MB",
read: true,
write: false,
min: 0,
unit: "MB"
},
native: {}
});
if (import_fs_extra.default.existsSync("/proc/meminfo")) {
objs.push({
_id: `${id}.memAvailable`,
type: "state",
common: {
type: "number",
role: "value",
name: `${hostname} - available memory from /proc/meminfo in MB`,
read: true,
write: false,
min: 0,
unit: "MB"
},
native: {}
});
}
objs.push({
_id: `${id}.memHeapTotal`,
type: "state",
common: {
type: "number",
role: "value",
name: "Controller - heap memory reserved in MB",
read: true,
write: false,
min: 0,
unit: "MB"
},
native: {}
});
objs.push({
_id: `${id}.memRss`,
type: "state",
common: {
type: "number",
role: "value",
name: "Controller - resident set size memory in MB",
desc: "RSS is the resident set size, the portion of the process's memory held in RAM",
read: true,
write: false,
min: 0,
unit: "MB"
},
native: {}
});
objs.push({
_id: `${id}.uptime`,
type: "state",
common: {
type: "number",
role: "value",
name: "Controller - uptime in seconds",
read: true,
write: false,
min: 0,
unit: "seconds"
},
native: {}
});
objs.push({
_id: `${id}.load`,
type: "state",
common: {
unit: "",
type: "number",
role: "value",
read: true,
write: false,
name: `${hostname} - load average 1min`
},
native: {}
});
objs.push({
_id: `${id}.alive`,
type: "state",
common: {
name: `${hostname} - alive status`,
read: true,
write: false,
type: "boolean",
role: "indicator"
},
native: {}
});
objs.push({
_id: `${id}.freemem`,
type: "state",
common: {
name: `${hostname} - available RAM in MB`,
unit: "MB",
read: true,
write: false,
type: "number",
role: "value"
},
native: {}
});
objs.push({
_id: `${id}.inputCount`,
type: "state",
common: {
name: "Controller - input level in events/15 seconds",
desc: "State's inputs in 15 seconds",
type: "number",
read: true,
write: false,
role: "value",
unit: "events/15 seconds"
},
native: {}
});
objs.push({
_id: `${id}.outputCount`,
type: "state",
common: {
name: "Controller - output level in events/15 seconds",
desc: "State's outputs in 15 seconds",
type: "number",
read: true,
write: false,
role: "value",
unit: "events/15 seconds"
},
native: {}
});
objs.push({
_id: `${id}.eventLoopLag`,
type: "state",
common: {
name: "Controller - The Node.js event loop lag in ms, averaged over 15 seconds",
desc: "Average Node.js event loop lag in ms",
type: "number",
read: true,
write: false,
role: "value",
unit: "ms"
},
native: {}
});
objs.push({
_id: `${id}.logLevel`,
type: "state",
common: {
name: "Controller - Loglevel",
type: "string",
read: true,
write: true,
desc: "Loglevel of the host process. Will be set on start with defined value but can be overridden during runtime",
role: "state"
},
native: {}
});
objs.push({
_id: `${id}.pid`,
type: "state",
common: {
name: "Controller - Process ID",
type: "number",
read: true,
write: false,
role: "value"
},
native: {},
state: {
val: process.pid,
ack: true
}
});
if (config.system.checkDiskInterval) {
objs.push({
_id: `${id}.diskSize`,
type: "state",
common: {
name: `${hostname} - disk total size`,
desc: "Disk size of logical volume where the server is installed in MiB",
type: "number",
read: true,
write: false,
role: "value",
unit: "MiB"
},
native: {}
});
objs.push({
_id: `${id}.diskFree`,
type: "state",
common: {
name: `${hostname} - disk free size`,
desc: "Free disk size of the logical volume where the server is installed in MiB",
type: "number",
read: true,
write: false,
role: "value",
unit: "MiB"
},
native: {}
});
objs.push({
_id: `${id}.diskWarning`,
type: "state",
common: {
name: `${hostname} - disk warning level`,
desc: "Generate a warning if the free disk space is below this value",
type: "number",
read: true,
write: true,
def: import_utils.DEFAULT_DISK_WARNING_LEVEL,
role: "level",
unit: "%"
},
native: {}
});
}
if (import_js_controller_common_db.tools.getDockerInformation().isOfficial) {
objs.push({
_id: `${id}.availableDockerBuild`,
type: "state",
common: {
name: "Last update of the Docker Image",
desc: "The timestamp of the last update of the Docker Image",
type: "string",
read: true,
write: false,
role: "date"
},
native: {}
});
}
return objs;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getHostObjects
});
//# sourceMappingURL=objects.js.map