System Diagnostic in Shell?

Running two VMs on a NAS system and the GUI management fails to load consistently over the WAN link. I attribute that issue to the NAS and network settings than to the install.

I do, however, want to run the System Diagnostics to verify everything else. Can the System Diagnostics script be run from the shell?

Hey,

That subject was broached several times during the talks of the last Univention Summit a couple of weeks ago. At the moment this isn’t possible. Univention is aware that this is something a lot of people would really like to see, though, and they have stated that it is their goal to have a CLI version available

Note that there is something that looks like a CLI version of the system diagnosis module — but it isn’t really. The system check scripts are tools developed for use by their support team for quickly gathering an overview of the state of a system. As such it works more or less independent of the UCS version it is run on — unlike the UMC module “system diagnosis” which is highly version dependent. Both tools contain a different set of checks. If I remember correctly, the stated goal is to unify both code bases and to provide a CLI tool equivalent of what the UMC module “system diagnosis” does in the future.

Kind regards,
mosu

1 Like

Thanks for the detailed explanation to that question Moritz! Not what I wanted to hear, but very glad to know I’m not alone. :slight_smile:

As an update: Univention delivered on their promise to create a CLI version of the checks with UCS 4.3 errata 425 (4.4 has included it from the start). The same package that contains the UMC module now contains the CLI tool univention-run-diagnostic-checks. You’ll have to tell it which tests to run with the parameter -t, e.g. -t all for all checks or -t 03_check_notifier_replication successfully. If you want to know which tests you can run, take a look at the directory /usr/share/pyshared/univention/management/console/modules/diagnostic/plugins — each .py file in that directory is a single test, and you can use its base name with the -t parameter.

Here’s how such a run might look:

[0 root@master ~] univention-run-diagnostic-checks -t all
Domain Admin Login:administrator
Password:
ran 00_check_server_password successfully
ran 01_ssh_connection successfully
ran 03_check_notifier_replication successfully
ran 10_gateway successfully
ran 11_nameserver successfully
ran 12_proxy successfully
ran 20_check_nameservers successfully
ran 21_check_join_status successfully
ran 22_kdc_service successfully
ran 23_check_update_sites successfully
ran 30_disk_usage successfully
ran 32_security_limits successfully
ran 40_samba_tool_dbcheck successfully
ran 41_samba_tool_showrepl successfully
ran 43_connectors4_rejects successfully
ran 44_well_known_sid_check successfully
ran 45_heimdal_on_samba4_dc successfully
ran 46_kerberos_ddns_update successfully
ran 50_check_ucr_templates successfully
ran 51_hostname_check successfully
ran 52_mail_acl_sync successfully
ran 53_package_status successfully
ran 54_sources_list_check successfully
ran 55_user_migration successfully
ran 56_univention_types successfully

You can find the logging messages of the diagnostic modules at /var/log/univention/management-console-module-diagnostic.log


############################
## Check failed: 02_certificate_check - ĂśberprĂĽfe GĂĽltigkeit der SSL Zertifikate
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/diagnostic/__init__.py", line 275, in execute
    result = execute(umc_module, **kwargs)
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/diagnostic/plugins/02_certificate_check.py", line 286, in run
    cert_verify = list(verify_local(all_certificates))
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/diagnostic/plugins/02_certificate_check.py", line 260, in verify_local
    for error in verifier.verify(cert):
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/diagnostic/plugins/02_certificate_check.py", line 205, in verify
    for error in self._verify_timestamps(cert_path):
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/diagnostic/plugins/02_certificate_check.py", line 164, in _verify_timestamps
    with open(cert_path) as fob:
IOError: [Errno 2] Datei oder Verzeichnis nicht gefunden: '/etc/univention/ssl/ucsCA/certs/19.pem'

########### End #############

############################
## Check failed: 04_saml_certificate_check - ĂśberprĂĽfung der SAML-Zertifikate fehlgeschlagen!
Das Zertifikat des SAML Service Providers stimmt nicht ĂĽberein.
########### End #############

############################
## Check failed: 31_file_permissions - ĂśberprĂĽfe Datei Berechtigungen
Datei '/var/cache/univention-virtual-machine-manager-daemon' hat Datei-Modus 755, 700 war erwartet.
########### End #############

You can pass the name & password to use for logging in with additional parameters; see univention-run-diagnostic-checks --help for details.

2 Likes

Really good, thank you!

It would be even better, if this could be run once a day automatically and send an email if there is an error. I can write a script myself, of course, but maybe you even add it to the webinterface?

Cli works. However…
Is there anyway to use the REST API to pull this diagnostic info?
For that matter any rest API to pull when system requires updates / upgrades too?

1 Like