Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,10 @@ public interface MorpheusAdminService {
* @return an instance of the implementation of the {@link MorpheusApplianceService}
*/
MorpheusApplianceService getAppliance();

/**
* Returns the Appliance Health Service for querying appliance health statistics asynchronously (reactive).
* @return an instance of the implementation of the {@link MorpheusApplianceHealthService}
*/
MorpheusApplianceHealthService getHealth();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2024 Morpheus Data, LLC.
*
* Licensed under the PLUGIN CORE SOURCE LICENSE (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://raw.githubusercontent.com/gomorpheus/morpheus-plugin-core/v1.0.x/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.morpheusdata.core.admin;

import com.morpheusdata.model.health.ApplianceHealth;
import io.reactivex.rxjava3.core.Single;

/**
* Provides access to appliance health statistics. The data returned mirrors
* what is available via the {@code /api/health} REST endpoint.
*
* @since 1.4.0
* @author alex.clement
*/
public interface MorpheusApplianceHealthService {

/**
* Returns the most recently cached appliance health data (updated every 5 minutes). Use this method
* unless you need real-time health data, as it is more efficient than {@link #getLiveHealth()}.
* It reads from stored health snapshots rather than querying live systems.
* @return an {@link ApplianceHealth} containing all health metric sections
*/
Single<ApplianceHealth> getHealth();

/**
* Returns live appliance health data by querying all subsystems in real time
* (CPU, memory, storage, threads, database, RabbitMQ, Elasticsearch).
* @return an {@link ApplianceHealth} containing all health metric sections
*/
Single<ApplianceHealth> getLiveHealth();
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ public interface MorpheusSynchronousAdminService {
MorpheusSynchronousUserService getUser();

MorpheusSynchronousApplianceService getAppliance();

MorpheusSynchronousApplianceHealthService getHealth();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2024 Morpheus Data, LLC.
*
* Licensed under the PLUGIN CORE SOURCE LICENSE (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://raw.githubusercontent.com/gomorpheus/morpheus-plugin-core/v1.0.x/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.morpheusdata.core.synchronous.admin;

import com.morpheusdata.model.health.ApplianceHealth;

/**
* Synchronous version of {@link com.morpheusdata.core.admin.MorpheusApplianceHealthService}.
* Provides access to appliance health statistics in a blocking manner.
*
* @since 1.4.0
* @author alex.clement
*/
public interface MorpheusSynchronousApplianceHealthService {

/**
* Returns the most recently cached appliance health data.
* @return an {@link ApplianceHealth} containing all health metric sections
*/
ApplianceHealth getHealth();

/**
* Returns live appliance health data by querying all subsystems in real time.
* @return an {@link ApplianceHealth} containing all health metric sections
*/
ApplianceHealth getLiveHealth();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/*
* Copyright 2024 Morpheus Data, LLC.
*
* Licensed under the PLUGIN CORE SOURCE LICENSE (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://raw.githubusercontent.com/gomorpheus/morpheus-plugin-core/v1.0.x/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.morpheusdata.model.health;

import java.util.Date;

/**
* Represents the health status of the Morpheus appliance, including CPU, memory, storage,
* threads, database, message queue, and search engine metrics.
*/
public class ApplianceHealth {

protected Boolean success;
protected String statusMessage;
protected String applianceUrl;
protected String buildVersion;
protected String uuid;
protected Boolean setupNeeded;
protected Date date;

protected ApplianceHealthCpuStats cpu;
protected ApplianceHealthMemoryStats memory;
protected ApplianceHealthStorageStats storage;
protected ApplianceHealthThreadStats threads;
protected ApplianceHealthDatabaseStats database;
protected ApplianceHealthRabbitStats rabbit;
protected ApplianceHealthElasticStats elastic;

public Boolean getSuccess() { return success; }
public void setSuccess(Boolean success) { this.success = success; }

public String getStatusMessage() { return statusMessage; }
public void setStatusMessage(String statusMessage) { this.statusMessage = statusMessage; }

public String getApplianceUrl() { return applianceUrl; }
public void setApplianceUrl(String applianceUrl) { this.applianceUrl = applianceUrl; }

public String getBuildVersion() { return buildVersion; }
public void setBuildVersion(String buildVersion) { this.buildVersion = buildVersion; }

public String getUuid() { return uuid; }
public void setUuid(String uuid) { this.uuid = uuid; }

public Boolean getSetupNeeded() { return setupNeeded; }
public void setSetupNeeded(Boolean setupNeeded) { this.setupNeeded = setupNeeded; }

public Date getDate() { return date; }
public void setDate(Date date) { this.date = date; }

public ApplianceHealthCpuStats getCpu() { return cpu; }
public void setCpu(ApplianceHealthCpuStats cpu) { this.cpu = cpu; }

public ApplianceHealthMemoryStats getMemory() { return memory; }
public void setMemory(ApplianceHealthMemoryStats memory) { this.memory = memory; }

public ApplianceHealthStorageStats getStorage() { return storage; }
public void setStorage(ApplianceHealthStorageStats storage) { this.storage = storage; }

public ApplianceHealthThreadStats getThreads() { return threads; }
public void setThreads(ApplianceHealthThreadStats threads) { this.threads = threads; }

public ApplianceHealthDatabaseStats getDatabase() { return database; }
public void setDatabase(ApplianceHealthDatabaseStats database) { this.database = database; }

public ApplianceHealthRabbitStats getRabbit() { return rabbit; }
public void setRabbit(ApplianceHealthRabbitStats rabbit) { this.rabbit = rabbit; }

public ApplianceHealthElasticStats getElastic() { return elastic; }
public void setElastic(ApplianceHealthElasticStats elastic) { this.elastic = elastic; }

@Override
public String toString() {
return "ApplianceHealth{" +
"success=" + success +
", applianceUrl='" + applianceUrl + '\'' +
", buildVersion='" + buildVersion + '\'' +
", uuid='" + uuid + '\'' +
", setupNeeded=" + setupNeeded +
", date=" + date +
", statusMessage='" + statusMessage + '\'' +
", cpu=" + cpu +
", memory=" + memory +
", storage=" + storage +
", threads=" + threads +
", database=" + database +
", rabbit=" + rabbit +
", elastic=" + elastic +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright 2024 Morpheus Data, LLC.
*
* Licensed under the PLUGIN CORE SOURCE LICENSE (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://raw.githubusercontent.com/gomorpheus/morpheus-plugin-core/v1.0.x/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.morpheusdata.model.health;

public class ApplianceHealthCpuStats {

protected Double cpuLoad;
protected Double cpuTotalLoad;
protected Integer processorCount;
protected Double processTime;
protected Double systemLoad;
protected String status;
protected String statusMessage;

public Double getCpuLoad() { return cpuLoad; }
public void setCpuLoad(Double cpuLoad) { this.cpuLoad = cpuLoad; }

public Double getCpuTotalLoad() { return cpuTotalLoad; }
public void setCpuTotalLoad(Double cpuTotalLoad) { this.cpuTotalLoad = cpuTotalLoad; }

public Integer getProcessorCount() { return processorCount; }
public void setProcessorCount(Integer processorCount) { this.processorCount = processorCount; }

public Double getProcessTime() { return processTime; }
public void setProcessTime(Double processTime) { this.processTime = processTime; }

public Double getSystemLoad() { return systemLoad; }
public void setSystemLoad(Double systemLoad) { this.systemLoad = systemLoad; }

public String getStatus() { return status; }
public void setStatus(String status) { this.status = status; }

public String getStatusMessage() { return statusMessage; }
public void setStatusMessage(String statusMessage) { this.statusMessage = statusMessage; }

@Override
public String toString() {
return "ApplianceHealthCpuStats{" +
"cpuLoad=" + cpuLoad +
", cpuTotalLoad=" + cpuTotalLoad +
", processorCount=" + processorCount +
", processTime=" + processTime +
", systemLoad=" + systemLoad +
", status='" + status + '\'' +
", statusMessage='" + statusMessage + '\'' +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright 2024 Morpheus Data, LLC.
*
* Licensed under the PLUGIN CORE SOURCE LICENSE (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://raw.githubusercontent.com/gomorpheus/morpheus-plugin-core/v1.0.x/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.morpheusdata.model.health;

public class ApplianceHealthDatabaseConnection {

protected Long id;
protected String user;
protected String host;
protected String database;
protected String command;
protected Long time;
protected String state;
protected String info;

public Long getId() { return id; }
public void setId(Long id) { this.id = id; }

public String getUser() { return user; }
public void setUser(String user) { this.user = user; }

public String getHost() { return host; }
public void setHost(String host) { this.host = host; }

public String getDatabase() { return database; }
public void setDatabase(String database) { this.database = database; }

public String getCommand() { return command; }
public void setCommand(String command) { this.command = command; }

public Long getTime() { return time; }
public void setTime(Long time) { this.time = time; }

public String getState() { return state; }
public void setState(String state) { this.state = state; }

public String getInfo() { return info; }
public void setInfo(String info) { this.info = info; }

@Override
public String toString() {
return "ApplianceHealthDatabaseConnection{" +
"id=" + id +
", user='" + user + '\'' +
", host='" + host + '\'' +
", database='" + database + '\'' +
", command='" + command + '\'' +
", time=" + time +
", state='" + state + '\'' +
", info='" + info + '\'' +
'}';
}
}
Loading
Loading