mirror of
https://github.com/ShaYmez/HBmonitor.git
synced 2024-10-31 14:27:15 -04:00
Fixing problems, updating format, add OpenBridge
This commit is contained in:
parent
dda32abe92
commit
804214b020
@ -2,18 +2,26 @@
|
|||||||
<h4>Master Systems</h4>
|
<h4>Master Systems</h4>
|
||||||
<table style="width:100%; font: 10pt arial, sans-serif">
|
<table style="width:100%; font: 10pt arial, sans-serif">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col style="width: 20%" />
|
|
||||||
<col style="width: 15%" />
|
|
||||||
<col style="width: 15%" />
|
<col style="width: 15%" />
|
||||||
<col style="width: 10%" />
|
<col style="width: 10%" />
|
||||||
<col style="width: 15%" />
|
<col style="width: 10%" />
|
||||||
<col style="width: 15%" />
|
<col style="width: 10%" />
|
||||||
|
<col style="width: 5%" />
|
||||||
|
<col style="width: 5%" />
|
||||||
|
<col style="width: 10%" />
|
||||||
|
<col style="width: 5%" />
|
||||||
|
<col style="width: 10%" />
|
||||||
|
<col style="width: 10%" />
|
||||||
<col style="width: 10%" />
|
<col style="width: 10%" />
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tr style="width:100%; font: 10pt arial, sans-serif; background-color:#666666; color:white">
|
<tr style="width:100%; font: 10pt arial, sans-serif; background-color:#666666; color:white">
|
||||||
<th>HBP System</th>
|
<th>HBP System</th>
|
||||||
<th>Client Radio ID</th>
|
<th>Client Radio ID</th>
|
||||||
<th>Callsign</th>
|
<th>Callsign</th>
|
||||||
|
<th>Frequency</th>
|
||||||
|
<th>ColorCode</th>
|
||||||
|
<th>LinkTS</th>
|
||||||
|
<th>Location</th>
|
||||||
<th>Connection</th>
|
<th>Connection</th>
|
||||||
<th>Pings</br>Received</th>
|
<th>Pings</br>Received</th>
|
||||||
<th>IP</th>
|
<th>IP</th>
|
||||||
@ -24,9 +32,13 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="font-weight:bold" rowspan="{{ _table['MASTERS'][_master]|length * 2 }}"> {{ _master}} </td>
|
<td style="font-weight:bold" rowspan="{{ _table['MASTERS'][_master]|length * 2 }}"> {{ _master}} </td>
|
||||||
{% for _client, _cdata in _table['MASTERS'][_master]['CLIENTS'].iteritems() %}
|
{% for _client, _cdata in _table['MASTERS'][_master]['PEERS'].iteritems() %}
|
||||||
<td>{{ _client }}</td>
|
<td>{{ _client }}</td>
|
||||||
<td>{{ _cdata['CALLSIGN'] }}</td>
|
<td>{{ _cdata['CALLSIGN'] }}</td>
|
||||||
|
<td>{{ _cdata['TX_FREQ'] }}</td>
|
||||||
|
<td>{{ _cdata['COLORCODE'] }}</td>
|
||||||
|
<td>{{ _cdata['SLOTS'] }}</td>
|
||||||
|
<td>{{ _cdata['LOCATION'] }}</td>
|
||||||
<td style={{ 'background-color:#00ff00' if _cdata['CONNECTION'] == 'YES' else ';background-color:#ff0000' }}>{{ _cdata['CONNECTION'] }}</td>
|
<td style={{ 'background-color:#00ff00' if _cdata['CONNECTION'] == 'YES' else ';background-color:#ff0000' }}>{{ _cdata['CONNECTION'] }}</td>
|
||||||
<td>{{ _cdata['PINGS_RECEIVED'] }}</td>
|
<td>{{ _cdata['PINGS_RECEIVED'] }}</td>
|
||||||
<td>{{ _cdata['IP'] }}</td>
|
<td>{{ _cdata['IP'] }}</td>
|
||||||
@ -57,16 +69,52 @@
|
|||||||
<th>Master</th>
|
<th>Master</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
{% for _client in _table['CLIENTS'] %}
|
{% for _client in _table['PEERS'] %}
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="font-weight:bold"> {{ _client}} </td>
|
<td style="font-weight:bold"> {{ _client}} </td>
|
||||||
<td>{{ _table['CLIENTS'][_client]['RADIO_ID'] }}</td>
|
<td>{{ _table['PEERS'][_client]['RADIO_ID'] }}</td>
|
||||||
<td>{{ _table['CLIENTS'][_client]['CALLSIGN'] }}</td>
|
<td>{{ _table['PEERS'][_client]['CALLSIGN'] }}</td>
|
||||||
<td style={{ 'background-color:#00ff00' if _table['CLIENTS'][_client]['STATS']['CONNECTION'] == 'YES' else ';background-color:#ff0000' }}>{{ _table['CLIENTS'][_client]['STATS']['CONNECTION'] }}</td>
|
<td style={{ 'background-color:#00ff00' if _table['PEERS'][_client]['STATS']['CONNECTION'] == 'YES' else ';background-color:#ff0000' }}>{{ _table['PEERS'][_client]['STATS']['CONNECTION'] }}</td>
|
||||||
<td>{{ _table['CLIENTS'][_client]['STATS']['PINGS_SENT'] }}</td>
|
<td>{{ _table['PEERS'][_client]['STATS']['PINGS_SENT'] }}</td>
|
||||||
<td>{{ _table['CLIENTS'][_client]['STATS']['PINGS_ACKD'] }}</td>
|
<td>{{ _table['PEERS'][_client]['STATS']['PINGS_ACKD'] }}</td>
|
||||||
<td>{{ _table['CLIENTS'][_client]['MASTER_IP'] }}</td>
|
<td>{{ _table['PEERS'][_client]['MASTER_IP'] }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<h4>OpenBridge Systems</h4>
|
||||||
|
<table style="width:100%; font: 10pt arial, sans-serif">
|
||||||
|
<colgroup>
|
||||||
|
<col style="width: 20%" />
|
||||||
|
<col style="width: 15%" />
|
||||||
|
<col style="width: 15%" />
|
||||||
|
<col style="width: 10%" />
|
||||||
|
<col style="width: 15%" />
|
||||||
|
<col style="width: 15%" />
|
||||||
|
<col style="width: 10%" />
|
||||||
|
</colgroup>
|
||||||
|
<tr style="width:100%; font: 10pt arial, sans-serif; background-color:#666666; color:white">
|
||||||
|
<th>OpenBridge System</th>
|
||||||
|
<th>Network ID</th>
|
||||||
|
<th>Target IP</th>
|
||||||
|
<th>Target Port</th>
|
||||||
|
<th />
|
||||||
|
<th />
|
||||||
|
<th />
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{% for _openbridge in _table['OPENBRIDGES'] %}
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td style="font-weight:bold"> {{ _openbridge}} </td>
|
||||||
|
<td>{{ _table['OPENBRIDGES'][_openbridge]['NETWORK_ID'] }}</td>
|
||||||
|
<td>{{ _table['OPENBRIDGES'][_openbridge]['TARGET_IP'] }}</td>
|
||||||
|
<td>{{ _table['OPENBRIDGES'][_openbridge]['TARGET_PORT'] }}</td>
|
||||||
|
<th />
|
||||||
|
<th />
|
||||||
|
<th />
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ def alias_string(_id, _dict):
|
|||||||
|
|
||||||
# Build the HBlink connections table
|
# Build the HBlink connections table
|
||||||
def build_hblink_table(_config):
|
def build_hblink_table(_config):
|
||||||
_stats_table = {'MASTERS': {}, 'PEERS': {}}
|
_stats_table = {'MASTERS': {}, 'PEERS': {}, 'OPENBRIDGES': {}}
|
||||||
for _hbp, _hbp_data in _config.iteritems():
|
for _hbp, _hbp_data in _config.iteritems():
|
||||||
if _hbp_data['ENABLED'] == True:
|
if _hbp_data['ENABLED'] == True:
|
||||||
if _hbp_data['MODE'] == 'MASTER':
|
if _hbp_data['MODE'] == 'MASTER':
|
||||||
@ -109,20 +109,27 @@ def build_hblink_table(_config):
|
|||||||
for _client in _hbp_data['PEERS']:
|
for _client in _hbp_data['PEERS']:
|
||||||
_stats_table['MASTERS'][_hbp]['PEERS'][int_id(_client)] = {}
|
_stats_table['MASTERS'][_hbp]['PEERS'][int_id(_client)] = {}
|
||||||
_stats_table['MASTERS'][_hbp]['PEERS'][int_id(_client)]['CALLSIGN'] = _hbp_data['PEERS'][_client]['CALLSIGN']
|
_stats_table['MASTERS'][_hbp]['PEERS'][int_id(_client)]['CALLSIGN'] = _hbp_data['PEERS'][_client]['CALLSIGN']
|
||||||
|
_stats_table['MASTERS'][_hbp]['PEERS'][int_id(_client)]['TX_FREQ'] = _hbp_data['PEERS'][_client]['TX_FREQ'][:3] + '.' + _hbp_data['PEERS'][_client]['TX_FREQ'][3:6]
|
||||||
|
_stats_table['MASTERS'][_hbp]['PEERS'][int_id(_client)]['COLORCODE'] = _hbp_data['PEERS'][_client]['COLORCODE']
|
||||||
|
_stats_table['MASTERS'][_hbp]['PEERS'][int_id(_client)]['SLOTS'] = _hbp_data['PEERS'][_client]['SLOTS'] if (0 < _hbp_data['PEERS'][_client]['SLOTS'] < 3) else 'Both'
|
||||||
|
_stats_table['MASTERS'][_hbp]['PEERS'][int_id(_client)]['LOCATION'] = _hbp_data['PEERS'][_client]['LOCATION']
|
||||||
_stats_table['MASTERS'][_hbp]['PEERS'][int_id(_client)]['CONNECTION'] = _hbp_data['PEERS'][_client]['CONNECTION']
|
_stats_table['MASTERS'][_hbp]['PEERS'][int_id(_client)]['CONNECTION'] = _hbp_data['PEERS'][_client]['CONNECTION']
|
||||||
_stats_table['MASTERS'][_hbp]['PEERS'][int_id(_client)]['IP'] = _hbp_data['PEERS'][_client]['IP']
|
_stats_table['MASTERS'][_hbp]['PEERS'][int_id(_client)]['IP'] = _hbp_data['PEERS'][_client]['IP']
|
||||||
_stats_table['MASTERS'][_hbp]['PEERS'][int_id(_client)]['PINGS_RECEIVED'] = _hbp_data['PEERS'][_client]['PINGS_RECEIVED']
|
_stats_table['MASTERS'][_hbp]['PEERS'][int_id(_client)]['PINGS_RECEIVED'] = _hbp_data['PEERS'][_client]['PINGS_RECEIVED']
|
||||||
_stats_table['MASTERS'][_hbp]['PEERS'][int_id(_client)]['LAST_PING'] = _hbp_data['PEERS'][_client]['LAST_PING']
|
_stats_table['MASTERS'][_hbp]['PEERS'][int_id(_client)]['LAST_PING'] = _hbp_data['PEERS'][_client]['LAST_PING']
|
||||||
_stats_table['MASTERS'][_hbp]['PEERS'][int_id(_client)]['PORT'] = _hbp_data['PEERS'][_client]['PORT']
|
_stats_table['MASTERS'][_hbp]['PEERS'][int_id(_client)]['PORT'] = _hbp_data['PEERS'][_client]['PORT']
|
||||||
elif _hbp_data['MODE'] == 'CLIENT':
|
elif _hbp_data['MODE'] == 'PEER':
|
||||||
_stats_table['PEERS'][_hbp] = {}
|
_stats_table['PEERS'][_hbp] = {}
|
||||||
_stats_table['PEERS'][_hbp]['CALLSIGN'] = _hbp_data['CALLSIGN']
|
_stats_table['PEERS'][_hbp]['CALLSIGN'] = _hbp_data['CALLSIGN']
|
||||||
_stats_table['PEERS'][_hbp]['RADIO_ID'] = int_id(_hbp_data['RADIO_ID'])
|
_stats_table['PEERS'][_hbp]['RADIO_ID'] = int_id(_hbp_data['RADIO_ID'])
|
||||||
_stats_table['PEERS'][_hbp]['MASTER_IP'] = _hbp_data['MASTER_IP']
|
_stats_table['PEERS'][_hbp]['MASTER_IP'] = _hbp_data['MASTER_IP']
|
||||||
_stats_table['PEERS'][_hbp]['STATS'] = _hbp_data['STATS']
|
_stats_table['PEERS'][_hbp]['STATS'] = _hbp_data['STATS']
|
||||||
|
elif _hbp_data['MODE'] == 'OPENBRIDGE':
|
||||||
|
_stats_table['OPENBRIDGES'][_hbp] = {}
|
||||||
|
_stats_table['OPENBRIDGES'][_hbp]['NETWORK_ID'] = int_id(_hbp_data['NETWORK_ID'])
|
||||||
|
_stats_table['OPENBRIDGES'][_hbp]['TARGET_IP'] = _hbp_data['TARGET_IP']
|
||||||
|
_stats_table['OPENBRIDGES'][_hbp]['TARGET_PORT'] = _hbp_data['TARGET_PORT']
|
||||||
return(_stats_table)
|
return(_stats_table)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# CONFBRIDGE TABLE FUNCTIONS
|
# CONFBRIDGE TABLE FUNCTIONS
|
||||||
@ -169,7 +176,6 @@ def build_bridge_table(_bridges):
|
|||||||
system['OFF'][i] = str(int_id(system['OFF'][i]))
|
system['OFF'][i] = str(int_id(system['OFF'][i]))
|
||||||
|
|
||||||
_stats_table[_bridge][system['SYSTEM']]['TRIG_OFF'] = ', '.join(system['OFF'])
|
_stats_table[_bridge][system['SYSTEM']]['TRIG_OFF'] = ', '.join(system['OFF'])
|
||||||
|
|
||||||
return _stats_table
|
return _stats_table
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -217,11 +223,11 @@ def process_message(_message):
|
|||||||
p = _message[1:].split(",")
|
p = _message[1:].split(",")
|
||||||
if p[0] == 'GROUP VOICE':
|
if p[0] == 'GROUP VOICE':
|
||||||
if p[1] == 'END':
|
if p[1] == 'END':
|
||||||
log_message = '{}: {} {}: System: {}; IPSC Peer: {} - {}; Subscriber: {} - {}; TS: {}; TGID: {}; Duration: {}s'.format(_now, p[0], p[1], p[2], p[4], alias_string(int(p[4]), peer_ids), p[5], alias_string(int(p[5]), subscriber_ids), p[6], p[7], p[8])
|
log_message = '{}: {} {}: System: {}; Source: {} - {}; TS: {}; TGID: {}; Origin: {} - {}; Time: {}s'.format(_now, p[0], p[1], p[2], p[4], alias_string(int(p[4]), peer_ids), p[6], p[7], p[5], alias_string(int(p[5]), subscriber_ids), p[8])
|
||||||
elif p[1] == 'START':
|
elif p[1] == 'START':
|
||||||
log_message = '{}: {} {}: System: {}; IPSC Peer: {} - {}; Subscriber: {} - {}; TS: {}; TGID: {}'.format(_now, p[0], p[1], p[2], p[4], alias_string(int(p[4]), peer_ids), p[5], alias_string(int(p[5]), subscriber_ids), p[6], p[7])
|
log_message = '{}: {} {}: System: {}; Source: {} - {}; TS: {}; TGID: {}; Origin: {} - {}'.format(_now, p[0], p[1], p[2], p[4], alias_string(int(p[4]), peer_ids), p[6], p[7], p[5], alias_string(int(p[5]), subscriber_ids))
|
||||||
elif p[1] == 'END WITHOUT MATCHING START':
|
elif p[1] == 'END WITHOUT MATCHING START':
|
||||||
log_message = '{}: {} {} on IPSC System {}: IPSC Peer: {} - {}; Subscriber: {} - {}; TS: {}; TGID: {}'.format(_now, p[0], p[1], p[2], p[4], alias_string(int(p[4]), peer_ids), p[5], alias_string(int(p[5]), subscriber_ids), p[6], p[7])
|
log_message = '{}: {} {} on HB System {}: Source: {} - {}; TS: {}; TGID: {}; Origin: {} - {}'.format(_now, p[0], p[1], p[2], p[4], alias_string(int(p[4]), peer_ids), p[6], p[7], p[5], alias_string(int(p[5]), subscriber_ids))
|
||||||
else:
|
else:
|
||||||
log_message = '{}: UNKNOWN GROUP VOICE LOG MESSAGE'.format(_now)
|
log_message = '{}: UNKNOWN GROUP VOICE LOG MESSAGE'.format(_now)
|
||||||
else:
|
else:
|
||||||
@ -257,7 +263,7 @@ class report(NetstringReceiver):
|
|||||||
|
|
||||||
class reportClientFactory(ReconnectingClientFactory):
|
class reportClientFactory(ReconnectingClientFactory):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
logging.info('reportClient object for connecting to HBlink.py created at: %s', self)
|
||||||
|
|
||||||
def startedConnecting(self, connector):
|
def startedConnecting(self, connector):
|
||||||
logging.info('Initiating Connection to Server.')
|
logging.info('Initiating Connection to Server.')
|
||||||
@ -349,7 +355,7 @@ class web_server(Resource):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
logging.basicConfig(level=logging.INFO,handlers=[logging.FileHandler(PATH + 'logfile.log'),logging.StreamHandler()])
|
logging.basicConfig(level=logging.DEBUG,handlers=[logging.FileHandler(PATH + 'logfile.log'),logging.StreamHandler()])
|
||||||
|
|
||||||
logging.info('web_tables.py starting up')
|
logging.info('web_tables.py starting up')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user