private AdminResponse handleHealthCheckRequest(DataInputStream requestStream, AdminRequest adminRequest) {
    ServerHealthStatus serverHealthStatus = this.storeManager instanceof StorageManager ? ServerHealthStatus.GOOD
        : ServerHealthStatus.BAD; //used to determine if the server is ever unhealthy
    JSONArray brokenDisks = new JSONArray();        // indicate which disks didn't pass the disk healthcheck
    JSONArray unstablePartitions = new JSONArray(); // indicate which partitions aren't in leader/standby state

    if (this.storeManager instanceof StorageManager) {
      StorageManager storageManager = (StorageManager) this.storeManager;

      //Finds all partitions on this host
      List<PartitionId> partitionsInThisHost = Collections.list(storageManager.getPartitionToDiskManager().keys());

      /*
       Checks if the Host's BlobStore exists,started and is Leader/Standby ReplicaState for all Partitions
       this Host is apart of
       */
      for (PartitionId partitionId : partitionsInThisHost) {
        BlobStore hostBlobStore = (BlobStore) storageManager.getStore(partitionId);

        //if any fail, this host isn't healthy
        if (hostBlobStore == null || !hostBlobStore.isStarted() || (
            (hostBlobStore.getCurrentState() != ReplicaState.STANDBY) && (hostBlobStore.getCurrentState()
                != ReplicaState.LEADER))) {

          JSONObject unstablePartition = new JSONObject();
          unstablePartition.put("partitionId", partitionId);
          unstablePartition.put("reason", hostBlobStore != null ? hostBlobStore.getCurrentState() : "Missing");
          unstablePartitions.put(unstablePartition);
        }
      }

      /*
       Checks if every disk that's assigned to a partition is also mounted and disk is healthy
       */
      if (diskManagerConfig.diskManagerDiskHealthCheckEnabled) {
        HashSet<DiskManager> partitionsDiskManagers =
            new HashSet<>(storageManager.getPartitionToDiskManager().values());
        for (Map.Entry<DiskId, DiskManager> entry : storageManager.getDiskToDiskManager().entrySet()) {
          DiskManager mountedDiskManager = entry.getValue();

          //Checks Disk healthchecking is enabled and
          // if a disk manager is assigned to a partition and isn't healthy then store it as part of the response
          if (partitionsDiskManagers.contains(mountedDiskManager)
              && mountedDiskManager.getDiskHealthStatus() != DiskHealthStatus.HEALTHY) {

            JSONObject brokenDisk = new JSONObject();
            brokenDisk.put("disk", entry.getKey().getMountPath());
            brokenDisk.put("reason", mountedDiskManager.getDiskHealthStatus());
            brokenDisks.put(brokenDisk);
          }
        }
      }
    }
    //if there are any issues on the partition or disk state then considered BAD
    serverHealthStatus =
        unstablePartitions.length() > 0 || brokenDisks.length() > 0 ? ServerHealthStatus.BAD : serverHealthStatus;

    //Initializing the content of the response as a json
    JSONObject contentJSON = new JSONObject();
    contentJSON.put("health", serverHealthStatus);
    contentJSON.put("brokenDisks", brokenDisks);
    contentJSON.put("unstablePartitions", unstablePartitions);

    byte[] content = contentJSON.toString().getBytes(StandardCharsets.UTF_8);
    ServerErrorCode error = ServerErrorCode.NoError;
    return new AdminResponseWithContent(adminRequest.getCorrelationId(), adminRequest.getClientId(), error, content);
  }
Handles {@link com.github.ambry.protocol.AdminRequestOrResponseType#HealthCheck}.
@param requestStream the serialized bytes of the request.
@param adminRequest the {@link AdminRequest} received.
@return the {@link AdminResponse} to the request.
@throws IOException if there is any I/O error reading from the {@code requestStream}.
ambry-server/src/main/java/com/github/ambry/server/AmbryServerRequests.java