GithubHelp home page GithubHelp logo

thecodeteam / nagios-unity Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 3.0 49 KB

Nagios plugin for monitoring Unity system

License: Apache License 2.0

Python 99.95% PowerShell 0.05%
unity nagios nagios-plugin python

nagios-unity's Introduction

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 provides an easy-to-use command line interface for invocation of nagios servers. nagios-unity follows the output rules defined by Print only one line of text

Installation

From Pypi

The nagios-unity can be install via pypi.

$ pip install nagios-unity

From source

Alternatively, clone this repo via git and:

$ cd nagios-unity
$ sudo python setup.py install

Once 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:

$ nagios-unity --help
Unity plugin for Nagios.

Usage:
    nagios-unity -H <HOST> -u <USERNAME> -p <PASSWORD> [--cacert <CACERT>]  <OBJECT>
    nagios-unity -h | --help
    nagios-unity --version

Arguments:
    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_hardware

Options:
    -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! ssc

Available 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 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.
# Define a template for storage that we can reuse
define host{
        name                    storage-array      ; The name of this host template
        use                     generic-host       ; Inherit default values from the generic-host template
        hostgroups              storage-arrays     ; Host groups that storage arrays should be a member of
        check_period            24x7               ; By default, storage arrays are monitored round the clock
        check_interval          5                  ; Arrays are checked every 5 minutes
        retry_interval          1                  ; Schedule array check retries at 1 minute intervals
        max_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 time
        notification_interval   30                 ; Resend notifications every 30 minutes
        notification_options    d,r                ; Only send notifications for specific array states
        contact_groups          admins             ; Notifications get sent to the admins by default
        register                0                  ; DONT REGISTER THIS - ITS JUST A TEMPLATE
        }
  • Create a dedicated storage.cfg for storing all storage arrays.
$ touch storage.cfg
  • Add groups for grouping all storage devices in storage.cfg
define hostgroup{
    hostgroup_name  storage-arrays
    alias           External Storage
}
  • Add array for nagios management.
define host{
    use         storage-array
    host_name   OB_H1132        ; The name we're giving to this array
    alias       My Nagios Unity ; A longer name associated with the array
    address     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.
# for unity

define command{
    command_name    nagios-unity
    command_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.

  • Add services for managed arrays.
define service{
    use                 generic-service
    host_name           OB_H1132
    service_description Ethernet Ports
    check_command       nagios-unity!ethernet_port
    }

define service{
    use                 generic-service
    host_name           OB_H1132
    service_description FC Ports
    check_command       nagios-unity!fc_port
    }

define service{
    use                 generic-service
    host_name           OB_H1132
    service_description SAS Ports
    check_command       nagios-unity!sas_port
    }

For a full list of available commands, check it out Available monitoring commands

  • Restart nagios to reflect the changes.
$ sudo service nagios restart

SSL 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
# for unity

define command{
    command_name    nagios-unity
    command_line    /usr/local/bin/nagios-unity -H $HOSTADDRESS$ -u $_HOSTUSER_NAME$ -p $_HOSTPASSWORD$ -C $_HOSTCACERT $ARG1$
    }
  • Then supply _cacert option in the storage.cfg.
define host{
    use         storage-array
    host_name   OB_H1132        ; The name we're giving to this array
    alias       My Nagios Unity ; A longer name associated with the array
    address     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

nagios-unity's People

Contributors

peter-wangxu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nagios-unity's Issues

HTTP Client Error (HTTP 401)

Hello,

I'm trying to monitor a Dell Unity 300 with the nagios-unity but I have an issue.
I have installed nagios-unity but I'm trying to running a command :
nagios-unity -H 10.0.11.30 -u admin -p xxxxxx battery
(battery or other object)

And the full output:
log.txt

When I'm trying to connect in web interface of the Unity, the web browser asking for a certificate. I can make cancel and use the credentials but maybe the problem come from here ?

And for information, I have just installed nagios-unity with pip install and I didn't make any configuration.

Thanks for any help.

Best regards,
Quentin.

Does this work in Python 2.6?

Any thoughts on the following other than potential Python 2.6 issue?

/usr/bin/nagios-unity -help Traceback (most recent call last): File "/usr/bin/nagios-unity", line 7, in <module> from nagiosunity.cli.client import main File "/usr/lib/python2.6/site-packages/nagiosunity/cli/client.py", line 54, in <module> from nagiosunity import commands File "/usr/lib/python2.6/site-packages/nagiosunity/commands/__init__.py", line 47 commands_dict = {cmd.name: cmd for cmd in COMMANDS} ^ SyntaxError: invalid syntax

Monitoring of Replication Sessions

Hi,

Is it possible to add replication sessions as option in the nagios-unity check?

These sessings can be found under Protection & Mobility/Replication in Unisphere. When you doubleclick of of these sessings you see Sync state (in- or outsync) and sync status (Active).

It would be nice to receive an alert when one of the sessions has problems.

At the moment you need Metrosync to monitor this, but this is not a very friendly application.

use nagios-unity with base64 encoded username and password

Hello,
I know it's been some time since nagios-unity released but it would be a blessing if this would be possible.
Is it possible to use base64 encoded username and password when executing a command? plain text is not desirable.

Facing issue while installing plugin

Getting below errors while installing this plugin. Need help.

[root@ICINGA nagios-unity-master]# python setup.py install
running install
running bdist_egg
running egg_info
writing requirements to nagios_unity.egg-info/requires.txt
writing nagios_unity.egg-info/PKG-INFO
writing top-level names to nagios_unity.egg-info/top_level.txt
writing dependency_links to nagios_unity.egg-info/dependency_links.txt
writing entry points to nagios_unity.egg-info/entry_points.txt
reading manifest file 'nagios_unity.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'nagios_unity.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
copying nagiosunity/cli/init.py -> build/lib/nagiosunity/cli
error: nagiosunity/cli/init.py: Operation not permitted

System details

[root@ICINGA ~]# python -V
Python 2.7.5
[root@ICINGA ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.6 (Maipo)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.