Commit 6c15723a authored by Rizwan Shakoor's avatar Rizwan Shakoor

Added new grafana rule

parent 0a9c2135
local alert_model_data = import '../alerts-config/alert_condition.libsonnet';
local alert_data = import '../alerts-config/alert_model.libsonnet';
local alert_test = import '../alerts-config/alert_rule.libsonnet';
local my_alert_condition_A = alert_model_data.new(
evaluatorParams=null,
evaluatorType='gt',
operatorType='and',
queryRefId='B',
reducerParams=[],
reducerType='last',
);
local uid = 122334;
local my_alert_condition_B = alert_model_data.new(
evaluatorParams=10,
evaluatorType='gt',
operatorType='and',
queryRefId='C',
queryTimeStart=null,
queryTimeEnd=null,
reducerParams=[],
reducerType='last',
);
alert_test.new(
id=uid,
uid='test_uid' + uid,
orgID=1,
folderUID='ab_xyz1234',
ruleGroup='my_alert-jvm-threads',
title='alert_for_thread_state',
condition='C',
updated='2023-04-09T15:52:13+05:00',
noDataState='NoData',
panelId='4',
execErrState='Error',
isPaused=false,
dashboardUid='ABCJVM123',
interval='2m',
annotationDesc='Runnable threads are breaching the limit',
annotationSummary='Thread State Test'
).addAlertCondition(
alert_data.new(
refId='A',
from=600,
to=0,
datasourceUid='Dxn-4VYVk',
editorMode='code',
expr='jvm_threads_states_threads{state="runnable"}',
hide='false',
intervalMs=2000,
legendFormat='__auto',
maxDataPoints=43200,
range=true
)
).addAlertCondition(
alert_data.new(
refId='B',
from=600,
to=0,
datasourceUid='__expr__',
expression='A',
hide=false,
intervalMs=1000,
maxDataPoints=43200,
reducer='max',
type='reduce',
modelCondition=my_alert_condition_A
)
).addAlertCondition(
alert_data.new(
refId='C',
from=600,
to=0,
datasourceUid='__expr__',
expression='B',
hide=false,
intervalMs=1000,
maxDataPoints=43200,
type='threshold',
modelCondition=my_alert_condition_B
)
) + {
'for': '5m',
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment