ytyou / ticktock

TickTockDB is an OpenTSDB-like time series database, with much better performance.
GNU General Public License v3.0
72 stars 8 forks source link

RFE: allow 'ping' and/or 'healthcheck' to run with curl #61

Open juggledad opened 9 months ago

juggledad commented 9 months ago

Ping, and healthcheck, are great to check and see if ticktock is running, but you can only run them on the device that ticktock is running on.

While you can use curl on a different device to retrieve data, that device will only know if tick-tock is down by having a error in a curl command.

My case is using Node-red to access the ticktock. If I have Node-RED running on the device hosting ticktock (device A) everything is fine because NR has an 'exec' node so it can run 'ping.sh' on that machine and get the status.

However, if I run the Node-RED flow on another device (device B), the ping will fail as because the ping.sh file and database are not on device B.

If ping and/or healthcheck could be run via curl it would be a useful addition.

ylin30 commented 9 months ago

Not sure if I understand your question. Ping.sh and healthcheck.sh are actually just wrapper of curl. You can alway run the curl command anywhere. For example, I run a CURL to ping TT (on 192.168.1.34) from 192.168.1.41.

[yi-IdeaPad ticktock (bug/20211210.mmap)]$ ip a l | grep 192
    inet 192.168.1.41/24 brd 192.168.1.255 scope global dynamic noprefixroute wlo1
[yi-IdeaPad ticktock (bug/20211210.mmap)]$
[yi-IdeaPad ticktock (bug/20211210.mmap)]$ curl -v -XPOST http://192.168.1.34:6182/api/admin?cmd=ping
*   Trying 192.168.1.34:6182...
* TCP_NODELAY set
* Connected to 192.168.1.34 (192.168.1.34) port 6182 (#0)
> POST /api/admin?cmd=ping HTTP/1.1
> Host: 192.168.1.34:6182
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Length: 4
< Content-Type: text/plain
<
* Connection #0 to host 192.168.1.34 left intact
pong[yi-IdeaPad ticktock (bug/20211210.mmap)]$
juggledad commented 9 months ago

Oh (head slap) I was using a GET...the POST works fine

Thanks!