11--
2- -- (C) 2019-24 - ntop.org
2+ -- (C) 2019-25 - ntop.org
33--
44
55local alert_consts = require (" alert_consts" )
66local alerts_api = require (" alerts_api" )
77local alert_categories = require " alert_categories"
88
99local script = {
10- -- Script category
11- category = alert_categories .internals ,
12- severity = alert_consts .get_printable_severities ().warning ,
10+ -- Script category
11+ category = alert_categories .internals ,
12+ severity = alert_consts .get_printable_severities ().warning ,
1313
14- hooks = {},
14+ hooks = {},
1515
16- gui = {
17- i18n_title = " alerts_dashboard.redis_reads_writes_exceeded" ,
18- i18n_description = " alerts_dashboard.redis_reads_writes_exceeded_descr" ,
19- }
16+ gui = {
17+ i18n_title = " alerts_dashboard.redis_reads_writes_exceeded" ,
18+ i18n_description = " alerts_dashboard.redis_reads_writes_exceeded_descr" ,
19+ }
2020}
2121
2222-- #################################################################
@@ -40,6 +40,18 @@ local function check_redis_reads_writes_exceeded(params)
4040 schema = ' redis:reads_writes_v2'
4141 }
4242 local ts = ts_utils .timeseries_query (options )
43+ -- Sanity checks
44+ if not ts
45+ or not ts .series
46+ or not ts .series [1 ]
47+ or not ts .series [2 ]
48+ or not ts .series [1 ].statistics
49+ or not ts .series [2 ].statistics
50+ or ts .series [1 ].statistics .average == nil
51+ or ts .series [2 ].statistics .average == nil
52+ then
53+ return
54+ end
4355 -- Check if the day target is nan
4456 if not ts or not (ts .series [1 ].data [7 ] == ts .series [1 ].data [7 ]) then
4557 return
0 commit comments