Showing posts with label AMS. Show all posts
Showing posts with label AMS. Show all posts

Wednesday, May 30, 2018

Creating HTML report of ScaleIO cluster using PowerShell

This post is a reference to a small reporting script for ScaleIO environments. The project will generate a brief HTML report of your ScaleIO Ready Node SDS infrastructure (with AMS - Automated Management Services) by making use of ScaleIO Ready Node AMS REST APIs and PowerShell. The report provides information about MDM cluster state, overall cluster capacity, system objects, alerts, and health state of all disks in the cluster. Here the API is available as part of ScaleIO Ready Node AMS. These AMS REST API allows you to query information and perform actions related to ScaleIO software and ScaleIO Ready Node hardware components. To access the API you need to provide AMS username and password. Responses returned by AMS server are formatted in JSON format.

Project referencehttps://github.com/vineethac/sio_report

Use case
: This script can be used/ leveraged as part of daily cluster health/ stats reporting process, or something similar; so that monitoring Engineers or whoever responsible can have a look at it on a daily basis to make sure everything is healthy and working normal. 

Related references:

Hope this was helpful. Cheers!

Tuesday, March 20, 2018

Working with ScaleIO REST API using PowerShell - Part 3

As you all know disk drives are the most important and basic building blocks of a storage system. In order to ensure data availability, the disk drives in your storage system should always stay healthy. Unhealthy drives not only cause risk to your data but also contribute to degraded performance. In this article, I will show how to query and get disk health-related information in a ScaleIO cluster using REST API and PowerShell. 

Please refer my previous posts for API authentication, token generation and 'Invoke-RestMethod'.


#Query all devices in the ScaleIO cluster
$all_devices = (Invoke-RestMethod -Uri "https://192.168.11.15:443/api/types/Device/instances " -Method Get -Headers $ScaleIOAuthHeaders)  

#Select necessary properties and sort
$all_devices = (Invoke-RestMethod -Uri "https://192.168.11.15:443/api/types/Device/instances " -Method Get -Headers $ScaleIOAuthHeaders) | select sdsId, storagePoolId, name, deviceCurrentPathName, errorState, deviceState, ssdEndOfLifeState, temperatureState, aggregatedState  | sort sdsId | ft -AutoSize


#Sample output

Hope this was helpful. Please refer to ScaleIO 2.5 API reference guide for more details. Cheers!

Wednesday, March 7, 2018

Working with ScaleIO REST API using PowerShell - Part 2

In my previous post, I explained how to connect and authenticate with ScaleIO REST API, and use Invoke-RestMethod. In this article, I will explain how to query selected statistics/ properties with POST method. 

First, you have to define the set of properties that you would like to query, and then pass it to "invoke-restmethod". You can get the list of available properties of the respective object from the ScaleIO REST API Reference Guide. 

Example 1: Query and collect MDM cluster information
Here I am collecting the below-mentioned properties of "MDMCluster" object. 

#selected properties to query

$param1 = @'
{
    "properties":["name", "clusterMode", "master", "clusterState", "virtualIps"]
}
'@

#invoke-restmethod with respective uri

$MDM_cluster_stats = (Invoke-RestMethod -Uri "https://192.168.11.15:443/api/instances/System/queryMdmCluster " -Body $param1 -ContentType "application/json" -Headers $ScaleIOAuthHeaders -Method Post)

#organize output in a hash table

$mdm_props = @{

    'Cluster name'      = ($MDM_cluster_stats).name
    'Mode'              = ($MDM_cluster_stats).clusterMode
    'Cluster state'     = ($MDM_cluster_stats).clusterState
    'Master MDM IP'     = ($MDM_cluster_stats.master).managementIPs[0]
    'Cluster VIP01'     = ($MDM_cluster_stats).virtualIps[0]
    'Cluster VIP02'     = ($MDM_cluster_stats).virtualIps[1]
}

Write-Output $mdm_props

#sample output screenshot given below


Example 2: Query and collect overall ScaleIO system capacity details
Here I am collecting some properties of "System Statistics" object. 

#selected properties to query

$param2 = @'
{
    "properties":["maxCapacityInKb", "capacityInUseInKb", "spareCapacityInKb", "failedCapacityInKb", "degradedFailedCapacityInKb"]
}
'@

#invoke-restmethod with respective uri

$system_overall_stats = (Invoke-RestMethod -uri "https://192.168.11.15:443/api/types/System/instances/action/querySelectedStatistics " -Body $param2 -ContentType "application/json" -Headers $ScaleIOAuthHeaders -Method Post)

#organize output in a hash table


$system_capacity_props = @{

    "System max capacity (TB)"                = (($system_overall_stats.maxCapacityInKb)/1024/1024/1024)
    "System capacity in use (TB)"             = (($system_overall_stats.capacityInUseInKb)/1024/1024/1024)
    "System spare capacity (TB)"              = (($system_overall_stats.spareCapacityInKb)/1024/1024/1024)
    "System failed capacity (TB)"             = (($system_overall_stats.failedCapacityInKb)/1024/1024/1024)
    "System degraded failed capacity (TB)"    = (($system_overall_stats.degradedFailedCapacityInKb)/1024/1024/1024)
}

Write-Output $system_capacity_props

#sample output screenshot given below


Hope this was useful. Please refer Dell EMC ScaleIO Ready Node Version 2.5 API Reference Guide for more details.