Monitoring ngrok tunnel

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Monitoring ngrok tunnel

Marcin Deka

Hi,

Can someone advise how I can monitor tunnel created with ngrok (running as a daemon)?
I would like to reestablish tunnel if existing one is stoped and send alert including new tunnel parameters (there is a TCP port number change while tunel is being created).
I’m using below command to see tunnel details:
curl --silent http://127.0.0.1:4040/api/tunnels/ssh | jq '.public_url’
It gives a response like below, where XXXXX ia a TCP port number: 
"tcp://0.tcp.eu.ngrok.io:XXXXX"
Will appreciate your help!

Best regards,
Marcin

--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
Reply | Threaded
Open this post in threaded view
|

Re: Monitoring ngrok tunnel

Szépe Viktor
Idézem/Quoting Marcin Deka <[hidden email]>:

> Hi,
>
> Can someone advise how I can monitor tunnel created with ngrok  
> (running as a daemon)?
> I would like to reestablish tunnel if existing one is stoped and  
> send alert including new tunnel parameters (there is a TCP port  
> number change while tunel is being created).
> I’m using below command to see tunnel details:
> curl --silent http://127.0.0.1:4040/api/tunnels/ssh | jq '.public_url’
> It gives a response like below, where XXXXX ia a TCP port number:
> "tcp://0.tcp.eu.ngrok.io:XXXXX"
> Will appreciate your help!
>

Hi Marcin!

You may monitor ngrok's

- log files
- binaries
- configuration files
- init files
- the running process
- TCP ports
- and functional tests as you mentioned, you may check public_url in a  
shell script

see all my configs  
https://github.com/szepeviktor/debian-server-tools/tree/master/monitoring/monit/services
aruba-serclient_script is a very simple example:
/usr/bin/lsof -p "$(cat /run/serclient.pid)" | grep -w "/dev/ttyS1"

so
curl --silent "http://127.0.0.1:4040/api/tunnels/ssh" | jq -r  
'.public_url' | grep -F 'tcp://0.tcp.eu.ngrok.io:'

adding "if changed status then alert" to monit will alert you.

All the best!


SZÉPE Viktor, webes alkalmazás üzemeltetés / Running your application
https://github.com/szepeviktor/debian-server-tools/blob/master/CV.md
~~~
ügyelet/hotline: +36-20-4242498  [hidden email]  skype: szepe.viktor
Budapest, III. kerület






--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general