HenriWahl / Nagstamon

Nagios status monitor for your desktop.
https://nagstamon.de
Other
424 stars 178 forks source link

Incorrect display of last_check field in Nagstamon #1070

Open wigor2206 opened 3 weeks ago

wigor2206 commented 3 weeks ago

A good day!

We use Nagstamon in conjunction with Icinga to quickly respond to critical inspection conditions.

The problem is that in Nagstamon in the last_check line the format of the output time is very large. image

As example checked by user with UTC: curl -k -u 'admin' -H 'Accept: application/json' -X GET 'https://monitoring-private.com/icingadb/services?service.name=A%20CPU%20Load&host.name=Jump-Host01.com' _[ { "id": "84b44d88d621abfef343c2b8890b841132e930b2", ... "last_update": "2024-10-18T08:59:11.717+00:00", "last_state_change": "2024-10-18T08:03:40.388+00:00", "next_check": "2024-10-18T09:03:59.999+00:00", "next_update": "2024-10-18T09:07:59.999+00:00", ... } }, "host": { "id": "1cc6469c8aece4d43012a3554dcad55447b83395", ... "last_update": "2024-10-18T09:00:59.095+00:00", "last_state_change": "2024-10-10T11:09:59.637+00:00", "next_check": "2024-10-18T09:05:58.174+00:00", "next_update": "2024-10-18T09:10:59.145+00:00" } }, "icon_image": { "id": null, "icon_image": null, "environmentid": null } } ]

If you make a query from the database, the time format is Unixtime _icingadb=# select * from service_state limit 1; -[ RECORD 1 ]---------------+------------------------------------------- id | \x9f6acc5d9c03070ef0d34baf54c905c09ca8968b host_id | \x6a7972cd428aa690f18ecf0a65efe566d0fd08de service_id | \x9f6acc5d9c03070ef0d34baf54c905c09ca8968b environment_id | \x2219331a9a0b312fd1ea3cb6d26111062c405792 properties_checksum | \x98731a49fee07a22060194fe486a0bad744c18b9 state_type | hard soft_state | 3 hard_state | 3 previous_soft_state | 99 previous_hard_state | 99 check_attempt | 1 severity | 2112 output | long_output | performance_data | normalized_performance_data | check_commandline | is_problem | y is_handled | n is_reachable | y is_flapping | n is_overdue | n is_acknowledged | n acknowledgement_comment_id | last_comment_id | in_downtime | n execution_time | 0 latency | 0 check_timeout | 60000 check_source | core01.com scheduling_source | core01.com last_update | 1728984974759 last_state_change | 1728984780585 next_check | 1729028174780 nextupdate | 1729071374759

So we see that in the IcingaDB database the required field is stored in unix time, and the IcingaAPI transmits it in the format that we see in Nagstamon.

We expect the format in Nagstamon in the last_check column to be in the format , e.g. 2024-10-15 10:03:16, not as it is now. image

Nagstamon's connection settings to the Icinga: image

Nagstamon version 3.14 and higher

Environment: Icinga Web 2 Version 2.12.1 director 1.11.1 doc 2.12.1 icingadb 1.1.3 incubator 0.22.0

wigor2206 commented 3 weeks ago

We made a similar request in the section with IcingaDB, but the developers of Icinga said that this is a question for Nagstamon, not them. https://github.com/Icinga/icingadb-web/issues/1078