.. _license-process-command-details:

Process Command Details
========================

.. _21.4-PB5|VOSS-1261:
.. _25.3|VOSS-1464:

As highlighted in the overview, both the license counting and license
audit report processes will automatically run regularly on a schedule.
In the event a manual run of the license counting or license audit
report process is required (adhoc data between schedules, or schedule
failure), the commands can be run via the VOSS CLI.

This section provides additional details of actions and behavior of the
processes as well the details of the commands to run them manually as
needed.

.. _license-counting-process-commands:

License Counting process commands
-----------------------------------------

This will only update the license counts captured
(``data/LicenseAuditCounts``) and visible in the admin portal
**About > License Counts** menu. If you want to generate the
license audit report, then that process will also need
to be run.

When the command runs (either manual or via schedule) the following
behavior is invoked:

-  An entry will exist in the counts for each customer in the system -
   the count record is created at the customer level in the hierarchy.
   That record is updated during each run of the audit while new records
   are created for any new customers since the last audit. The record is
   removed when the customer is removed from the product.
-  Any resources (Users, devices, etc) above the customer level will be
   captured in an entry at the provider level then handled similarly to
   the customer record above.
-  An error will be generated if no provider or customer hierarchy
   exists in the system
-  There is a "cool down" period of 3 minutes during which the command
   cannot be re-run.
-  There is a time-out period of 120 minutes after which a running
   command execution will stop - for situations where an error occurs. A
   log entry is also added in this case.
-  When the license counting runs manually or on a schedule,  
   *and* if the global system level settings for Automate
   called **Enable or disable system user audit** is enabled (by default not enabled),
   a user audit process is executed to audit and synchronize Automate user data
   across multiple systems that may be connected, such as:
   LDAP, Cisco UCM, Cisco Unity Connection (CUC), MS 365, Webex Teams and MS Teams.
   For details on this audit process, see: :ref:`system-user-audit`.

To run this command via the platform CLI:

``voss license-audit-counting [--from-hierarchy-pkid <optional hierarchy pkid>]``

You can optionally provide a hierarchy pkid for the license counting
process to run at (e.g for a specific customer, or reseller and its
customers).For instance

``voss license-audit-counting --from-hierarchy-pkid 64d409101a27f48dbce445b7``

In this case, only the customer record(s) under the hierarchy with the
pkid ``64d409101a27f48dbce445b7`` will be processed. This is useful if you
are testing or only need to update a specific hierarchy level between
schedules.

Example output:

::

    $ voss license-audit-counting
    Executing the License Audit counting service...
    The License Audit counting command took '7.3950326209997' seconds to execute.
    The License Audit counting service completed successfully.


License Audit Reporting process commands
----------------------------------------------

This will only export to file the current license counts captured
(``data/LicenseAuditCounts``) and visible in the admin portal
**About > License Counts** menu. If you want to update the counts before you
generate the export file, then the license count process should be run
first.

.. important::

   Since a data export can take time, the **voss export** command can
   only be run in a ``tmux`` session. First run ``tmux`` and
   then **voss export** and its parameters.


To run this command via the platform CLI:

``voss export type license_audit``

When the command runs (either manual or via schedule) the behavior is as
outlined in :ref:`license-audit-report` in terms of generating and
handling the files.

Example output:

::

   $ voss export type license_audit
   Starting license_audit export, please wait...
   Completed license_audit export, created vlf_CS-P_VOSS_license_2024-02-21_0553.zip, vlf_CS-P_VOSS_detailed_2024-02-21_0553.csv.

