Commit e8fe1b52 authored by Hiro's avatar Hiro 🏄
Browse files

Count total moat and obsf4 bridges on the network

parent a28d025e
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -93,11 +93,17 @@ for bridge in bridges:
            moat_bridges.append(bridge)
    else:
        offline_bridges.append(bridge)
        if transports is not None and "obfs4" in transports:
            total_obfs4_bridges.append(bridge)
        if bridge.get('bridgedb_distributor') == "moat":
            total_moat_bridges.append(bridge)

total_online_bridges = len(online_bridges)
total_offline_bridges = len(offline_bridges)
total_online_obfs4_bridges = len(obfs4_bridges)
total_obsf4_bridges = len(all_obsf4_bridges)
total_online_moat_bridges = len(moat_bridges)
total_moat_bridges = len(all_moat_bridges)

for bridge in online_bridges:
    if bridge.get('overload_general_timestamp'):
@@ -165,11 +171,17 @@ total_network_bridges.set(total_bridges)
total_online_network_bridges = Gauge('total_online_bridges', 'Current number of online bridges on the network', registry=registry)
total_online_network_bridges.set(total_online_bridges)

total_online_network_obsf4_bridges = Gauge('total_online_obsf4_bridges', 'Current number of online bridges on the network', registry=registry)
total_online_network_obsf4_bridges = Gauge('total_online_obsf4_bridges', 'Current number of online obsf4 bridges on the network', registry=registry)
total_online_network_obsf4_bridges.set(total_online_obfs4_bridges)

total_online_network_moat_bridges = Gauge('total_online_moat_bridges', 'Current number of online bridges on the network', registry=registry)
total_online_network_moat_bridges.set(total_online_moat_bridges)
total_network_obsf4_bridges = Gauge('total_network_obsf4_bridges', 'Current number of obsf4 bridges on the network', registry=registry)
total_network_obsf4_bridges.set(total_obfs4_bridges)

total_online_network_moat_bridges = Gauge('total_online_moat_bridges', 'Current number of online moat bridges on the network', registry=registry)
total_online_network_moat_bridges.set(tota_moat_bridges)

total_network_moat_bridges = Gauge('total_network_moat_bridges', 'Current number of moat bridges on the network', registry=registry)
total_network_moat_bridges.set(total_moat_bridges)

relays_network_overload_general = Gauge('relays_overload_general', 'Current number of relays in overload_general state', registry=registry)
relays_network_overload_general.set(len(relays_overload_general))
+2 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ try:
    else:
        list_of_errors = Counter([(x.split(' ')[2], x.split(' ')[3].split(':')[0]) for x in str(out).split('\\n') if x != '"'])
        for c in list_of_errors:
            if len(c) >  1:
                g_warnings.labels(host, c[0], c[1]).set(list_of_errors[c])

except Exception as e: