Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

Get server list from online source #2

Closed
oliver opened this issue Mar 22, 2017 · 3 comments
Closed

Get server list from online source #2

oliver opened this issue Mar 22, 2017 · 3 comments

Comments

@oliver
Copy link

oliver commented Mar 22, 2017

It would be useful if Gatemon would retrieve the list of gateway servers from some dedicated online source. Currently the freifunkh Gatemon sets the server list in the process() method in local config file, while FFHB Gatemon extracts the server base IP from the site.conf file from Github and gets the number of available servers from the local config file.

Advantages of pulling the entire server list from a dedicated online source:

  • FF admins can centrally change the list of monitored gateway servers, without touching each Gatemon host
  • specific servers can be excluded from monitoring more easily
  • the config file becomes more generic and easier to use by different communities

Proposed implementation:

  • config.sh includes a new parameter (eg. "online_config_url") which specifies the URL where an additional "online config" file can be downloaded
  • this online config file contains parameters that are centrally managed rather than being set in the local config file
  • the online config is downloaded by the Gatemon script on every run
  • online config is stored in JSON format, like this:
{
    "api-url": "https://status.ffh.zone/put.php",
    "servers": [
        {
            "name": "sn01.s.ffh.zone",
            "ipv4": "10.2.10.1",
            "ipv6": "fdca:ffee:8::1001"
        },
        {
            "name": "sn02.s.ffh.zone",
            "ipv4": "10.2.20.1",
            "ipv6": "fdca:ffee:8::2001"
        },
        {
            "name": "sn04.s.ffh.zone",
            "ipv4": "10.2.40.1",
            "ipv6": "fdca:ffee:8::4001"
        }
    ]
}
  • so the online config specifies the gatemon-html upload URL and the list of servers to check (including IPs, for IPv4 and IPv6).
  • to use the online config, the Gatemon script will use the jq tool (https://stedolan.github.io/jq/), eg. like this:
for h in $(jq ".servers[]|tojson" test.json); do
	name=$(echo $h | jq -r 'fromjson | .name')
	ipv4=$(echo $h | jq -r 'fromjson | .ipv4')
	ipv6=$(echo $h | jq -r 'fromjson | .ipv6')
	echo $name: $ipv4, $ipv6
done
@lemoer
Copy link

lemoer commented Mar 23, 2017

I would also propose:

{
  "name": "sn01.s.ffh.zone",
  "ipv4": "10.2.10.1",
  "ipv6": "fdca:ffee:8::1001",
  "tests": { "dns": "both", "ntp": "ipv4", "addresses": "ipv6" }
},

If you don't want to have a specific test, then you could simply leave out the key-value-pair.

@lemoer
Copy link

lemoer commented Mar 23, 2017

Alternative:

{
  "name": "sn01.s.ffh.zone",
  "ipv4": "10.2.10.1",
  "ipv6": "fdca:ffee:8::1001",
  "tests": ["dns", "ntp", "addresses"],
  "skip4": ["addresses"],
  "skip6": ["ntp"]
},

This would be less to write if no tests should be skipped.

@oliver
Copy link
Author

oliver commented Oct 1, 2019

I've created a copy of this issue in the upstream repo (at FreifunkBremen#19); so maybe this one should be closed?

@lemoer lemoer closed this as completed Oct 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants