Can ! change the config of any widget or generate new?
When clic in config show this:
$widget['widget_config']ajax/actions/edit_widget.inc.php:146
array()
Hi,
There was never any configuration infrastructure written for the widgets. This was intended but ended up being a pretty large problem to solve.
Some widgets will accept some options in a json format inserted into the database directly where things have been added on request, but generating configuration forms for them and handling them securely isn't something we've been able to implement yet.
For a couple of widgets these are obvious, like for example the syslog/eventlog/etc widgets, which just take the same arguments as their respective main pages.
Thanks, adam.
jose.napoli--- via observium wrote on 09/09/2024 19:12:
Can ! change the config of any widget or generate new?
When clic in config show this:
$widget['widget_config']ajax/actions/edit_widget.inc.php:146
array() _______________________________________________ observium mailing list -- observium@lists.observium.org To unsubscribe send an email to observium-leave@lists.observium.org
Hi Adam,
Can you tell me if this is Ok?
l> SELECT * FROM dash_widgets; +-----------+---------+------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+------+-------+--------+ | widget_id | dash_id | widget_type | widget_config | x | y | width | height | +-----------+---------+------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+------+-------+--------+ | 2 | 1 | status_summary | {} | 0 | 0 | 12 | 8 | | 3 | 1 | map | {} | 0 | 8 | 12 | 8 | | 4 | 1 | old_status_boxes | {} | 0 | 16 | 12 | 3 | | 5 | 1 | old_status_table | {} | 0 | 19 | 12 | 8 | | 6 | 1 | eventlog | {} | 0 | 27 | 12 | 8 | | 32 | 5 | status_summary | [] | 7 | 18 | 5 | 3 | | 33 | 5 | old_status_table | [] | 0 | 0 | 12 | 18 | | 34 | 5 | old_status_boxes | [] | 0 | 24 | 12 | 10 | | 54 | 5 | alertlog | [] | 0 | 18 | 7 | 6 | | 66 | 1 | alert_table | [] | 0 | 35 | 4 | 3 | | 67 | 1 | alert_boxes | [] | 4 | 35 | 4 | 3 | | 87 | 10 | alert_boxes | [] | 5 | 0 | 6 | 14 | | 92 | 10 | status_summary | [] | 1 | 13 | 4 | 3 | | 93 | 10 | alert_table | [] | 0 | 0 | 5 | 13 | | 94 | 10 | old_status_table | [] | 5 | 14 | 5 | 7 | | 107 | 10 | alert_table | [] | 0 | 16 | 4 | 3 | | 109 | 14 | alert_table | [] | 0 | 0 | 5 | 7 | | 119 | 15 | alert_boxes | { "conditions": [ {"metric": "processor_usage", "comparison": "ge", "value": 90, "message": "CPU usage exceeded 90%"}, {"metric": "mempool_perc", "comparison": "greater", "value": 90, "message": "Memory usage exceeded 90%"} ], "status": "critical" } | 0 | 0 | 8 | 17 | +-----------+---------+------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+------+-------+--------+ 18 rows in set (0,00 sec)
Because I keep seeing that the widget of dash 15 keeps showing other alerts instead of the ones I injected in the conditions
Fixed!!
Add another 'Alert boxes' and I set the conditions separately
UPDATE dash_widgets SET widget_config = '{ "conditions": [ {"metric": "processor_usage", "comparison": "ge", "value": 90, "message": "CPU usage exceeded 90%"} ], "status": "critical" }' WHERE widget_id = 119;
UPDATE dash_widgets SET widget_config = '{ "conditions": [ {"metric": "mempool_perc", "comparison": "greater", "value": 90, "message": "Memory usage exceeded 90%"} ], "status": "critical" }' WHERE widget_id = 120;
-----------------------------------
SELECT * FROM dash_widgets;
+-----------+---------+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+------+-------+--------+ | widget_id | dash_id | widget_type | widget_config | x | y | width | height | +-----------+---------+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+------+-------+--------+ | 2 | 1 | status_summary | {} | 0 | 0 | 12 | 8 | | 3 | 1 | map | {} | 0 | 8 | 12 | 8 | | 4 | 1 | old_status_boxes | {} | 0 | 16 | 12 | 3 | | 5 | 1 | old_status_table | {} | 0 | 19 | 12 | 8 | | 6 | 1 | eventlog | {} | 0 | 27 | 12 | 8 | | 32 | 5 | status_summary | [] | 7 | 18 | 5 | 3 | | 33 | 5 | old_status_table | [] | 0 | 0 | 12 | 18 | | 34 | 5 | old_status_boxes | [] | 0 | 24 | 12 | 10 | | 54 | 5 | alertlog | [] | 0 | 18 | 7 | 6 | | 66 | 1 | alert_table | [] | 0 | 35 | 4 | 3 | | 67 | 1 | alert_boxes | [] | 4 | 35 | 4 | 3 | | 87 | 10 | alert_boxes | [] | 5 | 0 | 6 | 14 | | 92 | 10 | status_summary | [] | 1 | 13 | 4 | 3 | | 93 | 10 | alert_table | [] | 0 | 0 | 5 | 13 | | 94 | 10 | old_status_table | [] | 5 | 14 | 5 | 7 | | 107 | 10 | alert_table | [] | 0 | 16 | 4 | 3 | | 109 | 14 | alert_table | [] | 0 | 0 | 5 | 7 | | 119 | 15 | alert_boxes | { "conditions": [ {"metric": "processor_usage", "comparison": "ge", "value": 90, "message": "CPU usage exceeded 90%"} ], "status": "critical" } | 0 | 0 | 10 | 15 | | 120 | 15 | alert_boxes | { "conditions": [ {"metric": "mempool_perc", "comparison": "greater", "value": 90, "message": "Memory usage exceeded 90%"} ], "status": "critical" } | 0 | 15 | 12 | 21 | +-----------+---------+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+------+-------+--------+ 19 rows in set (0,00 sec)
Fixed!!
Add another widget 'Alert boxes' in dash 15 and I set the conditions separately
UPDATE dash_widgets SET widget_config = '{ "conditions": [ {"metric": "processor_usage", "comparison": "ge", "value": 90, "message": "CPU usage exceeded 90%"} ], "status": "critical" }' WHERE widget_id = 119;
UPDATE dash_widgets SET widget_config = '{ "conditions": [ {"metric": "mempool_perc", "comparison": "greater", "value": 90, "message": "Memory usage exceeded 90%"} ], "status": "critical" }' WHERE widget_id = 120;
-----------------------------
SELECT * FROM dash_widgets where dash_id=15;
+-----------+---------+-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+------+-------+--------+ | widget_id | dash_id | widget_type | widget_config | x | y | width | height | +-----------+---------+-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+------+-------+--------+ | 119 | 15 | alert_boxes | { "conditions": [ {"metric": "processor_usage", "comparison": "ge", "value": 90, "message": "CPU usage exceeded 90%"} ], "status": "critical" } | 0 | 0 | 10 | 15 | | 120 | 15 | alert_boxes | { "conditions": [ {"metric": "mempool_perc", "comparison": "greater", "value": 90, "message": "Memory usage exceeded 90%"} ], "status": "critical" } | 0 | 15 | 10 | 16 | +-----------+---------+-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+------+-------+--------+ 2 rows in set (0,00 sec)
What made you think the alert widget will understand any of that?
😵💫
Sent from my iPhone
On 2 Oct 2024, at 14:44, Jose Napoli via observium observium@lists.observium.org wrote:
Hi Adam,
Can you tell me if this is Ok?
l> SELECT * FROM dash_widgets; +-----------+---------+------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+------+-------+--------+ | widget_id | dash_id | widget_type | widget_config | x | y | width | height | +-----------+---------+------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+------+-------+--------+ | 2 | 1 | status_summary | {} | 0 | 0 | 12 | 8 | | 3 | 1 | map | {} | 0 | 8 | 12 | 8 | | 4 | 1 | old_status_boxes | {} | 0 | 16 | 12 | 3 | | 5 | 1 | old_status_table | {} | 0 | 19 | 12 | 8 | | 6 | 1 | eventlog | {} | 0 | 27 | 12 | 8 | | 32 | 5 | status_summary | [] | 7 | 18 | 5 | 3 | | 33 | 5 | old_status_table | [] | 0 | 0 | 12 | 18 | | 34 | 5 | old_status_boxes | [] | 0 | 24 | 12 | 10 | | 54 | 5 | alertlog | [] | 0 | 18 | 7 | 6 | | 66 | 1 | alert_table | [] | 0 | 35 | 4 | 3 | | 67 | 1 | alert_boxes | [] | 4 | 35 | 4 | 3 | | 87 | 10 | alert_boxes | [] | 5 | 0 | 6 | 14 | | 92 | 10 | status_summary | [] | 1 | 13 | 4 | 3 | | 93 | 10 | alert_table | [] | 0 | 0 | 5 | 13 | | 94 | 10 | old_status_table | [] | 5 | 14 | 5 | 7 | | 107 | 10 | alert_table | [] | 0 | 16 | 4 | 3 | | 109 | 14 | alert_table | [] | 0 | 0 | 5 | 7 | | 119 | 15 | alert_boxes | { "conditions": [ {"metric": "processor_usage", "comparison": "ge", "value": 90, "message": "CPU usage exceeded 90%"}, {"metric": "mempool_perc", "comparison": "greater", "value": 90, "message": "Memory usage exceeded 90%"} ], "status": "critical" } | 0 | 0 | 8 | 17 | +-----------+---------+------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+------+-------+--------+ 18 rows in set (0,00 sec)
Because I keep seeing that the widget of dash 15 keeps showing other alerts instead of the ones I injected in the conditions _______________________________________________ observium mailing list -- observium@lists.observium.org To unsubscribe send an email to observium-leave@lists.observium.org
I don’t seem to have any good examples of it, but fundamentally these widgets are created by the same functions that create the /eventlog/ /syslog/ /alerts/ and /alertlog/ pages, so can accept the same arguments as those pages can.
Like, you can limit to a list of devices with device_id, or a group, or a status.
The easy way to do it is to make a search on the page using the form with the arguments you want, then copy what it’s built in the URL into the json array, that way you get the field names correct.
The only example I have set up is for the eventlog, but the same basic thing works for them all:
Sent from my iPhone
On 2 Oct 2024, at 22:51, Adam Armstrong adama@observium.org wrote:
What made you think the alert widget will understand any of that?
😵💫
Sent from my iPhone
On 2 Oct 2024, at 14:44, Jose Napoli via observium observium@lists.observium.org wrote:
Hi Adam,
Can you tell me if this is Ok?
l> SELECT * FROM dash_widgets; +-----------+---------+------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+------+-------+--------+ | widget_id | dash_id | widget_type | widget_config | x | y | width | height | +-----------+---------+------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+------+-------+--------+ | 2 | 1 | status_summary | {} | 0 | 0 | 12 | 8 | | 3 | 1 | map | {} | 0 | 8 | 12 | 8 | | 4 | 1 | old_status_boxes | {} | 0 | 16 | 12 | 3 | | 5 | 1 | old_status_table | {} | 0 | 19 | 12 | 8 | | 6 | 1 | eventlog | {} | 0 | 27 | 12 | 8 | | 32 | 5 | status_summary | [] | 7 | 18 | 5 | 3 | | 33 | 5 | old_status_table | [] | 0 | 0 | 12 | 18 | | 34 | 5 | old_status_boxes | [] | 0 | 24 | 12 | 10 | | 54 | 5 | alertlog | [] | 0 | 18 | 7 | 6 | | 66 | 1 | alert_table | [] | 0 | 35 | 4 | 3 | | 67 | 1 | alert_boxes | [] | 4 | 35 | 4 | 3 | | 87 | 10 | alert_boxes | [] | 5 | 0 | 6 | 14 | | 92 | 10 | status_summary | [] | 1 | 13 | 4 | 3 | | 93 | 10 | alert_table | [] | 0 | 0 | 5 | 13 | | 94 | 10 | old_status_table | [] | 5 | 14 | 5 | 7 | | 107 | 10 | alert_table | [] | 0 | 16 | 4 | 3 | | 109 | 14 | alert_table | [] | 0 | 0 | 5 | 7 | | 119 | 15 | alert_boxes | { "conditions": [ {"metric": "processor_usage", "comparison": "ge", "value": 90, "message": "CPU usage exceeded 90%"}, {"metric": "mempool_perc", "comparison": "greater", "value": 90, "message": "Memory usage exceeded 90%"} ], "status": "critical" } | 0 | 0 | 8 | 17 | +-----------+---------+------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+------+-------+--------+ 18 rows in set (0,00 sec)
Because I keep seeing that the widget of dash 15 keeps showing other alerts instead of the ones I injected in the conditions _______________________________________________ observium mailing list -- observium@lists.observium.org To unsubscribe send an email to observium-leave@lists.observium.org
Nobody said the widget has to understand it.
I was actually asking about the format of the json since I didn't have an example and I was asking them if the format was correct. Then I applied both logic in a separated widget.
I then replied to them as it was finally configured but they did not approve my response....
Ironic, because my reply was caught for having too large an image attached and I forgot to approve that too.
🥲
Sent from my iPhone
On 3 Oct 2024, at 13:33, Jose Napoli via observium observium@lists.observium.org wrote:
Nobody said the widget has to understand it.
I was actually asking about the format of the json since I didn't have an example and I was asking them if the format was correct. Then I applied both logic in a separated widget.
I then replied to them as it was finally configured but they did not approve my response.... _______________________________________________ observium mailing list -- observium@lists.observium.org To unsubscribe send an email to observium-leave@lists.observium.org
participants (3)
-
Adam Armstrong
-
Jose Napoli
-
jose.napoli@neuralsoft.com