Forum Discussion

Julius_G's avatar
3 years ago

LM monitoring IBM Storage V7000 and Flash Systems

Hello,

We would like to add our IBM storage on LM and with no success. There is a custom datasource that was given to us but it does not work. Did anyone successfully add their IBM storage in LM? Here is a copy of the Datasource we are using. It is supposed to be a cluster statistics.

 

//script for IBM Cluster Statistics Active Discovery 

//imports
import javax.cim.*
import javax.security.auth.Subject
import javax.wbem.*
import javax.wbem.client.*


// variables to hold system info
def hostname = "https://" + hostProps.get("system.hostname")
def username = hostProps.get("cim.user")
def password = hostProps.get("cim.pass")
//variables to hold cim information 
def namespace = "root/ibm"
def cim_class = "IBMTSSVC_Cluster"


try
{
    //connect to WBEM server and retrieve a WBEM client
    client = connectToLink(hostname, username, password)
    
    //loop through instances  
    getDesiredMetrics(client, cim_class,namespace).each
    { output->
        //instacne name
        entry_name = output.'ID'

        //instance level properties
        console_IP = output.'ConsoleIP'
        console_port = output.'ConsolePort'
        
        //prints in active discovery format 
        println "${entry_name}##${entry_name}######auto.ibm.cluster.consoleip=${console_IP}&&auto.ibm.cluster.consoleport=${console_port}"    
                
    }

    
    return 0//success!!
}

// Catch any exception, print it out and return 1.
catch (Exception e)
{
    println e
    return 1 //fail!!
}


/**
 * Helper method that obtains the desired metrics
 * @param WBEMClient client
 * @param String cim_class
 * @param String namespace
 * @return Array of instances' and their metrics.
 */
def getDesiredMetrics(WBEMClient client, String cim_class, String namespace)
{
    //list of desired instances' properties
    def instance_List = []
    //map of instances' and their given properties
    def metrics_Map = [:]
    

    try
    {
        //grabs all instances
        final CloseableIterator<CIMInstance> iterator = client.enumerateInstances(new CIMObjectPath(cim_class, namespace), true, false, false, null)

        //goes through the instances
        while (iterator.hasNext())
        {
            //current instance
            final CIMInstance instance = iterator.next()

            //grabs properties for an instance
            props = instance.getProperties()

            //iterates through list of propertes
            props.each
            { it ->
                
                //add to map of metrics for a given instance
                metrics_Map.put(it.getName(),it.getValue())

            }

            //add a given instance's map to list of instances
            instance_List.add(metrics_Map)
           
            //clear map for next instance
            metrics_Map = [:]
        }

    }
    // Catch WMEME exception, print it out
    catch (WBEMException e)
    {
        e.printStackTrace()
        print e.toString()
    }

    //return list of instances and their metric maps
    return instance_List
    
}


/**
 * Helper method that handles the API connection.
 * @param hostname
 * @param username
 * @param password
 * @return API client 
 */
def connectToLink (String hostname, String username, String password)
{
    //grabs desired URL for given device
    URL cimomUrl = new URL("https://${hostname}:5989")

    //establishes client and path to connect
    final WBEMClient client = WBEMClientFactory.getClient(WBEMClientConstants.PROTOCOL_CIMXML)
    final CIMObjectPath path = new CIMObjectPath(cimomUrl.getProtocol(), cimomUrl.getHost(), String.valueOf(cimomUrl.getPort()), null, null, null)

    //holder for credentials
    final Subject subject = new Subject()

    //establishes username and password credentials 
    subject.getPrincipals().add(new UserPrincipal(username))
    subject.getPrivateCredentials().add(new PasswordCredential(password))

    try
    {
        //initializes client pool
        client.initialize(path, subject, null)
    }

    // Catch any exception, print it out
    catch (Exception e)
    {
        e.printStackTrace()
        print e.toString()
    }
    return client
}

 

 

  • Anonymous's avatar
    Anonymous

    Does the DS "test applies to" button correctly apply to the device? Check that first.