plugin_thold
plugin_thold copied to clipboard
Thold entry displayed moretimes
In few cases I see thold displayed more times:

Problem is in function get_allowed_thresholds in sql query.
If I create users and set default policy to deny and allow only host or graphs, thold plugin will display thold moretimes because of quey:
SELECT
td.*, dtd.rrd_step, tt.name AS template_name, dtr.data_source_name AS data_source, IF(IFNULL(td.`lastread`,'')='',NULL,
(td.`lastread` + 0.0)) AS `flastread`, IF(IFNULL(td.`oldvalue`,'')='',NULL,(td.`oldvalue` + 0.0)) AS `foldvalue`,
UNIX_TIMESTAMP() - UNIX_TIMESTAMP(lastchanged) AS `instate`, **uap0.user_id AS user0,
uap1.user_id AS user1, uap2.user_id AS user2**
FROM thold_data AS td INNER JOIN graph_local AS gl ON gl.id=td.local_graph_id
LEFT JOIN graph_templates AS gt ON gt.id=gl.graph_template_id
LEFT JOIN host AS h ON h.id=gl.host_id
LEFT JOIN thold_template AS tt ON tt.id=td.thold_template_id
LEFT JOIN data_template_data AS dtd ON dtd.local_data_id=td.local_data_id
LEFT JOIN data_template_rrd AS dtr ON dtr.id=td.data_template_rrd_id
LEFT JOIN user_auth_perms AS uap0 ON (gl.id=uap0.item_id AND uap0.type=1)
LEFT JOIN user_auth_perms AS uap1 ON (gl.host_id=uap1.item_id AND uap1.type=3)
LEFT JOIN user_auth_perms AS uap2 ON (gl.graph_template_id=uap2.item_id AND uap2.type=4)
WHERE (td.host_id = 415) HAVING (**user0 IS NULL OR (user1 IS NULL OR user2 IS NULL**)) ORDER BY `name_cache` ASC LIMIT 0,100;
Add users causes that in userX columns is more than one id and row will be twice in SQL result.
cacti 1.2.23 thold 1.6