<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: OmniEdge</title>
    <description>The latest articles on DEV Community by OmniEdge (@omniedge).</description>
    <link>https://dev.to/omniedge</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F5945%2Ff4b78f43-3a73-42f4-ab3d-b15ba6b373f9.jpg</url>
      <title>DEV Community: OmniEdge</title>
      <link>https://dev.to/omniedge</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/omniedge"/>
    <language>en</language>
    <item>
      <title>How we use OmniEdge Github Action to monitor our servers</title>
      <dc:creator>Yǒng</dc:creator>
      <pubDate>Wed, 10 Aug 2022 03:55:00 +0000</pubDate>
      <link>https://dev.to/omniedge/how-we-use-omniedge-github-action-to-monitor-severs-5gcn</link>
      <guid>https://dev.to/omniedge/how-we-use-omniedge-github-action-to-monitor-severs-5gcn</guid>
      <description>&lt;p&gt;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 &lt;a href="https://omniedge.io/docs/article/install/customize-supernode"&gt;public super node&lt;/a&gt; severs across the world are online. &lt;/p&gt;

&lt;h2&gt;
  
  
  Why monitoring
&lt;/h2&gt;

&lt;p&gt;We are running 11 public super node servers located in Ohio, Oregon,Frankfurt,Tokyo,Sydney, Mumbai, SaoPaulo,Milan,Singapore,HongKong and Taipei. &lt;/p&gt;

&lt;p&gt;All the servers are running in the a separated cloud instance from AWS and GCP, opening the UDP port to server, help &lt;a href="https://omniedge.io"&gt;omniedge&lt;/a&gt; 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. &lt;/p&gt;

&lt;h2&gt;
  
  
  How to monitor
&lt;/h2&gt;

&lt;p&gt;Since the server only opens one udp port, it is easy to check the status by running a command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nc &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="nt"&gt;-w&lt;/span&gt; 2 &lt;span class="nt"&gt;-z&lt;/span&gt; &lt;span class="nt"&gt;-u&lt;/span&gt; 1.2.3.4 80  &lt;span class="c"&gt;#scan port 80 of IP 1.2.3.4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;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:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;yum &lt;span class="nb"&gt;install &lt;/span&gt;nc                  &lt;span class="c"&gt;#CentOS/RHEL&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;dnf &lt;span class="nb"&gt;install &lt;/span&gt;nc                  &lt;span class="c"&gt;#Fedora&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;Netcat     &lt;span class="c"&gt;#Debian/Ubuntu&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The command use different parameters: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;-v option enables verbose mode&lt;/li&gt;
&lt;li&gt;-w specifies a timeout for connection that can not be established.&lt;/li&gt;
&lt;li&gt;-u scan &lt;code&gt;UDP&lt;/code&gt; port&lt;/li&gt;
&lt;li&gt;-z sets &lt;code&gt;nc&lt;/code&gt; to simply scan for listening daemons, without actually sending any data to them. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to connect all server in one intranet
&lt;/h2&gt;

&lt;p&gt;1.&lt;a href="https://omniedge.io/register"&gt;Sign up OmniEdge account&lt;/a&gt;, and system will build a virtual network for you, get the virtual network ID, and create a Security Key from &lt;a href="https://omniedge.io/dashboard"&gt;Dashboard&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;2.Instal Docker, and run the command with your own Security-key and Virtual Network ID in all severs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;OMNIEDGE_SECURITYKEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Security-key &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;OMNIEDGE_VIRUTALNETWORK_ID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Virtual Network ID"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--network&lt;/span&gt; host &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--privileged&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  omniedge/omniedge:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3.You will see all the server are listed in your virtual network dashboard.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Github action with to monitor
&lt;/h2&gt;

&lt;p&gt;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. &lt;/p&gt;

&lt;p&gt;Here is the step to setup the GitHub action to check the status and update readme.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a workflow in your GitHub repo
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir -p /.github/workflows/check-server-status.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2.Setup the environment variable, switch to &lt;code&gt;your-repo-address/settings/secrets/actions&lt;/code&gt;, create the &lt;code&gt;Repository secrets&lt;/code&gt; with the name:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  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
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3.&lt;a href="https://omniedge.io/register"&gt;Sign up OmniEdge account&lt;/a&gt; to get the &lt;code&gt;OMNIEDGE_SECURITY_KEY&lt;/code&gt; and &lt;code&gt;OMNIEDGE_VIRTUALNETWORK_ID&lt;/code&gt; from &lt;a href="https://omniedge.io/dashboard"&gt;Dashboard&lt;/a&gt;, fill them in the step 2&lt;/p&gt;

&lt;p&gt;4.Edit &lt;code&gt;check-server-status.yml&lt;/code&gt; file, add &lt;a href="https://github.com/marketplace/actions/omniedge-for-github-action"&gt;OmniEdge for GitHub Action&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- name: OmniEdge for Github Action
  uses: omniedgeio/github-action@v1
  with:
    securitykey: ${{ secrets.OMNIEDGE_SECURITY_KEY }}
    virtualnetworkid: ${{ secrets.OMNIEDGE_VIRTUALNETWORK_ID }}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5.Set the checking schedule, here we do it every 5 hours&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- cron: "0 */5 * * *"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;6.you can copy the whole workflow from the link &lt;a href="https://github.com/omniedgeio/server-status/blob/main/.github/workflows/check-server-status.yml"&gt;https://github.com/omniedgeio/server-status/blob/main/.github/workflows/check-server-status.yml&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;7.Push your commit to repo, and you can see the action is running and a new &lt;strong&gt;README.md&lt;/strong&gt; will be generated after 1 minute.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wGeXFbDt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jansomtg1aqriv94i30x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wGeXFbDt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jansomtg1aqriv94i30x.png" alt="Server Status check with OmniEdge" width="880" height="748"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Yes, the Readme shows HongKong is offline, but it is not actually. &lt;strong&gt;nc&lt;/strong&gt; command is not working properly always, if you have better command, let me know please. &lt;/p&gt;

&lt;p&gt;Thanks.&lt;/p&gt;

&lt;p&gt;Here is the whole running repo: &lt;a href="https://github.com/omniedgeio/server-status"&gt;https://github.com/omniedgeio/server-status&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vpn</category>
      <category>opensource</category>
      <category>cloud</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
