alerts
This commit is contained in:
1 parent
a86588f080
commit
c2487f0134
2 files changed
+1
-4
No files matched your search
@@ -24,7 +24,6 @@ class SuperSimpleQueueHelper {
|
|||||||
notificationsService,
|
notificationsService,
|
||||||
checkService,
|
checkService,
|
||||||
buffer,
|
buffer,
|
||||||
incidentService,
|
|
||||||
}: {
|
}: {
|
||||||
db: any;
|
db: any;
|
||||||
logger: any;
|
logger: any;
|
||||||
@@ -34,7 +33,6 @@ class SuperSimpleQueueHelper {
|
|||||||
notificationsService: INotificationsService;
|
notificationsService: INotificationsService;
|
||||||
checkService: any;
|
checkService: any;
|
||||||
buffer: any;
|
buffer: any;
|
||||||
incidentService: any;
|
|
||||||
}) {
|
}) {
|
||||||
this.db = db;
|
this.db = db;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
@@ -44,7 +42,6 @@ class SuperSimpleQueueHelper {
|
|||||||
this.checkService = checkService;
|
this.checkService = checkService;
|
||||||
this.buffer = buffer;
|
this.buffer = buffer;
|
||||||
this.notificationsService = notificationsService;
|
this.notificationsService = notificationsService;
|
||||||
this.incidentService = incidentService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get serviceName() {
|
get serviceName() {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const buildHardwareAlerts = async (clientHost: string, monitor: Monitor, network
|
|||||||
const metrics = payload.data || {};
|
const metrics = payload.data || {};
|
||||||
const { cpu: { usage_percent: cpuUsage = -1 } = {}, memory: { usage_percent: memoryUsage = -1 } = {}, disk = [] } = metrics;
|
const { cpu: { usage_percent: cpuUsage = -1 } = {}, memory: { usage_percent: memoryUsage = -1 } = {}, disk = [] } = metrics;
|
||||||
|
|
||||||
const alerts = {
|
const alerts: Record<string, boolean> = {
|
||||||
cpu: cpuThreshold !== -1 && cpuUsage > cpuThreshold ? true : false,
|
cpu: cpuThreshold !== -1 && cpuUsage > cpuThreshold ? true : false,
|
||||||
memory: memoryThreshold !== -1 && memoryUsage > memoryThreshold ? true : false,
|
memory: memoryThreshold !== -1 && memoryUsage > memoryThreshold ? true : false,
|
||||||
disk: disk?.some((d) => diskThreshold !== -1 && typeof d?.usage_percent === "number" && d?.usage_percent > diskThreshold) ?? false,
|
disk: disk?.some((d) => diskThreshold !== -1 && typeof d?.usage_percent === "number" && d?.usage_percent > diskThreshold) ?? false,
|
||||||
|
|||||||
Reference in new issue
Block a user