Search in sources :

Example 1 with ServiceState

use of org.opendaylight.infrautils.diagstatus.ServiceState in project infrautils by opendaylight.

the class DiagStatusServiceMBeanImpl method acquireServiceStatusBrief.

@Override
public String acquireServiceStatusBrief() {
    String errorState = "ERROR - ";
    StringBuilder statusSummary = new StringBuilder();
    statusSummary.append("System ready state: ").append(systemReadyMonitor.getSystemState()).append('\n');
    for (ServiceDescriptor stat : diagStatusService.getAllServiceDescriptors()) {
        ServiceState state = stat.getServiceState();
        if (state.equals(ERROR) || state.equals(UNREGISTERED)) {
            statusSummary.append(errorState).append(stat.getModuleServiceName()).append(" ");
        }
    }
    return statusSummary.toString();
}
Also used : ServiceState(org.opendaylight.infrautils.diagstatus.ServiceState) ServiceDescriptor(org.opendaylight.infrautils.diagstatus.ServiceDescriptor)

Example 2 with ServiceState

use of org.opendaylight.infrautils.diagstatus.ServiceState in project genius by opendaylight.

the class DatastoreServiceStatusProvider method getServiceDescriptor.

@Override
public ServiceDescriptor getServiceDescriptor() {
    ServiceState dataStoreServiceState = ServiceState.ERROR;
    String statusDesc;
    Boolean operSyncStatusValue = (Boolean) MBeanUtils.readMBeanAttribute("org.opendaylight.controller:type=" + "DistributedOperationalDatastore,Category=ShardManager,name=shard-manager-operational", "SyncStatus");
    Boolean configSyncStatusValue = (Boolean) MBeanUtils.readMBeanAttribute("org.opendaylight.controller:type=" + "DistributedConfigDatastore,Category=ShardManager,name=shard-manager-config", "SyncStatus");
    if (operSyncStatusValue != null && configSyncStatusValue != null) {
        if (operSyncStatusValue && configSyncStatusValue) {
            dataStoreServiceState = ServiceState.OPERATIONAL;
            statusDesc = dataStoreServiceState.name();
        } else {
            statusDesc = "datastore out of sync";
        }
    } else {
        statusDesc = "Unable to obtain the datastore status";
    }
    return new ServiceDescriptor(DATASTORE_SERVICE_NAME, dataStoreServiceState, statusDesc);
}
Also used : ServiceState(org.opendaylight.infrautils.diagstatus.ServiceState) ServiceDescriptor(org.opendaylight.infrautils.diagstatus.ServiceDescriptor)

Aggregations

ServiceDescriptor (org.opendaylight.infrautils.diagstatus.ServiceDescriptor)2 ServiceState (org.opendaylight.infrautils.diagstatus.ServiceState)2