Gateway status query

Gateway status query

@Steven Flaxman

Hi

I would like to query my gateway status and send a notification when its offline.

I have googled and tried many iterations of the code below but I suspect I’m missing something. I cant figure out how to include the gateway API and I’m sure I have the TTI url wrong.

Has anyone managed to do this and could you please help me with my code.

const { Analysis } = require("@tago-io/sdk");
const axios = require("axios");



function getData() {
      const response = axios ({
      url: "https://eu1.cloud.thethings.network/api/v3/gs/gateways/eui-mygateway/connection/stats",
      method: "GET"
    })

    console.log(response.status)
    }


// The function myAnalysis will run when you execute your analysis
function myAnalysis(context, scope) {
  getData();
}

module.exports = new Analysis(myAnalysis);





Thanks
Flaxie

@vitor
@guilhermeco
@alinetusi