Commit 40ca53ef authored by Antoine Blanquet's avatar Antoine Blanquet
Browse files

tests de modifications sur reports génération html - modifs sans doute à...

tests de modifications sur reports génération html - modifs sans doute à ignorer car Kevin a une meilleur solution
parent 6b6ef744
{"jwt":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJjaGlycHN0YWNrLWFwcGxpY2F0aW9uLXNlcnZlciIsImV4cCI6MTYxNDc4NTg0OCwiaXNzIjoiY2hpcnBzdGFjay1hcHBsaWNhdGlvbi1zZXJ2ZXIiLCJuYmYiOjE2MTQ2OTk0NDgsInN1YiI6InVzZXIiLCJ1c2VybmFtZSI6IkNoaXJwc3RhY2tNb25pdG9yaW5nIn0.EQgydowoS132k5n3cPYI0qg4eAksewkep2c1QAFG8xw"}
\ No newline at end of file
#!/bin/bash
# Copyright (C) CampusIoT, - All Rights Reserved
# Written by CampusIoT Dev Team, 2016-2021
# ------------------------------------------------
# Get the detail of a getaway
# ------------------------------------------------
# Parameters
if [[ $# -ne 2 ]] ; then
echo "Usage: $0 JWT GWID"
exit 1
fi
TOKEN="$1"
GWID="$2"
AUTH="Grpc-Metadata-Authorization: Bearer $TOKEN"
#sudo npm install -g jwt-cli
#jwt $TOKEN
# Installation
if ! [ -x "$(command -v jq)" ]; then
echo 'jq is not installed. Installing jq ...'
sudo apt-get install -y jq
fi
if ! [ -x "$(command -v curl)" ]; then
echo 'curl is not installed. Installing curl ...'
sudo apt-get install -y curl
fi
# Content-Type
ACCEPT_JSON="Accept: application/json"
ACCEPT_CSV="Accept: text/csv"
CONTENT_JSON="Content-Type: application/json"
CONTENT_CSV="Content-Type: text/csv"
# LOCAL
#PORT=8888
#URL=http://localhost:$PORT
# PROD
PORT=443
URL=https://lns.campusiot.imag.fr:$PORT
# Operations
#CURL="curl --verbose"
CURL="curl -s --insecure"
#CURL="curl -s"
GET="${CURL} -X GET --header \""$ACCEPT_JSON"\""
POST="${CURL} -X POST --header \""$ACCEPT_JSON"\""
PUT="${CURL} -X PUT --header \""$ACCEPT_JSON"\""
DELETE="${CURL} -X DELETE --header \""$ACCEPT_JSON"\""
OPTIONS="${CURL} -X OPTIONS --header \""$ACCEPT_JSON"\""
HEAD="${CURL} -X HEAD --header \""$ACCEPT_JSON"\""
${GET} \
--header "$AUTH" ${URL}'/api/gateways/'${GWID} \
> .gateway-${GWID}.json
.result | sort_by(.lastSeenAt, .id) | reverse [] | ("<li><a href='" + @uri "https://lns.campusiot.imag.fr/#/organizations/\(.organizationID)/gateways/\(.id)" + "'>" + .id + "</a>: " + .name + " - (org " + .organizationID + ") - " + .lastSeenAt + " - " + .lastState + "</li>" )
{"totalCount":"24","result":[{"id":"0000024b0805031a","lastState":"active"},{"id":"7276ff0039030716","lastState":"active"},{"id":"7276ff0039030724","lastState":"active"},{"id":"7276ff0039030871","lastState":"active"},{"id":"0080e1ffff0153f1","lastState":"passive"},{"id":"0080e1ffff011234","lastState":"passive"},{"id":"0080e1ffff0153d7","lastState":"passive"},{"id":"080027ffff052e4a","lastState":"passive"},{"id":"0080e1ffff014fe1","lastState":"passive"},{"id":"0080e1ffff014feb","lastState":"passive"},{"id":"0080e1ffff01523c","lastState":"passive"},{"id":"0080e1ffff01523e","lastState":"passive"},{"id":"0080e1ffff015240","lastState":"passive"},{"id":"0080e1ffff015241","lastState":"passive"},{"id":"0080e1ffff015242","lastState":"passive"},{"id":"0080e1ffff015244","lastState":"passive"},{"id":"0080e1ffff015252","lastState":"passive"},{"id":"0080e1ffff015253","lastState":"passive"},{"id":"0080e1ffff015256","lastState":"passive"},{"id":"0080e1ffff015257","lastState":"passive"},{"id":"0080e1ffff01525e","lastState":"passive"},{"id":"0080e1ffff0153cc","lastState":"passive"},{"id":"0080e1ffff015b18","lastState":"passive"},{"id":"0080e1ffff015abf","lastState":"passive"}]}
\ No newline at end of file
{"totalCount":"24","result":[{"id":"0000024b0805031a","name":"KER_107_POLYTECH","description":"LoRaServer Bridge","createdAt":"2020-08-12T12:49:20.213116Z","updatedAt":"2021-03-02T14:42:35.521524Z","firstSeenAt":"2020-11-30T14:33:34.452376Z","lastSeenAt":"2021-03-02T14:42:35.519734Z","organizationID":"6","networkServerID":"1","lastState":"active","location":{"latitude":45.18432,"longitude":5.7534,"altitude":232,"source":"UNKNOWN","accuracy":0}},{"id":"7276ff0039030716","name":"KER_FEMTO_030716_P307","description":"Kerlink Wirnet iFemtoCell LoRaWAN Academy\nhttps://www.kerlink.fr/produit/wirnet-ifemtocell/\n\neth0 70:76:FF:02:07:7A\nwlan0 98:84:E3:BF:C7:D2\nIP 129.88.104.13\n","createdAt":"2020-10-09T10:37:41.392857Z","updatedAt":"2021-03-02T14:42:34.531887Z","firstSeenAt":"2021-01-30T14:06:43.965996Z","lastSeenAt":"2021-03-02T14:42:34.530046Z","organizationID":"6","networkServerID":"1","lastState":"active","location":{"latitude":45.18439622301354,"longitude":5.753231048583985,"altitude":220,"source":"UNKNOWN","accuracy":0}},{"id":"7276ff0039030724","name":"KER_FEMTO_030724_P124","description":"Femto Kerlink - Semtech LoRa Academy\neth0 70:76:ff:02:07:88\nwlan0 F0:C7:7F:C9:DB:E7\nIP 129.88.104.12","createdAt":"2020-10-09T10:31:29.150691Z","updatedAt":"2021-03-02T14:42:34.460855Z","firstSeenAt":"2021-01-30T13:42:31.657870Z","lastSeenAt":"2021-03-02T14:42:34.457846Z","organizationID":"6","networkServerID":"1","lastState":"active","location":{"latitude":45.18424498325449,"longitude":5.75310230255127,"altitude":220,"source":"UNKNOWN","accuracy":0}},{"id":"7276ff0039030871","name":"KER_FEMTO_030871_NP","description":"Kerlink Wirnet iFemtoCell LoRaWAN Academy https://www.kerlink.fr/produit/wirnet-ifemtocell/\n\neth0 70:76:FF:02:08:D4\nwlan0 98:84:E3:48:88:A2","createdAt":"2020-10-09T10:38:35.279330Z","updatedAt":"2021-03-02T14:42:23.524637Z","firstSeenAt":"2020-10-21T09:50:03.963231Z","lastSeenAt":"2021-03-02T14:42:23.523005Z","organizationID":"6","networkServerID":"1","lastState":"active","location":{"latitude":45.19740133918228,"longitude":5.833740234375001,"altitude":0,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff0153f1","name":"LRWAN2_0153F1_KEKA","description":"Enver KEKA/ Thibaud HUMBERT\nLocalisation : Proche CHAVANT (Enver) / Gare Grenoble (Alsace-Lorraine)\n","createdAt":"2021-02-23T16:42:29.229621Z","updatedAt":"2021-02-23T16:42:29.229621Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","lastState":"passive","location":{"latitude":45.18545489007673,"longitude":5.731258188609468,"altitude":220,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff011234","name":"LRWAN2_1234","description":"Gateway de Machin et de Bidule","createdAt":"2020-10-12T14:18:03.422439Z","updatedAt":"2021-02-01T16:18:10.914756Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","lastState":"passive","location":{"latitude":45.18433572715811,"longitude":5.753402709960938,"altitude":220,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff0153d7","name":"LRWAN2_153D7_SONZOGNI","description":"PM2M SONZOGNI","createdAt":"2021-02-23T16:33:58.381466Z","updatedAt":"2021-02-23T16:33:58.381466Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","lastState":"passive","location":{"latitude":45.19280830183293,"longitude":5.731676768131312,"altitude":220,"source":"UNKNOWN","accuracy":0}},{"id":"080027ffff052e4a","name":"LRWAN2_2E4A","description":"Gateway LoRaWAN2 d'Alexandre SALMON et Thomas FRION","createdAt":"2020-10-25T15:26:33.683397Z","updatedAt":"2020-10-25T16:00:41.686580Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","lastState":"passive","location":{"latitude":45.7226831,"longitude":5.9242678,"altitude":0,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff014fe1","name":"LRWAN2_4FE1_ROFFET_ROBERT","description":"Gateway Antoine ROFFET / Francois ROBERT\n","createdAt":"2020-10-26T09:13:50.490139Z","updatedAt":"2021-02-23T13:15:09.330789Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","lastState":"passive","location":{"latitude":45.19050597326729,"longitude":5.753958682541712,"altitude":0,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff014feb","name":"LRWAN2_4FEB_ROTIVAL","description":"Gateway de Antoine ROTIVAL","createdAt":"2020-12-06T13:05:02.270055Z","updatedAt":"2021-03-02T14:15:29.366507Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","lastState":"passive","location":{"latitude":45.182740125763594,"longitude":5.730657577514649,"altitude":238,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff01523c","name":"LRWAN2_523C_THOMAS_HERVE","description":"Gateway de Xiang SUN et Haoran ZHANG","createdAt":"2020-12-06T13:16:36.678108Z","updatedAt":"2021-02-23T13:31:04.306534Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","location":{"latitude":45.180297483446495,"longitude":5.744208097457887,"altitude":220,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff01523e","name":"LRWAN2_523E_VIVIANI","description":"Nicolas Viviani / Antoine Rotival\n","createdAt":"2021-01-08T08:29:03.697667Z","updatedAt":"2021-02-23T16:35:48.543451Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","lastState":"passive","location":{"latitude":45.46783598133375,"longitude":4.474431487704341,"altitude":400,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff015240","name":"LRWAN2_5240","description":"Addr Ethernet 00 80 e1 01 52 40","createdAt":"2021-02-01T14:27:24.122997Z","updatedAt":"2021-02-01T14:27:24.122997Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","lastState":"passive","location":{"latitude":45.18424498325449,"longitude":5.753574371337891,"altitude":220,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff015241","name":"LRWAN2_5241","description":"Gateway de florian jacquin ","createdAt":"2020-12-04T11:39:16.707206Z","updatedAt":"2020-12-04T11:39:16.707206Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","lastState":"passive","location":{"latitude":0,"longitude":0,"altitude":-2,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff015242","name":"LRWAN2_5242_HUMBERT","description":"Enver KEKA/ Thibaud HUMBERT\nLocalisation : Proche CHAVANT (Enver) / Gare Grenoble (Alsace-Lorraine)\n\n","createdAt":"2020-10-23T12:41:31.643182Z","updatedAt":"2021-02-23T16:40:38.076401Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","lastState":"passive","location":{"latitude":45.189144947063426,"longitude":5.721686275766365,"altitude":0,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff015244","name":"LRWAN2_5244","description":"Gateway de Dima ASSI et Houda EL AJI pour le projet WSN de INFO5/Polytech Grenoble","createdAt":"2020-12-24T15:03:33.158942Z","updatedAt":"2020-12-24T18:47:07.168703Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","lastState":"passive","location":{"latitude":45.18502008277258,"longitude":5.746954679489137,"altitude":0,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff015252","name":"LRWAN2_5252","description":"gateway de valentin blumert","createdAt":"2021-01-08T09:04:37.357613Z","updatedAt":"2021-01-08T09:04:37.357613Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","lastState":"passive","location":{"latitude":45.18633205644303,"longitude":5.705938785678001,"altitude":220,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff015253","name":"LRWAN2_5253","description":"Gateway pour le projet IoT LIANG Jichen","createdAt":"2020-12-06T14:12:19.996004Z","updatedAt":"2021-01-08T10:07:07.385911Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","lastState":"passive","location":{"latitude":45.1834546,"longitude":5.742217,"altitude":0,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff015256","name":"LRWAN2_5256","description":"Gateway Hugo RIBARD","createdAt":"2020-12-04T09:59:38.252876Z","updatedAt":"2020-12-04T09:59:38.252876Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","lastState":"passive","location":{"latitude":45.188097,"longitude":5.7514791999999995,"altitude":220,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff015257","name":"LRWAN2_5257_ROFFET_ROBERT","description":"Gateway PM2M ROFFET ROBERT","createdAt":"2021-01-08T10:37:34.317049Z","updatedAt":"2021-02-23T13:28:57.531612Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","lastState":"passive","location":{"latitude":45.18130329003343,"longitude":5.762570500373841,"altitude":0,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff01525e","name":"LRWAN2_525E","description":"Gateway de Flavien Mougeot et Gabriel Jaffres\n","createdAt":"2020-10-12T13:44:25.942475Z","updatedAt":"2021-01-08T10:34:06.708452Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","lastState":"passive","location":{"latitude":45.18436597509387,"longitude":5.7533597946167,"altitude":220,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff0153cc","name":"LRWAN2_53CC","description":"[IESE5] Gateway Benoit BARRE ","createdAt":"2021-01-08T09:30:40.541929Z","updatedAt":"2021-01-08T09:30:40.541929Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","lastState":"passive","location":{"latitude":45.1881042,"longitude":5.7737408,"altitude":0,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff015b18","name":"LRWAN2_5B18","description":"Gateway de Tony MAHIEUX","createdAt":"2020-12-06T13:10:48.842075Z","updatedAt":"2020-12-06T13:10:48.842075Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","lastState":"passive","location":{"latitude":45.18916763110019,"longitude":5.727138519287109,"altitude":220,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff015abf","name":"LRWAN3_5ABF_EU433","description":"LRWAN3\nMac Addr Ethernet 00 80 e1 01 5a bf","createdAt":"2021-02-01T14:29:41.185058Z","updatedAt":"2021-02-01T14:29:41.185058Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","lastState":"passive","location":{"latitude":45.18424498325449,"longitude":5.753574371337891,"altitude":220,"source":"UNKNOWN","accuracy":0}}]}
\ No newline at end of file
{"totalCount":"24","result":[{"id":"0000024b0805031a","name":"KER_107_POLYTECH","description":"LoRaServer Bridge","createdAt":"2020-08-12T12:49:20.213116Z","updatedAt":"2021-03-02T14:42:35.521524Z","firstSeenAt":"2020-11-30T14:33:34.452376Z","lastSeenAt":"2021-03-02T14:42:35.519734Z","organizationID":"6","networkServerID":"1","location":{"latitude":45.18432,"longitude":5.7534,"altitude":232,"source":"UNKNOWN","accuracy":0}},{"id":"7276ff0039030716","name":"KER_FEMTO_030716_P307","description":"Kerlink Wirnet iFemtoCell LoRaWAN Academy\nhttps://www.kerlink.fr/produit/wirnet-ifemtocell/\n\neth0 70:76:FF:02:07:7A\nwlan0 98:84:E3:BF:C7:D2\nIP 129.88.104.13\n","createdAt":"2020-10-09T10:37:41.392857Z","updatedAt":"2021-03-02T14:42:34.531887Z","firstSeenAt":"2021-01-30T14:06:43.965996Z","lastSeenAt":"2021-03-02T14:42:34.530046Z","organizationID":"6","networkServerID":"1","location":{"latitude":45.18439622301354,"longitude":5.753231048583985,"altitude":220,"source":"UNKNOWN","accuracy":0}},{"id":"7276ff0039030724","name":"KER_FEMTO_030724_P124","description":"Femto Kerlink - Semtech LoRa Academy\neth0 70:76:ff:02:07:88\nwlan0 F0:C7:7F:C9:DB:E7\nIP 129.88.104.12","createdAt":"2020-10-09T10:31:29.150691Z","updatedAt":"2021-03-02T14:42:34.460855Z","firstSeenAt":"2021-01-30T13:42:31.657870Z","lastSeenAt":"2021-03-02T14:42:34.457846Z","organizationID":"6","networkServerID":"1","location":{"latitude":45.18424498325449,"longitude":5.75310230255127,"altitude":220,"source":"UNKNOWN","accuracy":0}},{"id":"7276ff0039030871","name":"KER_FEMTO_030871_NP","description":"Kerlink Wirnet iFemtoCell LoRaWAN Academy https://www.kerlink.fr/produit/wirnet-ifemtocell/\n\neth0 70:76:FF:02:08:D4\nwlan0 98:84:E3:48:88:A2","createdAt":"2020-10-09T10:38:35.279330Z","updatedAt":"2021-03-02T14:42:23.524637Z","firstSeenAt":"2020-10-21T09:50:03.963231Z","lastSeenAt":"2021-03-02T14:42:23.523005Z","organizationID":"6","networkServerID":"1","location":{"latitude":45.19740133918228,"longitude":5.833740234375001,"altitude":0,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff0153f1","name":"LRWAN2_0153F1_KEKA","description":"Enver KEKA/ Thibaud HUMBERT\nLocalisation : Proche CHAVANT (Enver) / Gare Grenoble (Alsace-Lorraine)\n","createdAt":"2021-02-23T16:42:29.229621Z","updatedAt":"2021-02-23T16:42:29.229621Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","location":{"latitude":45.18545489007673,"longitude":5.731258188609468,"altitude":220,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff011234","name":"LRWAN2_1234","description":"Gateway de Machin et de Bidule","createdAt":"2020-10-12T14:18:03.422439Z","updatedAt":"2021-02-01T16:18:10.914756Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","location":{"latitude":45.18433572715811,"longitude":5.753402709960938,"altitude":220,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff0153d7","name":"LRWAN2_153D7_SONZOGNI","description":"PM2M SONZOGNI","createdAt":"2021-02-23T16:33:58.381466Z","updatedAt":"2021-02-23T16:33:58.381466Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","location":{"latitude":45.19280830183293,"longitude":5.731676768131312,"altitude":220,"source":"UNKNOWN","accuracy":0}},{"id":"080027ffff052e4a","name":"LRWAN2_2E4A","description":"Gateway LoRaWAN2 d'Alexandre SALMON et Thomas FRION","createdAt":"2020-10-25T15:26:33.683397Z","updatedAt":"2020-10-25T16:00:41.686580Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","location":{"latitude":45.7226831,"longitude":5.9242678,"altitude":0,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff014fe1","name":"LRWAN2_4FE1_ROFFET_ROBERT","description":"Gateway Antoine ROFFET / Francois ROBERT\n","createdAt":"2020-10-26T09:13:50.490139Z","updatedAt":"2021-02-23T13:15:09.330789Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","location":{"latitude":45.19050597326729,"longitude":5.753958682541712,"altitude":0,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff014feb","name":"LRWAN2_4FEB_ROTIVAL","description":"Gateway de Antoine ROTIVAL","createdAt":"2020-12-06T13:05:02.270055Z","updatedAt":"2021-03-02T14:15:29.366507Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","location":{"latitude":45.182740125763594,"longitude":5.730657577514649,"altitude":238,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff01523c","name":"LRWAN2_523C_THOMAS_HERVE","description":"Gateway de Xiang SUN et Haoran ZHANG","createdAt":"2020-12-06T13:16:36.678108Z","updatedAt":"2021-02-23T13:31:04.306534Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","location":{"latitude":45.180297483446495,"longitude":5.744208097457887,"altitude":220,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff01523e","name":"LRWAN2_523E_VIVIANI","description":"Nicolas Viviani / Antoine Rotival\n","createdAt":"2021-01-08T08:29:03.697667Z","updatedAt":"2021-02-23T16:35:48.543451Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","location":{"latitude":45.46783598133375,"longitude":4.474431487704341,"altitude":400,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff015240","name":"LRWAN2_5240","description":"Addr Ethernet 00 80 e1 01 52 40","createdAt":"2021-02-01T14:27:24.122997Z","updatedAt":"2021-02-01T14:27:24.122997Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","location":{"latitude":45.18424498325449,"longitude":5.753574371337891,"altitude":220,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff015241","name":"LRWAN2_5241","description":"Gateway de florian jacquin ","createdAt":"2020-12-04T11:39:16.707206Z","updatedAt":"2020-12-04T11:39:16.707206Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","location":{"latitude":0,"longitude":0,"altitude":-2,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff015242","name":"LRWAN2_5242_HUMBERT","description":"Enver KEKA/ Thibaud HUMBERT\nLocalisation : Proche CHAVANT (Enver) / Gare Grenoble (Alsace-Lorraine)\n\n","createdAt":"2020-10-23T12:41:31.643182Z","updatedAt":"2021-02-23T16:40:38.076401Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","location":{"latitude":45.189144947063426,"longitude":5.721686275766365,"altitude":0,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff015244","name":"LRWAN2_5244","description":"Gateway de Dima ASSI et Houda EL AJI pour le projet WSN de INFO5/Polytech Grenoble","createdAt":"2020-12-24T15:03:33.158942Z","updatedAt":"2020-12-24T18:47:07.168703Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","location":{"latitude":45.18502008277258,"longitude":5.746954679489137,"altitude":0,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff015252","name":"LRWAN2_5252","description":"gateway de valentin blumert","createdAt":"2021-01-08T09:04:37.357613Z","updatedAt":"2021-01-08T09:04:37.357613Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","location":{"latitude":45.18633205644303,"longitude":5.705938785678001,"altitude":220,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff015253","name":"LRWAN2_5253","description":"Gateway pour le projet IoT LIANG Jichen","createdAt":"2020-12-06T14:12:19.996004Z","updatedAt":"2021-01-08T10:07:07.385911Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","location":{"latitude":45.1834546,"longitude":5.742217,"altitude":0,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff015256","name":"LRWAN2_5256","description":"Gateway Hugo RIBARD","createdAt":"2020-12-04T09:59:38.252876Z","updatedAt":"2020-12-04T09:59:38.252876Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","location":{"latitude":45.188097,"longitude":5.7514791999999995,"altitude":220,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff015257","name":"LRWAN2_5257_ROFFET_ROBERT","description":"Gateway PM2M ROFFET ROBERT","createdAt":"2021-01-08T10:37:34.317049Z","updatedAt":"2021-02-23T13:28:57.531612Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","location":{"latitude":45.18130329003343,"longitude":5.762570500373841,"altitude":0,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff01525e","name":"LRWAN2_525E","description":"Gateway de Flavien Mougeot et Gabriel Jaffres\n","createdAt":"2020-10-12T13:44:25.942475Z","updatedAt":"2021-01-08T10:34:06.708452Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","location":{"latitude":45.18436597509387,"longitude":5.7533597946167,"altitude":220,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff0153cc","name":"LRWAN2_53CC","description":"[IESE5] Gateway Benoit BARRE ","createdAt":"2021-01-08T09:30:40.541929Z","updatedAt":"2021-01-08T09:30:40.541929Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","location":{"latitude":45.1881042,"longitude":5.7737408,"altitude":0,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff015b18","name":"LRWAN2_5B18","description":"Gateway de Tony MAHIEUX","createdAt":"2020-12-06T13:10:48.842075Z","updatedAt":"2020-12-06T13:10:48.842075Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","location":{"latitude":45.18916763110019,"longitude":5.727138519287109,"altitude":220,"source":"UNKNOWN","accuracy":0}},{"id":"0080e1ffff015abf","name":"LRWAN3_5ABF_EU433","description":"LRWAN3\nMac Addr Ethernet 00 80 e1 01 5a bf","createdAt":"2021-02-01T14:29:41.185058Z","updatedAt":"2021-02-01T14:29:41.185058Z","firstSeenAt":null,"lastSeenAt":null,"organizationID":"5","networkServerID":"1","location":{"latitude":45.18424498325449,"longitude":5.753574371337891,"altitude":220,"source":"UNKNOWN","accuracy":0}}]}
\ No newline at end of file
......@@ -12,8 +12,8 @@ PASSWORD=$(jq --raw-output ".password" .credentials.json)
JWT=$(./get_jwt.sh $USERNAME $PASSWORD)
./get_organizations.sh $JWT
./get_gateways.sh $JWT
./get_devices.sh $JWT
#./get_organizations.sh $JWT
./get_gateways_v2.sh $JWT
#./get_devices.sh $JWT
# TODO send reports by email
......@@ -62,6 +62,9 @@ ${GET} \
echo '<html><head><title>CampusIoT LNS :: Gateways</title></head><body style="font-family:verdana;"><h1>CampusIoT LNS :: Gateways</h1>' > .gateways.html
TODAY=$(date +"%Y-%m-%d")
echo "$TODAY"
echo '<p>generated at ' >> .gateways.html
date +"%Y-%m-%d %T %Z" >> .gateways.html
echo ' - ' >> .gateways.html
......
#!/bin/bash
# Copyright (C) CampusIoT, - All Rights Reserved
# Written by CampusIoT Dev Team, 2016-2021
# ------------------------------------------------
# Get getaways
# ------------------------------------------------
# Parameters
if [[ $# -ne 1 ]] ; then
echo "Usage: $0 JWT"
exit 1
fi
TOKEN="$1"
AUTH="Grpc-Metadata-Authorization: Bearer $TOKEN"
#sudo npm install -g jwt-cli
#jwt $TOKEN
# Installation
if ! [ -x "$(command -v jq)" ]; then
echo 'jq is not installed. Installing jq ...'
sudo apt-get install -y jq
fi
if ! [ -x "$(command -v curl)" ]; then
echo 'curl is not installed. Installing curl ...'
sudo apt-get install -y curl
fi
# Content-Type
ACCEPT_JSON="Accept: application/json"
ACCEPT_CSV="Accept: text/csv"
CONTENT_JSON="Content-Type: application/json"
CONTENT_CSV="Content-Type: text/csv"
# LOCAL
#PORT=8888
#URL=http://localhost:$PORT
# PROD
PORT=443
URL=https://lns.campusiot.imag.fr:$PORT
# Operations
#CURL="curl --verbose"
CURL="curl -s --insecure"
#CURL="curl -s"
GET="${CURL} -X GET --header \""$ACCEPT_JSON"\""
POST="${CURL} -X POST --header \""$ACCEPT_JSON"\""
PUT="${CURL} -X PUT --header \""$ACCEPT_JSON"\""
DELETE="${CURL} -X DELETE --header \""$ACCEPT_JSON"\""
OPTIONS="${CURL} -X OPTIONS --header \""$ACCEPT_JSON"\""
HEAD="${CURL} -X HEAD --header \""$ACCEPT_JSON"\""
${GET} \
--header "$AUTH" ${URL}'/api/gateways?limit=1000&offset=0' \
> .gateways.json
echo '<html><head><title>CampusIoT LNS :: Gateways</title></head><body style="font-family:verdana;"><h1>CampusIoT LNS :: Gateways</h1>' > .gateways.html
TODAY=$(date +"%Y-%m-%d")
echo "$TODAY"
echo '<p>generated at ' >> .gateways.html
date +"%Y-%m-%d %T %Z" >> .gateways.html
echo ' - ' >> .gateways.html
TZ=GMT date +"%Y-%m-%d %T %Z" >> .gateways.html
echo '</p>' >> .gateways.html
echo '<h2>Active gateways</h2>' >> .gateways.html
jq --raw-output -f gateways_to_html_v2.jq gateways_today.json | grep $TODAY >> .gateways.html
echo '<h2>Passive gateways</h2>' >> .gateways.html
echo "<div style=\"color: red\">" >> .gateways.html
jq --raw-output -f gateways_to_html_v2.jq gateways_today.json | grep -v $TODAY >> .gateways.html
echo "</div>" >> .gateways.html
echo '</body></html>' >> .gateways.html
GATEWAYS=$(jq --raw-output ".result | sort_by(.lastSeenAt, .id) | reverse [] | (.id)" .gateways.json)
for g in $GATEWAYS
do
echo "get details for $g"
./get_gateway.sh $TOKEN $g
done
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment