Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confirm handling of time zone #1

Open
smalers opened this issue May 19, 2023 · 4 comments
Open

Confirm handling of time zone #1

smalers opened this issue May 19, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request high Priority: next release if possible S Size: day or less

Comments

@smalers
Copy link
Contributor

smalers commented May 19, 2023

Need to confirm whether the API returns times in UTC or local time and how to control. The data need to be overlaid with time series data in local time read from other systems.

@smalers smalers added enhancement New feature or request high Priority: next release if possible S Size: day or less labels May 19, 2023
@smalers smalers self-assigned this May 19, 2023
@smalers
Copy link
Contributor Author

smalers commented May 19, 2023

NovaStar data web services output in local time for the system and therefore need to get the Zabbix data into the local time zone so the time series data align.

This Zabbix Forum article indicates that the database and API uses UTC.

The initial plugin implementation also shows the most recent time for an item as 2023-05-19 21:04:12 GMT when read at about 3:05 PM Mountain. The corresponding GMT time would 9:05 PM so 6 hours difference. Therefore the data value would correspond to 2023-05-19 15:04:12 GMT, which is 3PM.

There is a default time zone for output and it can be set in the user preferences, but it does not seem to be recognized by the API. I don't see a way to set the time zone by host group or host. So, to handle properly, the following may be options:

  1. Is there any way to define custom data in Zabbix? If so, then this could be read rather than a file (option 2).
  2. Add a datastore configuration property that indicates a file or URL that has the custom information and include the time zone there. The problem is that this would require additional maintenance and complexity. I suppose that data web services could return the information.
  3. Define properties in the host description similar to what is done in NovaStar, for example Timezone=America/Denver. This would not be too bad since there are a relatively small number of hosts.
  4. Allow setting the output time zone in the ReadZabbix command or add a new OutputTimeZone (or similar) property in TSTool to more explicitly handle.

I am leaning towards option 3 and 4. I'd rather avoid 2 because it is more stuff for the user to deal with and adding to data web services will take some time. I can work on 4 until 3 is confirmed with Nathan as a solution. Most hosts don't have descriptions and I just added a property for the MHFD master so I can try developing using that. Need to talk to Nathan to confirm this approach.

@smalers
Copy link
Contributor Author

smalers commented May 22, 2023

I implemented option #3 by adding a comment similar to the following in the host description:

// Timezone=America/Denver

This is enough for now and will also add to the ReadZabbix command.

smalers added a commit that referenced this issue May 24, 2023
Also add support for trend time series in TSID commands.
@smalers
Copy link
Contributor Author

smalers commented May 24, 2023

May be able to implement time zone in maintenance information. Keep this open until a final decision is made.

@smalers
Copy link
Contributor Author

smalers commented Aug 26, 2023

It appears that time zone could be added to host inventory data as a custom field (based on a ChatGPT answer to question: How to add a custom host inventory field to zabbix?):

image

I don't see how to get to an Administration menu for the Zabbix 5.4 version at TriLynx Systems. Maybe this is only available for certain versions of Zabbix or maybe I don't have permissions?

However, this would be a static value and may not be accurate. An alternative approach is to treat the time zone as an item and query from the operating system. This will ensure that the actual time zone is checked, although the value will generally be static and never change. Setting up in a template will also simplify configuration because the time zone would only need to be added once, rather to each host (right ?).

It is also possible to collect data as an item and assign to an inventory value, in which case the latest item value will be assigned to the inventory value. Therefore, an optimal solution might be to collect the time zone from the host as a monitored item and set as an inventory property. Being able to query the inventory would probably be faster than querying time series data.

Therefore, an optimal solution for the plugin might be to add datastore configuration properties like the following, which would handle both cases:

HostInventoryTimeZoneProperty
HostTimeZoneItem

I added host.inventory.... properties to the time series properties when time series are read. All the inventory properties can now be accessed for a time series. However, the question remains as to whether a custom inventory property can actually be added (maybe only with Zabbix 6+?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request high Priority: next release if possible S Size: day or less
Projects
None yet
Development

No branches or pull requests

1 participant