Search in sources :

Example 1 with DiagRequestParams

use of com.emc.vipr.model.sys.healthmonitor.DiagRequestParams in project coprhd-controller by CoprHD.

the class HealthMonitorService method getDiagnostics.

/**
 * Get results of diagtool shell script for all virtual machines in a ViPR
 * controller appliance. Also gives test details when verbose option
 * is set.
 *
 * @brief Get diagtool script results
 * @param nodeIds node ids for which diagnostic results are collected.
 * @param nodeNames node names for which diagnostic results are collected.
 * @param verbose when set to "1"  will run command with -v option.
 * @prereq none
 * @return Returns diagnostic test results.
 */
@GET
@Path("/diagnostics")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public DiagnosticsRestRep getDiagnostics(@QueryParam("node_id") List<String> nodeIds, @QueryParam("verbose") String verbose, @QueryParam("node_name") List<String> nodeNames) {
    _log.info("Initiating diagnostics test for nodes");
    nodeIds = _coordinatorClientExt.combineNodeNamesWithNodeIds(nodeNames, nodeIds);
    boolean isVerbose = ("1".equals(verbose)) ? true : false;
    DiagRequestParams diagRequestParams = new DiagRequestParams(isVerbose);
    DiagnosticsRestRep diagnosticsRestRep = new DiagnosticsRestRep();
    List<NodeInfo> nodeInfoList = ClusterNodesUtil.getClusterNodeInfo(nodeIds);
    Map<String, NodeDiagnostics> nodesData = NodeDataCollector.getDataFromNodes(nodeInfoList, INTERNAL_NODE_DIAGNOSTICS_URI, Action.POST, diagRequestParams, NodeDiagnostics.class, null);
    String allocationResult = _checker.getNodeResourceAllocationCheckResult();
    DiagTest allocationTest = new DiagTest("Resource allocation", allocationResult, new ArrayList<TestParam>());
    for (Map.Entry<String, NodeDiagnostics> entry : nodesData.entrySet()) {
        List<DiagTest> diagTests = entry.getValue().getDiagTests();
        diagTests.add(allocationTest);
        entry.getValue().setDiagTests(diagTests);
    }
    diagnosticsRestRep.getNodeDiagnosticsList().addAll(nodesData.values());
    return diagnosticsRestRep;
}
Also used : TestParam(com.emc.vipr.model.sys.healthmonitor.TestParam) DiagRequestParams(com.emc.vipr.model.sys.healthmonitor.DiagRequestParams) DiagTest(com.emc.vipr.model.sys.healthmonitor.DiagTest) NodeInfo(com.emc.storageos.systemservices.impl.resource.util.NodeInfo) DiagnosticsRestRep(com.emc.vipr.model.sys.healthmonitor.DiagnosticsRestRep) NodeDiagnostics(com.emc.vipr.model.sys.healthmonitor.NodeDiagnostics) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Aggregations

CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 NodeInfo (com.emc.storageos.systemservices.impl.resource.util.NodeInfo)1 DiagRequestParams (com.emc.vipr.model.sys.healthmonitor.DiagRequestParams)1 DiagTest (com.emc.vipr.model.sys.healthmonitor.DiagTest)1 DiagnosticsRestRep (com.emc.vipr.model.sys.healthmonitor.DiagnosticsRestRep)1 NodeDiagnostics (com.emc.vipr.model.sys.healthmonitor.NodeDiagnostics)1 TestParam (com.emc.vipr.model.sys.healthmonitor.TestParam)1