Trying to understand how member id is calculated

Hey guys, i am trying to understand how the member id is calculated when the

sensuctl cluster member-list

command is running. I was using the API to detect a failed node and i saw that it is returning the numeric ID. In my example is 4046857861428381000. According to that ticket https://github.com/sensu/sensu-go/issues/1887 i just need to convert it so I though to just use printf

printf '%02x\n' 4046857861428381000
and i am getting: 382953c8a6ef8548

However the actual sensu cluster current result is 382953c8a6ef85df.
382953c8a6ef85df i-0a72986fef8c63855 dial tcp 10.187.96.142:2379: connect: no route to host false

i.e. the last two digits are wrong!

I have commented on https://github.com/sensu/sensu-go/issues/1887 but i though to open a topic here for future reference in case someone is facing the same issue. As always, thank you for your support!

Hi @GeorgeT,

Could you let us know where/how you saw this error message exactly?:

382953c8a6ef85df i-0a72986fef8c63855 dial tcp 10.187.96.142:2379: connect: no route to host false

Also, what’s the output of sensuctl cluster member-list & sensuctl cluster health?

Thanks!

Hi @palourde,

i am testing a failover scenario. My initial cluster setup has 3 nodes. After some time i am terminating a node and i am trying to add a new one automatically. To accomplish this i am having a script running on another node that is checking the health of the cluster. This is happening by using the API. What you’re seeing above is the attempt to add a new node. i.e. the steps i followed

  1. setup a 3 node cluster
  2. start checking its health
  3. after some time terminate a node
  4. detect that a node is unhealthy
  5. get the unhealthy node id from the API
  6. API returns a numeric id
  7. in order to delete the node i need the hex based id
  8. i am converting it
  9. i am trying to remove the node from the cluster but the id calculated on step 8 is different

In order to workaround this i used sensuctl instead of the API.