×

UNMS - CLI

Overview

In this article, we introduce some basic console commands that can be useful for solving UNMS related issues.

Table of Contents

  1. Introduction
  2. Restart UNMS
  3. Stop UNMS
  4. Start UNMS
  5. Set Superadmin
  6. Password recovery (0.14.0+)
  7. Refresh Let's Encrypt certificate
  8. Fix redis aof file
  9. Rewrite redis aof file
  10. Device update frequency
  11. Clear backups
  12. Restore UNMS from backup
  13. Worker count
  14. Whitelist
  15. Related Articles

Introduction

Back to Top

NOTE: This command will not remove your settings or data, but will log all users out of UNMS.

Below you will find some useful console commands for UNMS. If you need to reset the application or find out forgotten password you will find the right tool here.

Restart (0.10.0+)

Back to Top

Use the following command to rebuild all UNMS docker containers. Run as a user with sudo enabled.

sudo ~unms/app/unms-cli restart

Stop (0.10.0+)

Back to Top

This command stops UNMS containers. Run as a user with sudo enabled.

sudo ~unms/app/unms-cli stop

Start (0.10.0+)

Back to Top

This command starts UNMS containers. Run as a user with sudo enabled.

sudo ~unms/app/unms-cli start

Set Superadmin (1.0.0+)

Back to Top

Superadmin role is necessary for access to the CRM module. When it is necessary to set super admin from outside of UNMS GUI, this command is available

sudo ~unms/app/unms-cli set-superadmin --username <username>
NOTE: It is possible to use this command without the --username tag, to display the list of available users.

Password recovery (0.14.0+)

Back to Top

In version 0.14.0 we changed the password recovery to have the same format as the rest of UNMS CLI commands. To change a user's password, specify the username as a parameter and enter a new password when asked:

sudo ~unms/app/unms-cli set-password --username <username>

In case of any issues with two-factor authentication this command can be used to completely disable it:

sudo ~unms/app/unms-cli disable-two-factor --username <username>

Another new feature is the role of the super admin. When it is necessary to set super admin from outside of UNMS GUI, this command is available

sudo ~unms/app/unms-cli set-superadmin --username <username>
NOTE:It is possible to use all of the commands above without the --username tag, to display the list of users instead of changing their password or disabling 2FA for them.

Refresh Let's Encrypt certificate (0.12.0+)

Back to Top

This command refresh Let's Encrypt certificate. Run as a user with sudo enabled.

sudo ~unms/app/unms-cli refresh-certificate

Fix redis aof file (0.12.0+)

Back to Top

This command fixes corrupted redis aof file, which can be located here /home/unms/data/redis/appendonly.aof. Run as a user with sudo enabled.

sudo ~unms/app/unms-cli stop
sudo ~unms/app/unms-cli fix-redis-aof
sudo ~unms/app/unms-cli start

Rewrite redis aof file (0.12.0+)

Back to Top

This command forces redis aof file to recalculate. Useful when the file is too big, you can check the size of this file here /home/unms/data/redis/appendonly.aof. Run as a user with sudo enabled. UNMS has to be running in order for this command to work. Also, please note that you will need a lot of free space on your disc to complete this process. We recommend you to delete some older logs to create enough space.

sudo ~unms/app/unms-cli rewrite-redis-aof

Reduce device update frequency (0.12.1-rc.2+)

Back to Top

This command reduces the UNMS device update frequency. It's helpful when UNMS is overloaded and it's not possible login to UNMS UI.

sudo ~unms/app/unms-cli reduce-device-update-frequency

Clear device backups (0.13.0+)

Back to Top

Use the following command when you are running out of the disc space because of a large volume of device backups.

sudo ~unms/app/unms-cli clear-device-backups

Restore UNMS from backup (0.14.0+)

Back to Top

Use the following command to restore UNMS from a selected backup file.

unms-cli restore-backup --file <backup-file>
NOTE:When this CLI command is used without the --file tag, then the latest automatic backup is automatically selected.

Worker count (0.13.0+)

Back to Top

ATTENTION: The 'COUNT' value should not be higher than the actual number of available CPU cores. It is possible to set thisvalue to 'auto' in order to let UNMS decide how many workers it needs. Please have at least 0,5 Gb of free RAM free for each worker.

If you need to utilize your multicore processor to its maximum you can set the number of worker processes which are managing device connections.

sudo ~unms/app/unms-cli set-workers COUNT

Whitelist of IP addresses for GUI/API (0.14.0+)

Back to Top

NOTE:This only limits the access to GUI/API. All devices can still connect to UNMS server from any IP address, and this whitelist doesn't affect that connection at all.

Use the following command when you want to manage the whitelist of IP addresses that are allowed to access UNMS GUI/API.

  • Show current whitelist
    sudo ~unms/app/unms-cli ip-whitelist --show
    
  • Create a new whitelist
    sudo ~unms/app/unms-cli ip-whitelist --set "193.86.83.186,ff::ff/25"
    
  • Clear the whitelist to allow access from all addresses
    sudo ~unms/app/unms-cli ip-whitelist --clear
    

Related Articles

Back to Top

UNMS - How to restart UNMS

 

Was this article helpful?
0 out of 1 found this helpful
Can't find what you're looking for?
Visit our worldwide community of Ubiquiti experts for more answers
Visit the Ubiquiti Community
Can't find what you're looking for?