ha_cluster_exporter icon indicating copy to clipboard operation
ha_cluster_exporter copied to clipboard

Issue with `ha_cluster_pacemaker_config_last_change` and timezone

Open rudexi opened this issue 4 years ago • 1 comments

Software used:

  • CentOS 8.2
  • ha_cluster_exporter 1.2.1
  • pacemaker 2.0.3-5

I'm experiencing issues with the ha_cluster_pacemaker_config_last_change metric. It does report the time in Unix time format, but it takes the time as if it was GMT, while crm_mon reports it without any timestamp markup, resulting in the error. This error is very noticeable for time zones in advance from GMT, since the reported time is in the future.

Here is more data to illustrate the issue:

$ date
Tue Mar 16 09:01:17 JST 2021

$ curl -s localhost:9664/metrics|grep ^ha_cluster_pacemaker_config_last_change
ha_cluster_pacemaker_config_last_change 1.615884919e+09

$ date -d @1615884919
Tue Mar 16 17:55:19 JST 2021

$ sudo crm_mon -X --inactive|grep last_change
    <last_change time="Tue Mar 16 08:55:19 2021" user="root" client="crm_attribute" origin="host01"/>

$ date -d 'Tue Mar 16 08:55:19 2021'
Tue Mar 16 08:55:19 JST 2021

$ date -d 'Tue Mar 16 08:55:19 2021 GMT'
Tue Mar 16 17:55:19 JST 2021

Several possibilities for fixing this:

  • Modify ClusterLabs/pacemaker to make them include a parsable timezone information
  • Fix the resulting Time object by attaching the timezone of the running system (since the time reported is relative the the system timezone)

rudexi avatar Mar 16 '21 00:03 rudexi

I wasn't aware that crm_mon would report the time as local, I assumed it was UTC, my bad! It totally makes sense to convert it to UTC when we collect it in the exporter.

stefanotorresi avatar Mar 16 '21 09:03 stefanotorresi