diff options
author | Magnus Ahltorp <map@kth.se> | 2017-03-08 18:45:47 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2017-03-15 17:45:32 +0100 |
commit | 6deee0427c3e4934291b1103328d4c3d75d56e29 (patch) | |
tree | 7f56ec8cd9bce774426f2c769b6cd5c931ce1aaf /tools | |
parent | 8e4cd93fd1ab8fa148256633f3eb261a5bd1d311 (diff) |
Added heartbeat service. Add source.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/compileconfig.py | 6 | ||||
-rwxr-xr-x | tools/merge_fetch.py | 9 |
2 files changed, 10 insertions, 5 deletions
diff --git a/tools/compileconfig.py b/tools/compileconfig.py index 44db767..c2463df 100755 --- a/tools/compileconfig.py +++ b/tools/compileconfig.py @@ -372,6 +372,8 @@ def gen_config(nodename, config, localconfig): services = set() storage_sign_quorum = config.get("storage-sign-quorum-size", 0) + allnodenames = set(signingnodenames + mergenodenames + frontendnodenames + statusservernames + storagenodenames) + if "frontendnodes" in nodetype: reloadableplopconfig.append((Symbol("storage_nodes"), storagenodeaddresses)) reloadableplopconfig.append((Symbol("storage_nodes_quorum"), config["storage-quorum-size"])) @@ -445,6 +447,7 @@ def gen_config(nodename, config, localconfig): ("/plop/v1/status/merge_fetch", statusservernames), ("/plop/v1/status/storage", statusservernames), ("/plop/v1/status/merge_errors", statusservernames), + ("/plop/v1/status/heartbeat", statusservernames), ] if "statusservers" in nodetype: @@ -454,7 +457,8 @@ def gen_config(nodename, config, localconfig): ("/plop/v1/status/merge_sth", mergenodenames), ("/plop/v1/status/merge_fetch", mergenodenames), ("/plop/v1/status/merge_errors", mergenodenames), - ("/plop/v1/status/storage", list(storagenodenames)), + ("/plop/v1/status/storage", storagenodenames), + ("/plop/v1/status/heartbeat", list(allnodenames)), ("/status", Symbol("noauth")), ] diff --git a/tools/merge_fetch.py b/tools/merge_fetch.py index 2a2491d..b0b6ce6 100755 --- a/tools/merge_fetch.py +++ b/tools/merge_fetch.py @@ -24,8 +24,9 @@ def reportstatus(statusservers, own_key, target, variable, status): def do_reportstatus(node, baseurl, own_key, target, variable, status): try: + (ownname, _) = own_key result = http_request(baseurl + "plop/v1/status/merge_fetch", - json.dumps([{"target":target, "key": variable, "value": status}]), key=own_key, + json.dumps([{"source":ownname, "target":target, "key": variable, "value": status}]), key=own_key, verifynode=node) return json.loads(result) except requests.exceptions.HTTPError, e: @@ -79,7 +80,7 @@ def merge_fetch(args, config, localconfig, currentsizefile): new_entries -= certsinlog print >>sys.stderr, "adding", len(new_entries), "entries" sys.stderr.flush() - reportstatus(statusservers, own_key, "fetch", "total", len(certsinlog) + len(new_entries)) + reportstatus(statusservers, own_key, own_key[0], "total", len(certsinlog) + len(new_entries)) for ehash in new_entries: for storagenode in storagenodes: @@ -123,7 +124,7 @@ def merge_fetch(args, config, localconfig, currentsizefile): tree_size = len(logorder) currentsize = {"index": tree_size - 1, "hash": hexencode(logorder[tree_size-1])} write_file(currentsizefile, currentsize) - reportstatus(statusservers, own_key, "fetch", "fetched", tree_size) + reportstatus(statusservers, own_key, own_key[0], "fetched", tree_size) print >>sys.stderr, added_entries, sys.stderr.flush() print >>sys.stderr @@ -141,7 +142,7 @@ def merge_fetch(args, config, localconfig, currentsizefile): sys.stderr.flush() tree_size = len(logorder) - reportstatus(statusservers, own_key, "fetch", "fetched", tree_size) + reportstatus(statusservers, own_key, own_key[0], "fetched", tree_size) if tree_size == 0: return (0, '') else: |