Cacti / plugin_thold

Thold Plugin for Cacti
GNU General Public License v2.0
60 stars 60 forks source link

1.8 - Incorrect list of thold in Mangement->Devices #656

Closed xmacan closed 5 months ago

xmacan commented 5 months ago

It seems that new thresholds are displayed correctly. Old threshold (from 1.5 or 1.6) are displayed more times: thold_duplicity

Query is: SELECT pth.thold_template_id, tt.name, tt.id FROM plugin_thold_host AS pth INNER JOIN thold_template AS tt ON tt.id = pth.thold_template_id WHERE pth.host_id = 1048 ORDER BY name;

SQL answer for newly created tholds:

| thold_template_id | name                                       | id |
+-------------------+--------------------------------------------+----+
|                10 | Interface - Errors/Discards [discards_in]  | 10 |
|                11 | Interface - Errors/Discards [discards_out] | 11 |
|                 9 | Interface - Errors/Discards [errors_in]    |  9 |
|                12 | Interface - Errors/Discards [errors_out]   | 12 |
+-------------------+--------------------------------------------+----+```

SQL answer for old tholds:
```+-------------------+--------------------------------------------+----+
| thold_template_id | name                                       | id |
+-------------------+--------------------------------------------+----+
|                10 | Interface - Errors/Discards [discards_in]  | 10 |
|                10 | Interface - Errors/Discards [discards_in]  | 10 |
|                10 | Interface - Errors/Discards [discards_in]  | 10 |
|                10 | Interface - Errors/Discards [discards_in]  | 10 |
|                10 | Interface - Errors/Discards [discards_in]  | 10 |
|                10 | Interface - Errors/Discards [discards_in]  | 10 |
|                10 | Interface - Errors/Discards [discards_in]  | 10 |
|                11 | Interface - Errors/Discards [discards_out] | 11 |
|                11 | Interface - Errors/Discards [discards_out] | 11 |
|                11 | Interface - Errors/Discards [discards_out] | 11 |
|                11 | Interface - Errors/Discards [discards_out] | 11 |
|                11 | Interface - Errors/Discards [discards_out] | 11 |
|                11 | Interface - Errors/Discards [discards_out] | 11 |
|                11 | Interface - Errors/Discards [discards_out] | 11 |
|                 9 | Interface - Errors/Discards [errors_in]    |  9 |
|                 9 | Interface - Errors/Discards [errors_in]    |  9 |
|                 9 | Interface - Errors/Discards [errors_in]    |  9 |
|                 9 | Interface - Errors/Discards [errors_in]    |  9 |
|                 9 | Interface - Errors/Discards [errors_in]    |  9 |
|                 9 | Interface - Errors/Discards [errors_in]    |  9 |
|                 9 | Interface - Errors/Discards [errors_in]    |  9 |
|                12 | Interface - Errors/Discards [errors_out]   | 12 |
|                12 | Interface - Errors/Discards [errors_out]   | 12 |
|                12 | Interface - Errors/Discards [errors_out]   | 12 |
|                12 | Interface - Errors/Discards [errors_out]   | 12 |
|                12 | Interface - Errors/Discards [errors_out]   | 12 |
|                12 | Interface - Errors/Discards [errors_out]   | 12 |
|                12 | Interface - Errors/Discards [errors_out]   | 12 |
+-------------------+--------------------------------------------+----+
xmacan commented 5 months ago

workaround is in setup.php in function thold_device_edit_pre_bottom() about line 1242 change: $threshold_templates = db_fetch_assoc_prepared('SELECT pth.thold_template_id, tt.name ... to $threshold_templates = db_fetch_assoc_prepared('SELECT distinctrow pth.thold_template_id, tt.name ....

TheWitness commented 5 months ago

Should be fixed now.