[autofix.ci] apply automated fixes
This commit is contained in:
parent
1ce2b10a10
commit
b8ee80fd76
@ -140,7 +140,11 @@ async function createTables() {
|
||||
table.integer("ping");
|
||||
table.integer("duration").notNullable().defaultTo(0);
|
||||
table.integer("down_count").notNullable().defaultTo(0);
|
||||
table.float("numeric_value").nullable().defaultTo(null).comment("Numeric value from monitor check (e.g., from JSON query or SNMP)");
|
||||
table
|
||||
.float("numeric_value")
|
||||
.nullable()
|
||||
.defaultTo(null)
|
||||
.comment("Numeric value from monitor check (e.g., from JSON query or SNMP)");
|
||||
|
||||
table.index("important");
|
||||
table.index(["monitor_id", "time"], "monitor_time_index");
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.alterTable("heartbeat", function (table) {
|
||||
table.float("numeric_value").nullable().defaultTo(null).comment("Numeric value from monitor check (e.g., from JSON query or SNMP)");
|
||||
table
|
||||
.float("numeric_value")
|
||||
.nullable()
|
||||
.defaultTo(null)
|
||||
.comment("Numeric value from monitor check (e.g., from JSON query or SNMP)");
|
||||
});
|
||||
};
|
||||
|
||||
@ -9,4 +13,3 @@ exports.down = function (knex) {
|
||||
table.dropColumn("numeric_value");
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -66,8 +66,14 @@ module.exports.chartSocketHandler = (socket) => {
|
||||
.filter((entry) => entry.avgNumeric !== null && entry.avgNumeric !== undefined)
|
||||
.map((entry) => ({
|
||||
value: parseFloat(entry.avgNumeric),
|
||||
min: entry.minNumeric !== null && entry.minNumeric !== undefined ? parseFloat(entry.minNumeric) : null,
|
||||
max: entry.maxNumeric !== null && entry.maxNumeric !== undefined ? parseFloat(entry.maxNumeric) : null,
|
||||
min:
|
||||
entry.minNumeric !== null && entry.minNumeric !== undefined
|
||||
? parseFloat(entry.minNumeric)
|
||||
: null,
|
||||
max:
|
||||
entry.maxNumeric !== null && entry.maxNumeric !== undefined
|
||||
? parseFloat(entry.maxNumeric)
|
||||
: null,
|
||||
timestamp: entry.timestamp,
|
||||
time: dayjs.unix(entry.timestamp).utc().format("YYYY-MM-DD HH:mm:ss"),
|
||||
}));
|
||||
|
||||
@ -143,7 +143,8 @@ class UptimeCalculator {
|
||||
avgNumeric: bean.numeric_value,
|
||||
minNumeric: bean.numeric_min,
|
||||
maxNumeric: bean.numeric_max,
|
||||
sumNumeric: bean.numeric_value !== null && bean.numeric_value !== undefined ? bean.numeric_value * bean.up : 0,
|
||||
sumNumeric:
|
||||
bean.numeric_value !== null && bean.numeric_value !== undefined ? bean.numeric_value * bean.up : 0,
|
||||
};
|
||||
|
||||
if (bean.extras != null) {
|
||||
@ -173,7 +174,8 @@ class UptimeCalculator {
|
||||
avgNumeric: bean.numeric_value,
|
||||
minNumeric: bean.numeric_min,
|
||||
maxNumeric: bean.numeric_max,
|
||||
sumNumeric: bean.numeric_value !== null && bean.numeric_value !== undefined ? bean.numeric_value * bean.up : 0,
|
||||
sumNumeric:
|
||||
bean.numeric_value !== null && bean.numeric_value !== undefined ? bean.numeric_value * bean.up : 0,
|
||||
};
|
||||
|
||||
if (bean.extras != null) {
|
||||
@ -202,7 +204,8 @@ class UptimeCalculator {
|
||||
avgNumeric: bean.numeric_value,
|
||||
minNumeric: bean.numeric_min,
|
||||
maxNumeric: bean.numeric_max,
|
||||
sumNumeric: bean.numeric_value !== null && bean.numeric_value !== undefined ? bean.numeric_value * bean.up : 0,
|
||||
sumNumeric:
|
||||
bean.numeric_value !== null && bean.numeric_value !== undefined ? bean.numeric_value * bean.up : 0,
|
||||
};
|
||||
|
||||
if (bean.extras != null) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user