kiranchavala commented on issue #12383:
URL: https://github.com/apache/cloudstack/issues/12383#issuecomment-3728594506

   @DaanHoogland  Thanks for the usage service logic 
   
   Please find the steps that I followed 
   
   1. Have a CloudStack environment (4.20.2) with 2 mgmt servers (mgmt1 and 
mgmt2)
   
   2. Have the CloudStack usage service running on both management servers
   
   3. Change the global setting 
   
   usage.stats.job.aggregation.range to 5 
   usage.stats.job.exec.time to  an upcoming timestamp
   
   Restart the cloudstack usage service 
   
   Check the usage log on both the management servers , the following message 
should be present 
   
   ```
   2026-01-09 08:56:44,369 INFO  
[cloud.usage.UsageManagerImpl_EnhancerByCloudStack_4ff0bd12] (main:[]) (logid:) 
Usage is configured to execute in time zone [UTC], at [09:00], each [5] 
minutes; the current time in that timezone is [2026-01-09T08:56:44+0000] and 
the next job is scheduled to execute at [2026-01-09T09:00:00+0000]. During its 
execution, Usage will aggregate stats according to the time zone [GMT] defined 
in global setting [usage.aggregation.timezone].
   
   ```
   
   4.  Stop the cloudstack-usage service  on mgmt1
   
   ```
   service cloudstack-usage stop
   
   
   [root@ref-trl-10556-k-Mol8-kiran-chavala-mgmt1 ~]# service cloudstack-usage 
status
   Redirecting to /bin/systemctl status cloudstack-usage.service
   ● cloudstack-usage.service - CloudStack Usage Server
      Loaded: loaded (/usr/lib/systemd/system/cloudstack-usage.service; 
enabled; vendor preset: disabled)
      Active: failed (Result: exit-code) since Fri 2026-01-09 08:58:14 UTC; 2h 
51min ago
        Docs: http://www.cloudstack.org/
     Process: 3822 ExecStart=/bin/sh -ec /usr/bin/java -Dpid=${JAVA_PID} 
$JAVA_OPTS $JAVA_DEBUG -cp $CLASSPATH $JAVA_CLASS (code=exited, status=143)
    Main PID: 3822 (code=exited, status=143)
   
   Jan 09 08:56:30 ref-trl-10556-k-Mol8-kiran-chavala-mgmt1 systemd[1]: 
cloudstack-usage.service: Main process exited, code=exited, status=143/n/a
   Jan 09 08:56:30 ref-trl-10556-k-Mol8-kiran-chavala-mgmt1 systemd[1]: 
cloudstack-usage.service: Failed with result 'exit-code'.
   Jan 09 08:56:30 ref-trl-10556-k-Mol8-kiran-chavala-mgmt1 systemd[1]: Stopped 
CloudStack Usage Server.
   Jan 09 08:56:30 ref-trl-10556-k-Mol8-kiran-chavala-mgmt1 systemd[1]: Started 
CloudStack Usage Server.
   Jan 09 08:58:14 ref-trl-10556-k-Mol8-kiran-chavala-mgmt1 systemd[1]: 
Stopping CloudStack Usage Server...
   Jan 09 08:58:14 ref-trl-10556-k-Mol8-kiran-chavala-mgmt1 systemd[1]: 
cloudstack-usage.service: Main process exited, code=exited, status=143/n/a
   Jan 09 08:58:14 ref-trl-10556-k-Mol8-kiran-chavala-mgmt1 systemd[1]: 
cloudstack-usage.service: Failed with result 'exit-code'.
   Jan 09 08:58:14 ref-trl-10556-k-Mol8-kiran-chavala-mgmt1 systemd[1]: Stopped 
CloudStack Usage Server.
   
   ```
   
   Check the usage status on the UI 
   
   <img width="1678" height="314" alt="Image" 
src="https://github.com/user-attachments/assets/73e9b569-75ab-41aa-8491-f76c2308529a";
 />
   
   
   5. Usage log on mgmt 1 
   
   ```
   2026-01-09 08:58:14,188 INFO  
[cloud.usage.UsageManagerImpl_EnhancerByCloudStack_4ff0bd12] (Thread-0:[]) 
(logid:) exiting Usage Manager
   2026-01-09 08:58:14,195 INFO  
[usage.dao.UsageJobDaoImpl_EnhancerByCloudStack_ae7858fa] (Thread-0:[]) 
(logid:) Found 1 opens job, to remove
   2026-01-09 08:58:14,195 DEBUG 
[usage.dao.UsageJobDaoImpl_EnhancerByCloudStack_ae7858fa] (Thread-0:[]) 
(logid:) Removing job - id: 5, pid: 3822, job type: 0, scheduled: 0, heartbeat: 
2026-01-09T08:57:59.000+0000
   
   ``
   
   6. Usage log om mgm2 
   
   ```
   2026-01-09 09:00:00,002 INFO  
[cloud.usage.UsageManagerImpl_EnhancerByCloudStack_4ff0bd12] (Usage-Job-1:[]) 
(logid:) starting usage job...
   2026-01-09 09:00:00,006 DEBUG 
[cloud.usage.UsageManagerImpl_EnhancerByCloudStack_4ff0bd12] (Usage-Job-1:[]) 
(logid:) Not owner of usage job, skipping...
   2026-01-09 09:00:00,007 INFO  
[cloud.usage.UsageManagerImpl_EnhancerByCloudStack_4ff0bd12] (Usage-Job-1:[]) 
(logid:) usage job complete
   2026-01-09 09:05:00,001 INFO  
[cloud.usage.UsageManagerImpl_EnhancerByCloudStack_4ff0bd12] (Usage-Job-1:[]) 
(logid:) starting usage job...
   2026-01-09 09:05:00,004 DEBUG 
[cloud.usage.UsageManagerImpl_EnhancerByCloudStack_4ff0bd12] (Usage-Job-1:[]) 
(logid:) Not owner of usage job, skipping...
   2026-01-09 09:05:00,004 INFO  
[cloud.usage.UsageManagerImpl_EnhancerByCloudStack_4ff0bd12] (Usage-Job-1:[]) 
(logid:) usage job complete
   2026-01-09 09:10:00,001 INFO  
[cloud.usage.UsageManagerImpl_EnhancerByCloudStack_4ff0bd12] (Usage-Job-1:[]) 
(logid:) starting usage job...
   2026-01-09 09:10:00,004 DEBUG 
[cloud.usage.UsageManagerImpl_EnhancerByCloudStack_4ff0bd12] (Usage-Job-1:[]) 
(logid:) Not owner of usage job, skipping...
   2026-01-09 09:10:00,005 INFO  
[cloud.usage.UsageManagerImpl_EnhancerByCloudStack_4ff0bd12] (Usage-Job-1:[]) 
(logid:) usage job complete
   2026-01-09 09:15:00,001 INFO  
[cloud.usage.UsageManagerImpl_EnhancerByCloudStack_4ff0bd12] (Usage-Job-1:[]) 
(logid:) starting usage job...
   
   ```
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to