Monitoring IBM Storwize storage with Zabbix

In this article, we will talk a little about monitoring IBM Storwize storage systems and other storage systems that support CIM / WBEM protocols. The need for such monitoring is left out of the brackets; we will consider this an axiom. We will use Zabbix as a monitoring system.

In the latest versions of Zabbix, the company began to pay much more attention to templates - templates began to appear for monitoring services, DBMS, Servers hardware (IMM / iBMC) via IPMI. Storage monitoring is still out of the box, so to integrate information about the status and performance of storage components into Zabbix, you need to use custom templates. I bring to your attention one of these templates.

First, a bit of theory.

To access the status and statistics of IBM Storwize storage, you can use:

  1. CIM/WBEM protocols;
  2. RESTful API (supported by IBM Storwize starting with software version 8.1.3);
  3. SNMP Traps (limited set of traps, no statistics);
  4. SSH connection followed by remote suitable for leisurely bash scripting.

Those interested can learn more about the various monitoring methods in the relevant sections of the vendor documentation, as well as in the document IBM Spectrum Virtualize scripting.

We will use the CIM / WBEM protocols, which allow us to obtain the parameters of the storage system without significant changes in the software for various storage systems. CIM/WBEM protocols work according to Storage Management Initiative Specification (SMI-S). The Storage Management Initiative – Specification is based on open standards CIM (Common Information Model) ΠΈ WBEM (Web Based Enterprise Management)defined Distributed Management Task Force.

WBEM works on top of the HTTP protocol. Through WBEM, you can work not only with storage systems, but also with HBAs, switches, and tape libraries.

According to SMI Architecture ΠΈ Determine Infrastructure, the main component of the SMI implementation is the WBEM server that processes CIM-XML requests from WBEM clients (in our case, from monitoring scripts):

Monitoring IBM Storwize storage with Zabbix

CIM is an object-oriented model based on the Unified Modeling Language (UML).
Managed items are defined as CIM classes that have properties and methods to represent managed data and functionality.

According to www.snia.org/pywbem, to access storage via CIM / WBEM, you can use PyWBEM, an open source library written in Python that provides developers and system administrators with the implementation of the CIM protocol to access CIM objects and perform various operations with a WBEM server operating according to SMI-S or other CIM specifications.

To connect to the WBEM server, use the class constructor WBEMConnection:

conn = pywbem.WBEMConnection(server_uri, (self.login, self.password),
            namespace, no_verification=True)

This is a virtual connection, because CIM-XML/WBEM runs over HTTP, the actual connection occurs when methods are called on an instance of the WBEMConnection class. In accordance with the IBM System Storage SAN Volume Controller and Storwize V7000 Best Practices and Performance Guidelines (Example C-8, p. 412), we will use β€œroot/ibm” as the CIM namespace for IBM Storwize storage.

Please note that in order to collect statistics on the CIM-XML/WBEM protocol, you must include the user in the appropriate security group. Otherwise, when executing WBEM queries, the output of class instance attributes will be empty.

To access storage statistics, the user under which the constructor is called WBEMConnection(), must have at least RestrictedAdmin (available for code_level > 7.8.0) or Administrator (not recommended for security reasons).

We connect to the storage system via SSH and look at the group numbers:

> lsusergrp
id name            role            remote
0  SecurityAdmin   SecurityAdmin   no    
1  Administrator   Administrator   no    
2  CopyOperator    CopyOperator    no    
3  Service         Service         no    
4  Monitor         Monitor         no    
5  RestrictedAdmin RestrictedAdmin no    

Add the zabbix user to the desired group:

> chuser -usergrp 5 zabbix

In addition, in accordance with the IBM System Storage SAN Volume Controller and Storwize V7000 Best Practices and Performance Guidelines (p. 415), you must enable statistics collection on the storage system. So, to collect statistics every minute:

> startstats -interval 1 

We check:

> lssystem | grep statistics
statistics_status on
statistics_frequency 1

To get all existing storage classes, you must use the EnumerateClassNames() method.

Example:

classnames = conn.EnumerateClassNames(namespace='root/ibm', DeepInheritance=True)
for classname in classnames:
     print (classname)

To obtain the values ​​of the storage system parameters, the method EnumerateInstances() WBEMConnection class returning a list of instances CIMInstance().

Example:

instances = conn.EnumerateInstances(classname,
                   namespace=nd_parameters['name_space'])
for instance in instances:
     for prop_name, prop_value in instance.items():
          print('  %s: %r' % (prop_name, prop_value))

For some classes that contain a large number of instances, such as IBMTSSVC_StorageVolume, a full query of all instances can be quite slow. It can generate large amounts of data that must be prepared by the storage system, transmitted over the network and processed by a script. For such a case, there is a method ExecQuery(), which allows you to get only the properties of the class instance that are of interest to us. This method involves using a SQL-like query language, either CIM Query Language (DMTF:CQL) or WBEM Query Language (WQL), to query CIM storage objects:

request = 'SELECT Name FROM IBMTSSVC_StorageVolumeStatistics'
objects_perfs_cim = wbem_connection.ExecQuery('DMTF:CQL', request)

To determine which classes we need to get the parameters of storage objects, we read the documentation, for example How system concepts map to CIM concepts.

So, to get parameters (not performance counters) of physical disks (Disk Drives), we will query Class IBMTSSVC_DiskDrive, to get Volumes parameters - Class IBMTSSVC_StorageVolume, to get array parameters - Class IBMTSSVC_Array, to get MDisks parameters - Class IBMTSSVC_BackendVolume, etc.

You can read about performance Functional diagrams of the Common Information Model agent (specifically - Block server performance subprofile) and IBM System Storage SAN Volume Controller and Storwize V7000 Best Practices and Performance Guidelines (Example C-11, page 415).

To get storage statistics for Volumes, you need to specify IBMTSSVC_StorageVolumeStatistics as the value of the ClassName parameter. The properties of the IBMTSSVC_StorageVolumeStatistics class necessary for collecting statistics can be found in Node Statistics.

Also, for performance analysis, you can use the classes IBMTSSVC_BackendVolumeStatistics, IBMTSSVC_DiskDriveStatistics, IBMTSSVC_NodeStatistics.

To write data to the monitoring system, we will use the mechanism zabbix traps, implemented in python in a module py-zabbix. The structure of storage classes and their properties will be placed in a dictionary in JSON format.

We upload the template to the Zabbix server, make sure that the monitoring server has access to storage via the WEB protocol (TCP / 5989), place the configuration files, detection and monitoring scripts on the monitoring server. Next, add scripts to the scheduler. As a result: we discover storage objects (arrays, physical and virtual disks, enclosures, and much more), pass them to Zabbix discoveries, read the status of their parameters, read performance statistics (perfomance counters), transfer all this to the corresponding Zabbix Items of our template.

The Zabbix template, python scripts, the structure of storage classes and their properties, as well as examples of configuration files, can be find here.

Source: habr.com

Add a comment