Package: nagios-unity
nagios-unity============Nagios plugin for monitoring Unity system``nagios-unity`` is built on top of ``storops``, which interacts with Unity storage via RESTful API. ``nagios-unity`` providesan easy-to-use command line interface for invocation of nagios servers. ``nagios-unity`` follows the output rules definedby `Print only one line of text <https://nagios-plugins.org/doc/guidelines.html#AEN33>`_Installation------------>From Pypi^^^^^^^^^The ``nagios-unity`` can be install via pypi... code-block:: bash$ pip install nagios-unity>From source^^^^^^^^^^^Alternatively, clone this repo via git and:.. code-block:: bash$ cd nagios-unity$ sudo python setup.py installOnce installed, a ``nagios-unity`` (on *nux) or ``nagios-unity.exe`` (on Windows) command will be available for use.Command line usage------------------User can invoke the command line ``nagios-unity`` in bash or CMD/PowerShell. To get the help, type ``nagios-unity --help``.Here is the example:.. code-block:: bash$ nagios-unity --helpUnity plugin for Nagios.Usage:nagios-unity -H <HOST> -u <USERNAME> -p <PASSWORD> [--cacert <CACERT>]  <OBJECT>nagios-unity -h | --helpnagios-unity --versionArguments:OBJECT  One of below values:battery, dae, disk, dpe,ethernet_port fan, fc_port,io_module, lcc, lun, memory_module,pool, power_supply, sas_port,sp, ssc, ssd, system, array_hardwareOptions:-h --help                         Show this screen.-V --version                      Show version.-C --cacert <CACERT>              Unity CA certificates.-H --host <HOST>                  Unity IP address.-u --username <USERNAME>          Unity User login.-p --password <PASSWORD>          Unity password.-v --verbose                      show verbose logs.Examples:nagios-unity -H 10.245.101.39 -u admin -p Password123! sscAvailable monitoring commands^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- **battery**- **dae**- **disk**- **dpe**- **ethernet_port**- **fan**- **fc_port**- **io_module**- **lcc**- **lun**- **memory_module**- **pool**- **power_supply**- **sas_port**- **sp**- **ssc**- **ssd**- **system**- **array_hardware****array_hardware** is a virtual command which combines a serial of hardware components of Unity.Array health enum mapping-------------------------The nagios requires plugins to provide defined return codes for each periodic check, see `Plugin Return Codes <https://nagios-plugins.org/doc/guidelines.html#AEN78>`_ for more details.This plugin will perform following mapping between the Unity health enum and nagios return codes:+-------------------+--------------------+-----------------------+| Unity Health Enum | Nagios Return Code | Nagios Service Status |+-------------------+--------------------+-----------------------+| OK                | 0                  | OK                    |+-------------------+--------------------+-----------------------+| OK_BUT            | 0                  | OK                    |+-------------------+--------------------+-----------------------+| DEGRADED          | 1                  | WARNING               |+-------------------+--------------------+-----------------------+| MINOR             | 1                  | WARNING               |+-------------------+--------------------+-----------------------+| MAJOR             | 1                  | WARNING               |+-------------------+--------------------+-----------------------+| CRITICAL          | 2                  | CRITICAL              |+-------------------+--------------------+-----------------------+| NON_RECOVERABLE   | 2                  | CRITICAL              |+-------------------+--------------------+-----------------------+| UNKNOWN           | 3                  | UNKNOWN               |+-------------------+--------------------+-----------------------+Configuration-------------.. caution::Before proceeding, make sure the nagios and its components are corrected configured.It is also suggested to try out the ``nagios-unity`` command line.- Create a template ``storage-array`` in ``templates.cfg``... code-block:: ini# Define a template for storage that we can reusedefine host{name                    storage-array      ; The name of this host templateuse                     generic-host       ; Inherit default values from the generic-host templatehostgroups              storage-arrays     ; Host groups that storage arrays should be a member ofcheck_period            24x7               ; By default, storage arrays are monitored round the clockcheck_interval          5                  ; Arrays are checked every 5 minutesretry_interval          1                  ; Schedule array check retries at 1 minute intervalsmax_check_attempts      10                 ; Check each array 10 times (max)check_command           check-host-alive   ; Default command to check if arrays are "alive"notification_period     24x7               ; Send notifications at any timenotification_interval   30                 ; Resend notifications every 30 minutesnotification_options    d,r                ; Only send notifications for specific array statescontact_groups          admins             ; Notifications get sent to the admins by defaultregister                0                  ; DONT REGISTER THIS - ITS JUST A TEMPLATE}- Create a dedicated ``storage.cfg`` for storing all storage arrays... code-block:: ini$ touch storage.cfg- Add groups for grouping all storage devices in ``storage.cfg``.. code-block:: inidefine hostgroup{hostgroup_name  storage-arraysalias           External Storage}- Add array for nagios management... code-block:: inidefine host{use         storage-arrayhost_name   OB_H1132        ; The name we're giving to this arrayalias       My Nagios Unity ; A longer name associated with the arrayaddress     10.245.101.35   ; IP address of the Unity array_user_name  admin           ; Customer variable for Unity user name_password   password        ; Customer variable for Unity password}- Add command for nagios use in ``commands.cfg``... code-block:: ini# for unitydefine command{command_name    nagios-unitycommand_line    /usr/local/bin/nagios-unity -H $HOSTADDRESS$ -u $_HOSTUSER_NAME$ -p $_HOSTPASSWORD$ $ARG1$}Note: ``_HOST`` prefix is prepended by nagios, see `custom object vars <https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/customobjectvars.html>`_.- Add services for managed arrays... code-block:: inidefine service{use                 generic-servicehost_name           OB_H1132service_description Ethernet Portscheck_command       nagios-unity!ethernet_port}define service{use                 generic-servicehost_name           OB_H1132service_description FC Portscheck_command       nagios-unity!fc_port}define service{use                 generic-servicehost_name           OB_H1132service_description SAS Portscheck_command       nagios-unity!sas_port}For a full list of available commands, check it out `Available monitoring commands`_- Restart nagios to reflect the changes... code-block:: ini$ sudo service nagios restartSSL consideration^^^^^^^^^^^^^^^^^Unity supports SSL via RESTful API, administartor can setup their own CA for SSL verification.``nagios-unity`` also leverages the capability of RESTful API, and provides a ``-C`` option for SSL verification.To do this:- First add the ``-C <path/file to CA>`` to the ``commands.cfg``.. code-block:: ini# for unitydefine command{command_name    nagios-unitycommand_line    /usr/local/bin/nagios-unity -H $HOSTADDRESS$ -u $_HOSTUSER_NAME$ -p $_HOSTPASSWORD$ -C $_HOSTCACERT $ARG1$}- Then supply ``_cacert`` option in the ``storage.cfg``... code-block:: inidefine host{use         storage-arrayhost_name   OB_H1132        ; The name we're giving to this arrayalias       My Nagios Unity ; A longer name associated with the arrayaddress     10.245.101.35   ; IP address of the Unity array_user_name  admin           ; Customer variable for Unity user name_password   password        ; Customer variable for Unity password_cacert     /path/to/CA     ; Customer variable for Unity CA certificate}- Restart nagios service to reflect the changes.Contributions-------------Simply fork this repo and send PR for your code change(also tests to cover your change),remember to give a title and description of your PR. We are willing to enhance this project with you :).License-------`Apache license version 2 <LICENSE>`_