Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get server list from online source #19

Open
oliver opened this issue Oct 1, 2019 · 2 comments
Open

Get server list from online source #19

oliver opened this issue Oct 1, 2019 · 2 comments

Comments

@oliver
Copy link
Contributor

oliver commented Oct 1, 2019

(This issue was copied from freifunkh#2 because it is too easily overlooked in that repo)

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

Comment by lemoer:

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.


Comment by lemoer:

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
Contributor Author

oliver commented Oct 1, 2019

Dieses Feature wäre auch sinnvoll, damit wir die site.conf ändern können, ohne den Gatemon zu beeinflussen.

@ghost
Copy link

ghost commented Oct 2, 2019

Bin ich gegen. Ich finde eine zentrale Quelle reicht. Wir sollten nur sinnvoller die Infos aus der site.conf parsen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant