There are a lot of method to monitor server status, however some of them are too heavy for us, our goal is very easy, just make sure the public super node severs across the world are online.
Why monitoring
We are running 11 public super node servers located in Ohio, Oregon,Frankfurt,Tokyo,Sydney, Mumbai, SaoPaulo,Milan,Singapore,HongKong and Taipei.
All the servers are running in the a separated cloud instance from AWS and GCP, opening the UDP port to server, help omniedge nodes connect peer-to-peer, and as a fallback to relay traffic between nodes in case NAT traversal fails and a direct connection can not be established. So the supernode server is very important for users across the world.
How to monitor
Since the server only opens one udp port, it is easy to check the status by running a command:
nc -v -w 2 -z -u 1.2.3.4 80 #scan port 80 of IP 1.2.3.4
Netcat (or nc in short) is a simple yet powerful networking command-line tool used for performing any operation in Linux related to TCP, UDP, or UNIX-domain sockets. It is quite easy to install:
$ yum install nc #CentOS/RHEL
$ dnf install nc #Fedora
$ sudo apt-get install Netcat #Debian/Ubuntu
The command use different parameters:
- -v option enables verbose mode
- -w specifies a timeout for connection that can not be established.
- -u scan
UDP
port - -z sets
nc
to simply scan for listening daemons, without actually sending any data to them.
How to connect all server in one intranet
1.Sign up OmniEdge account, and system will build a virtual network for you, get the virtual network ID, and create a Security Key from Dashboard.
2.Instal Docker, and run the command with your own Security-key and Virtual Network ID in all severs:
sudo docker run -d \
-e OMNIEDGE_SECURITYKEY=Security-key \
-e OMNIEDGE_VIRUTALNETWORK_ID="Virtual Network ID" \
--network host \
--privileged \
omniedge/omniedge:latest
3.You will see all the server are listed in your virtual network dashboard.
Use Github action with to monitor
We have connected all the super nodes into an intranet, and we would like to the check internally. So we bring GitHub action into the intranet, to check the status through a peer-to-peer connection without their internal IP rather than the public IP.
Here is the step to setup the GitHub action to check the status and update readme.
- Create a workflow in your GitHub repo
mkdir -p /.github/workflows/check-server-status.yml
2.Setup the environment variable, switch to your-repo-address/settings/secrets/actions
, create the Repository secrets
with the name:
SERVER_IPs #Servers IP and name with format: server_name, IP
PORT # 80
OMNIEDGE_SECURITY_KEY #OmniEdge security_key
OMNIEDGE_VIRTUALNETWORK_ID #OmniEdge Virtual network ID
3.Sign up OmniEdge account to get the OMNIEDGE_SECURITY_KEY
and OMNIEDGE_VIRTUALNETWORK_ID
from Dashboard, fill them in the step 2
4.Edit check-server-status.yml
file, add OmniEdge for GitHub Action.
- name: OmniEdge for Github Action
uses: omniedgeio/github-action@v1
with:
securitykey: ${{ secrets.OMNIEDGE_SECURITY_KEY }}
virtualnetworkid: ${{ secrets.OMNIEDGE_VIRTUALNETWORK_ID }}
5.Set the checking schedule, here we do it every 5 hours
- cron: "0 */5 * * *"
6.you can copy the whole workflow from the link https://github.com/omniedgeio/server-status/blob/main/.github/workflows/check-server-status.yml
7.Push your commit to repo, and you can see the action is running and a new README.md will be generated after 1 minute.
Yes, the Readme shows HongKong is offline, but it is not actually. nc command is not working properly always, if you have better command, let me know please.
Thanks.
Here is the whole running repo: https://github.com/omniedgeio/server-status
Top comments (1)
awesome