xmpp: Implement diagnostics

- Mostly moved from freedombox-setup.
This commit is contained in:
Sunil Mohan Adapa 2015-08-21 20:03:51 +05:30 committed by James Valleroy
parent 4210332bf6
commit c417c12436
3 changed files with 20 additions and 3 deletions

View File

@ -22,10 +22,10 @@ Configuration helper for the ejabberd service
"""
import argparse
import subprocess
import os
import shutil
import socket
import subprocess
import re
import yaml

View File

@ -20,6 +20,7 @@ Plinth module to configure XMPP server
"""
from gettext import gettext as _
import json
from plinth import actions
from plinth import action_utils
@ -101,3 +102,18 @@ def on_domainname_change(sender, old_domainname, new_domainname, **kwargs):
['change-domainname',
'--domainname', new_domainname],
async=True)
def diagnose():
"""Run diagnostics and return the results."""
results = []
results.append(action_utils.diagnose_port_listening(5222, 'tcp4'))
results.append(action_utils.diagnose_port_listening(5222, 'tcp6'))
results.append(action_utils.diagnose_port_listening(5269, 'tcp4'))
results.append(action_utils.diagnose_port_listening(5269, 'tcp6'))
results.append(action_utils.diagnose_port_listening(5280, 'tcp4'))
results.append(action_utils.diagnose_port_listening(5280, 'tcp6'))
results.extend(action_utils.diagnose_url_on_all('http://{host}/jwchat'))
return results

View File

@ -31,18 +31,19 @@
any other <a href='http://xmpp.org/xmpp-software/clients/' target='_blank'>
XMPP client </a>.</p>
<p><a href='/jwchat' target='_blank'class='btn btn-primary'> Launch web
<p><a href='/jwchat' target='_blank' class='btn btn-primary'> Launch web
client</a></p>
<h3>Status</h3>
<p>
<p class="running-status-parent">
{% if status.is_running %}
<span class="running-status active"></span> ejabberd is running
{% else %}
<span class="running-status inactive"></span> ejabberd is not running
{% endif %}
</p>
{% include "diagnostics_button.html" with module="xmpp" %}
<h3>Configuration</h3>