Merge branch 'master' of github.com:spearheadsys/checkmk-plugins

This commit is contained in:
Marius Pana 2020-11-16 16:43:25 +02:00
commit 35b3d37a56
51 changed files with 2531 additions and 469 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "juniper"]
path = juniper
url = https://github.com/spearheadsys/check_mk.git

View File

@ -1,84 +0,0 @@
# INTRO
These are ansible playbooks used for deploying an OMD instance as well as a simple haproxy and two web servers. These are the playbooks that were used by Marius Pana at the 2nd Check_MK conference in Munich, Germany. The presentation will be made available online shortly for those that are interested.
Alert handlers (as defined by Check_MK) can be used from within Check_MK to signal the execution of specific handlers (as defined by Ansible) from the ansible playbooks so as to provide a simple feedback loop which provides self healing.
*We are still looking for a good mapping of services between check_mk and ansible. One solution that was recommended was the use of service attributes(nagios macros) which could then be mapped one-to-one with ansible tags. As soon as we have something functional we will update this. If anyone else has ideas we are interested in hearing them.*
These examples are fairly simple but can and should be expanded to include more logic for repairing your specific systems/services. We intended these as a starting point.
## About these playbooks
We are assuming you are using a RedHat based distro. These playbooks will deploy for you an OMD instance on a freshly installed system, they will configure an HAProxy for load balancing between two apache web servers.
We do not do the initial provisioning via these playbooks but this could be included in the future (i.e. deploy to joyent, cobbler or others). In other words we expect that you have the systems freshly installed and configured with a root user that is allowed SSH access as defined in the cmkconfinv (inventory) file.
### ansible inventory file
The cmkconvinf file contains our inventory. In it we define three groups of hosts, a variable named folder which is the OMD folder we create via the WATO API for the respective host(s) and the IP address where these hosts can be reached.
You must have these installed and configured before running these playbooks. You will also need to know the root user password.
## Prerequisites
Make sure you change the users and ssh keys via the common role. Upload you ssh keys in roles/common/files and edit roles/common/vars/usersandpsks.yml.
### Ansible
You will need a functional ansible set-up. Setting it up can be as easy as cloning the ansible repo or installing via your operating system package manager. More information about installing ansible can be found here: http://docs.ansible.com/ansible/intro_installation.html .
You will also need to clone this repository to play around with these playbooks.
### Check_MK
We are assuming you are using the CEE (Check_MK Enterprise Edition). While this should work with any recent version of Check_MK we are specifically targeting the use of the current innovation branch (1.2.7i) because of the new Alert Handlers (Werk #8275).
If you would like to deploy your OMD instance via these playbooks you will need to download Check_MK CEE in RPM format and place it in the following directory:
> roles/omd/files
## Deploying OMD via Ansible
This is a very simple way to deploy an OMD instance and create a site named "prod". The following command will deploy OMD to your preinstalled server. It will prompt for the root users password (-k).
> ansible-playbook -i cmkconfinv site.yml -l omd -u root -k --skip-tags check_mk_agent,check_mk_discovery,check_mk_apply
Notice the use of the --skip-tags switch which is necessary as in this first run we do not have an OMD instance running from which to pull the agent, discovery, etc.
You now need to create an Automation user in our Check_MK site and use that information in the roles/omd/vars/main.yml file.
Now we can deploy the check_mk_agent to our monitoring instance as well. Notice we are running just the check_mk_agent, discovery and pply steps now. Also after bootstrapping your system you can use your own user if you created one and uploaded the ssh keys. In this case you could use ansible with sudo (-u *your_username* -s instead of -u root).
> ansible-playbook -i cmkconfinv site.yml -l omd -u root --tags check_mk_agent,check_mk_discovery,check_mk_apply
## Deploying the webserver and loadbalancer
The following will configure your webservers and loadbalancer. It will prompt for the root users password (-k). Once it is done you should have in your OMD instance 4 hosts (1 omd, 2 web servers and one lb) and their services monitored.
> ansible-playbook -i cmkconfinv site.yml -l loadbalancers,webservers -u root -k
## Check_MK Alert Handlers
We have created two alert handlers to showcase two different scenarios:
1. services.sh - Restarting of apache web services if they are failed
2. instantiate.sh - Deploying a loadbalancer if it fails (state DOWN)
These are specific to the setup we were using for the presentation at the conference however they serve as a good starting point.
Add the following two Alert Handlers to your Check_MK site and place the scripts in ~/local/share/check_mk/alert_handlers (make sure they are executable):
services.sh
![image of services.sh ](http://i67.tinypic.com/jgqqzm.png)
```
#!/bin/bash
ansible-playbook -i /omd/sites/prod/ansible/cmkconfinv /omd/sites/prod/ansible/site.yml -l webservers -u root --tags httpd
```
instantiate.sh
![image of instantiate.sh ](http://i65.tinypic.com/14c9s8w.png)
```
#!/bin/bash
ssh root@10.88.88.145 vmadm create -f /etc/zones/loadbalancer.json
ansible-playbook -i /omd/sites/prod/ansible/cmkconfinv /omd/sites/prod/ansible/site.yml -l loadbalancers -u root
```
The first line is specific to my setup which is using SmartOS available at 10.88.88.145. There I have already created a manifest file (loadbalancer.json) to create a loadbalancer instance. You will want to change this for your particular set-up.
## TODO
You may notice an extra two check_mk checks named up_upscale and down_scale on your loadbalancer instance. These are not finished yet however they are an example of how you could use check_mk and ansible to do autoscaling. Based on feedback received via your monitoring you can bring up or down more instances effectively doing autoscaling. This is a work in progress and will be updated in the near future. The ansible tags are add_backend and del_backend, these may be useful if you plan on extending these.
There are certainly more things to be done here ...

View File

@ -1,7 +0,0 @@
---
# file: bootstrap.yml
- hosts: all
#vars:
vars_files: [roles/common/vars/usersandpsks.yml, roles/omd/vars/main.yml]
roles:
- common

View File

@ -1,9 +0,0 @@
[loadbalancers]
lb01 ansible_ssh_host=10.88.88.127 folder=loadbalancers
[webservers]
web1 ansible_ssh_host=10.88.88.128 folder=webservers
web2 ansible_ssh_host=10.88.88.129 folder=webservers
[omd]
omd ansible_ssh_host=10.88.88.150 folder=omd

View File

@ -1,7 +0,0 @@
---
# file: loadbalancers.yml
- hosts: loadbalancers
vars_files: [roles/common/vars/usersandpsks.yml, roles/omd/vars/main.yml]
roles:
- common
- loadbalancers

View File

@ -1,7 +0,0 @@
---
# file: omd.yml
- hosts: omd
#vars:
#vars_files:
roles:
- omd

View File

@ -1 +0,0 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/asZXkhLJVGIcPQGUxZDLl/yMwslgn6GyJd6QGKUmR+Snr1hMz01y7WEWPvfXXUqNym6rMU5fAMUr+alcyzMGZYKyymTLfjgp0SUuWG3TGpl3EPxnfGwNcXOvuJE9cnY0q3nhZgQjvn6EdEFDKAmLG1WXlKYjbQUUrHp0wFvEx3TNIXMVJqHxbKi8Uwyvn5EB1emdeJkaAaXJbk1TxALu400Ts0KYJUUyMn5njJjVELwtPVsnb0skmKSXd4dgBLN+wo94YQLpdfCnmho0uPhZfTHHi0+jtJNtUSycOSuOr/TxYGirxOYcb5FoOvzg9L0RyQAj6O+Hzs3RkHB+qast mariusp@marduk.local

View File

@ -1,15 +0,0 @@
---
# file: roles/common/handlers/main.yml
- name: restart ntp
service: name=ntp state=restarted
tags:
- ntpd
- name: restart xinetd
service: name=xinetd state=restarted
tags: xinetd
- name: restart sshd
service: name=sshd state=restarted
tags:
- sshd

View File

@ -1,73 +0,0 @@
---
# file: roles/common/tasks/main.yml
- name: make sure ntp,epel,etc. are installed
yum: pkg={{ item }} state=installed
with_items:
- ntp
- xinetd
- epel-release
#- screen
#- vim-enhanced
#- mc
tags: packages
- name: add sphs group
action: group name=sphs state=present
- name: add our users
action: user name={{ item }} groups=sphs state=present append=yes
with_items: usersAdd
when: item != 'none'
- name: Add SSH public key to user mariusp
action: authorized_key user=mariusp key="{{ lookup('file', "../files/ssh_keys/mariusp.pub") }}"
- name: Remove users
action: user name={{ item }} state=absent remove=yes
with_items: usersDel
when: item != 'none'
# Enable sudo for sphs group with no password
- name: Enable sudo without password for sudo group
action: 'lineinfile "dest=/etc/sudoers" state=present regexp="^%sphs ALL" line="%sphs ALL=(ALL) NOPASSWD: ALL"'
- name: install check_mk agent
yum: pkg=http://{{ omdhost }}/{{ omdsite }}/check_mk/agents/{{ rpmagent }} state=installed
tags:
- check_mk_agent
# change to get_uri - do some error checking
- name: add host to omd
uri:
method: POST
body_format: json
url: http://{{omdhost}}/{{omdsite}}/check_mk/webapi.py?action=add_host&_username={{automationuser}}&_secret={{autosecret}}
body: 'request={"attributes":{"alias":"{{inventory_hostname}}","ipaddress":"{{ansible_default_ipv4["address"]}}"},"hostname":"{{inventory_hostname}}","folder":"{{folder}}"}'
delegate_to: 127.0.0.1
tags:
- check_mk_agent
notify:
- cmk_discovery
- cmk_apply
- name: cmk_discovery
uri:
method: POST
url: http://{{ omdhost }}/{{ omdsite }}/check_mk/webapi.py?action=discover_services&_username={{ automationuser }}&_secret={{ autosecret }}&mode=refresh
body: 'request={"hostname":"{{ inventory_hostname }}"}'
body_format: json
status_code: 200
tags:
- check_mk_discovery
delegate_to: 127.0.0.1
- name: cmk_apply
uri:
method: POST
url: http://{{ omdhost }}/{{ omdsite }}/check_mk/webapi.py?action=activate_changes&_username={{ automationuser }}&_secret={{ autosecret }}&mode=specific
body: request={"sites":["{{ omdsite }}"]}
body_format: json
status_code: 200
tags:
- check_mk_apply
delegate_to: 127.0.0.1

View File

@ -1,8 +0,0 @@
---
usersAdd:
- mariusp
usersDel:
- none
usersPSK:
- name: mariusp
psk: ["../files/ssh_keys/mariusp.pub"]

View File

@ -1,24 +0,0 @@
#!/bin/bash
CONN=`echo "show info" | socat /var/lib/haproxy/stats stdio |grep CurrConns | cut -d' ' -f2`
SRVS=`cat /etc/haproxy/haproxy.cfg |grep check | grep server |wc -l`
if [ $CONN = 0 ]; then
CONN=4
fi
if [ $SRVS = 0 ]; then
echo "<<<up_scale>>>"
echo "up_scale 1000"
echo "<<<down_scale>>>"
echo "down_scale 1000"
else
let "CONNPERSRV=$CONN/$SRVS"
echo "<<<up_scale>>>"
echo "up_scale $CONNPERSRV"
if [ $SRVS -le 2 ]; then
echo "<<<down_scale>>>"
echo "down_scale 16"
else
echo "<<<down_scale>>>"
echo "down_scale $CONNPERSRV"
fi
fi

View File

@ -1,57 +0,0 @@
global
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
daemon
stats socket /var/lib/haproxy/stats mode 644 level admin
stats timeout 2m
#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000
#---------------------------------------------------------------------
# main frontend which proxys to the backends
#---------------------------------------------------------------------
frontend main *:5000
acl url_static path_beg -i /static /images /javascript /stylesheets
acl url_static path_end -i .jpg .gif .png .css .js
#use_backend static if url_static
#default_backend appname
##
listen appname 0.0.0.0:80
mode http
stats enable
stats uri /haproxy?stats
stats realm Strictly\ Private
stats auth marius:marius
balance roundrobin
option httpclose
option forwardfor
# we are adding our hosts manually ..
# we could populate this dynamically from our inventory
server web1 10.88.88.128:80 check
server web2 10.88.88.129:80 check

View File

@ -1,29 +0,0 @@
---
- name: restart haproxy
service: name=haproxy state=restarted
tags: haproxy
#la executie scriptul va seta cu -e o noua variabila de genul new_server=' server web2 10.88.88.129:80 check'
- name: add_backend
action: 'lineinfile "dest=/etc/haproxy/haproxy.cfg" state=present regexp="{{new_server}}" line="{{new_Server}}"'
tags:
- add_backend
#la executie scriptul va seta cu -e o noua variabila de genul old_server=' server web2 10.88.88.129:80 check'
- name: del_backend
action: 'lineinfile "dest=/etc/haproxy/haproxy.cfg" state=absent regexp="{{old_server}}" line="{{old_Server}}"'
tags:
- del_backend
- name: cmk_discovery
command: curl 'http://{{ omdhost }}/{{ omdsite }}/check_mk/webapi.py?action=discover_services&_username={{ automationuser }}&_secret={{ autosecret }}&mode=refresh' -d 'request={"hostname":"{{ inventory_hostname }}"}'
tags:
- check_mk_agent
- check_mk_discovery
- name: cmk_apply
command: curl 'http://{{ omdhost }}/{{ omdsite }}/check_mk/webapi.py?action=activate_changes&_username={{ automationuser }}&_secret={{ autosecret }}&mode=specific' -d 'request={"sites":["{{ omdsite }}"]}'
tags:
- check_mk_agent
- check_mk_discovery

View File

@ -1,22 +0,0 @@
---
- name: make sure haproxy and socat is installed
yum: name={{ item}} state=latest
with_items:
- socat
- haproxy
tags: packages
- name: copy haproxy configuration files
copy: src=../files/haproxy.cfg.j2 dest=/etc/haproxy/haproxy.cfg backup=yes mode=0644
notify:
- restart haproxy
- name: deploy ha_check.sh (autoscale)
copy: src=../files/check_ha.sh dest=/usr/lib/check_mk_agent/plugins/check_sa.sh mode=755
tags: check_sa
notify:
- cmk_discovery
- cmk_apply
- name: enable haproxy
service: name=haproxy enabled=yes state=started

View File

@ -1,27 +0,0 @@
---
# file: roles/common/tasks/main.yml
# we need omd host/site from omd role
- include_vars: roles/omd/vars/main.yml
- name: make sure epel is installed
yum: pkg={{ item }} state=installed
with_items:
- epel-release
tags: packages
- name: upload omd package
copy: src=roles/omd/files/check-mk-enterprise-1.2.7i3p1-el6-36.x86_64.rpm dest=/tmp
- name: install omd server
yum: name=/tmp/check-mk-enterprise-1.2.7i3p1-el6-36.x86_64.rpm state=present
# might be nice to create ansible module for omd
- name: create prod instance
command: /usr/bin/omd create prod
tags:
- omdcreate
- name: start our prod instance
command: /usr/bin/omd start prod
tags:
- omdstart

View File

@ -1,7 +0,0 @@
---
automationuser: "automaton"
autosecret: "GUVKRNECLRGFBTQJCRFY"
omdhost: "10.88.88.150"
#omdhost: "192.168.217.129"
omdsite: "prod"
rpmagent: "check-mk-agent-1.2.7i3p1-1.noarch.rpm"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

View File

@ -1,6 +0,0 @@
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 10.88.88.150 127.0.0.1 ::1
</Location>

View File

@ -1,20 +0,0 @@
---
- name: restart httpd
service: name=httpd state=restarted
tags:
- httpd
notify:
- cmk_discovery
- cmk_apply
- name: cmk_discovery
command: curl 'http://{{ omdhost }}/{{ omdsite }}/check_mk/webapi.py?action=discover_services&_username={{ automationuser }}&_secret={{ autosecret }}&mode=refresh' -d 'request={"hostname":"{{ inventory_hostname }}"}'
tags:
- check_mk_agent
- check_mk_discovery
- name: cmk_apply
command: curl 'http://{{ omdhost }}/{{ omdsite }}/check_mk/webapi.py?action=activate_changes&_username={{ automationuser }}&_secret={{ autosecret }}&mode=specific' -d 'request={"sites":["{{ omdsite }}"]}'
tags:
- check_mk_agent
- check_mk_discovery

View File

@ -1,36 +0,0 @@
---
- name: make sure httpd is installed
yum: name=httpd state=latest
tags: httpd
- name: enable httpd
service: name=httpd enabled=yes state=started
tags:
- httpd
- name: enable http status
copy: src=../files/status.conf.j2 dest=/etc/httpd/conf.d/status.conf backup=yes mode=0644
notify:
- restart httpd
tags:
- http_status
- cmk_discovery
- cmk_apply
- name: add apache_status plugin
get_url: url=http://{{ omdhost }}/{{ omdsite }}/check_mk/agents/plugins/apache_status dest=/usr/lib/check_mk_agent/plugins/apache_status mode=0755
tags:
- apache_status
notify:
- cmk_discovery
- cmk_apply
- name: copy images to sites
copy: src=../files/konf.jpg dest=/var/www/html/ mode=0644
tags:
- webcontent
- name: copy index.html to sites
template: src=../templates/index.html.j2 dest=/var/www/html/index.html mode=0644
tags:
- webcontent

View File

@ -1,16 +0,0 @@
<html>
<head>
<title>Welcome to the 2ND Check_MK Conference!</title>
</head>
<body>
<img src="konf.jpg" />
<br />
<br />
<strong>Welcome to the 2ND Check_MK Conference!</strong>
<br />
<p><h3>Im running on {{ inventory_hostname }}.</h3><p>
<p>Running on {{ ansible_os_family }} ;-}</p>
</body>
</html>

View File

@ -1,5 +0,0 @@
---
- include: bootstrap.yml
- include: webservers.yml
- include: loadbalancers.yml
- include: omd.yml

View File

@ -1,7 +0,0 @@
---
# file: webservers.yml
- hosts: webservers
vars_files: [roles/common/vars/usersandpsks.yml, roles/omd/vars/main.yml]
roles:
- common
- webservers

View File

@ -340,11 +340,11 @@ cluster_xml = \
</tr>
<tr>
<td class="propertyName sysContact">sysContact</td>
<td class="propertyValue">backup.ro@orange.com</td>
<td class="propertyValue">emailo@example.com</td>
</tr>
<tr>
<td class="propertyName sysLocation">sysLocation</td>
<td class="propertyValue">Farm2 - Cluj</td>
<td class="propertyValue">RandomLocation</td>
</tr>
<tr>
<td class="propertyName isMixedCluster">isMixedCluster</td>

View File

@ -0,0 +1,22 @@
#!/bin/bash
# Notify via Microsoft Teams
# Has not been tested with bulking!
# - copy this script into ~/local/share/check_mk/notificaions
# - make sure it is executable
# - create a microsoft teams incoming webhook (https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook)
# - use the Notify via Microsoft Teams Notification Method in your notification rule
# Microsoft webhook:
1. Open the Channel and click the More Options button which appears as three dots at the top right of the window.
2. Select Connectors.
3. Scroll down to Incoming Webhook and click the Add button.
4. Choose a name you like for the connector as well as an image and finally click Create.
5. A new unique URI is automatically generated. Copy this URI string below in the URL variable.
<insert-your-webhook-url>.
TEXT="$NOTIFY_HOSTNAME: $NOTIFY_SERVICEDESC: $NOTIFY_SERVICESTATE $NOTIFY_SERVICEOUTPUT"
URL=""
curl -H "Content-Type: application/json" -d "{\"text\": \"$TEXT\"}" $URL -4

1
hitachi-vsp/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.idea*

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.7" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/hitachi-vsp.iml" filepath="$PROJECT_DIR$/.idea/hitachi-vsp.iml" />
</modules>
</component>
</project>

6
hitachi-vsp/README Normal file
View File

@ -0,0 +1,6 @@
# Checkmk active check for Hitachi SVP
Tested on models x, x but according to API should work with VSP G130 G/F350
G/F370 G/F700 G/F900

Binary file not shown.

View File

@ -0,0 +1,25 @@
def _valuespec_special_agents_hitachivsp():
return Dictionary(
title=_("Check HITACHI VSP Storages"),
help=_("This rule set selects the special agent for Hitachi VSP Storages "
"instead of the normal Check_MK agent and allows monitoring via Web API. "),
optional_keys=["cert"],
elements=[
("user", TextAscii(title=_("Username"), allow_empty=False)),
("password", Password(title=_("Password"), allow_empty=False)),
("cert",
DropdownChoice(title=_("SSL certificate verification"),
choices=[
(True, _("Activate")),
(False, _("Deactivate")),
])),
],
)
rulespec_registry.register(
HostRulespec(
group=RulespecGroupDatasourcePrograms,
name="special_agents:hitachivsp",
valuespec=_valuespec_special_agents_hitachivsp,
))

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,42 @@
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2017 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# tails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
def agent_hitachivsp_arguments(params, hostname, ipaddress):
args = ''
args += "--address=%s " % hostname
args += "--user=%s " % params["user"]
args += "--password=%s " % params["password"]
if "cert" in params and params["cert"] is False:
args += "--no-cert-check "
return args
special_agent_info['hitachivsp'] = agent_hitachivsp_arguments

View File

@ -0,0 +1,73 @@
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2020 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# tails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
#example output
#<<<hitachivsp_backup_modules:sep(9)>>>
#location status bat_location bat_status bat_life
#BKMF-10 Normal
#BKMF-11 Normal BAT-B11 Normal 90
#BKMF-12 Normal BAT-B12 Normal 90
#BKMF-13 Normal BAT-B13 Normal 90
#BKMF-20 Normal
#BKMF-21 Normal BAT-B21 Normal 90
#BKMF-22 Normal BAT-B22 Normal 90
#BKMF-23 Normal BAT-B23 Normal 90
def inventory_hitachivsp_backup_modules(info):
for line in info:
if "location" not in line:
yield line[0], {}
def check_hitachivsp_backup_modules(item, params, info):
for line in info:
if item == line[0]:
if line[1] == "Normal":
yield 0, "Backup Module status is Normal"
elif line[1] == "Warning":
yield 1, "Backup Module status is Warning"
elif line[1] == "Blocked":
yield 2, "Backup Module status is Blocked"
elif line[1] == "Failed":
yield 2, "Backup Module status is Failed"
if len(line) > 2:
if line[3] == "Normal":
yield 0, "Battery status is Normal"
elif line[3] == "Warning":
yield 1, "Battery status is Warning"
elif line[3] == "Blocked":
yield 2, "Battery status is Blocked"
elif line[3] == "Failed":
yield 2, "Battery status is Failed"
check_info['hitachivsp_backup_modules'] = {
'inventory_function': inventory_hitachivsp_backup_modules,
'check_function': check_hitachivsp_backup_modules,
'service_description': 'Backup Module %s',
'has_perfdata': False
}

View File

@ -0,0 +1,61 @@
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2020 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# tails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
#example output
#<<<hitachivsp_channel_board:sep(9)>>>
#location status type
#CHB-1A Normal 32G Ready 4Port FC
#CHB-1B Normal 32G Ready 4Port FC
#CHB-2A Normal 32G Ready 4Port FC
#CHB-2B Normal 32G Ready 4Port FC
def inventory_hitachivsp_cache_flash_memories(info):
for line in info:
if "location" not in line:
yield line[0], {}
def check_hitachivsp_cache_flash_memories(item, params, info):
for line in info:
if item == line[0]:
if line[1] == "Normal":
yield 0, "Cache memory status is Normal"
elif line[1] == "Warning":
yield 1, "Cache memory status is Warning"
elif line[1] == "Blocked":
yield 2, "Cache memory status is Blocked"
elif line[1] == "Failed":
yield 2, "Cache memory status is Failed"
check_info['hitachivsp_cache_flash_memories'] = {
'inventory_function': inventory_hitachivsp_cache_flash_memories,
'check_function': check_hitachivsp_cache_flash_memories,
'service_description': 'Cache Flash Memory %s',
'has_perfdata': True
}

View File

@ -0,0 +1,56 @@
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2020 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# tails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
#example output
#<<<hitachivsp_cache_memories:sep(9)>>>
#location status cacheSize
#CTL1 CMG0 Normal 256
#CTL1 CMG1 Normal 256
#CTL2 CMG0 Normal 256
#CTL2 CMG1 Normal 256
def inventory_hitachivsp_cache_memories(info):
for line in info:
if "location" not in line:
yield line[0], {}
def check_hitachivsp_cache_memories(item, params, info):
for line in info:
if item == line[0]:
if line[1] == "Normal":
yield 0, "Cache memory status is Normal"
elif line[1] == "Warning":
yield 1, "Cache memory status is Warning"
check_info['hitachivsp_cache_memories'] = {
'inventory_function': inventory_hitachivsp_cache_memories,
'check_function': check_hitachivsp_cache_memories,
'service_description': 'Cache Memory %s',
'has_perfdata': True
}

View File

@ -0,0 +1,65 @@
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2020 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# tails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
#example output
#<<<hitachivsp_channel_board:sep(9)>>>
#location status type
#CHB-1A Normal 32G Ready 4Port FC
#CHB-1B Normal 32G Ready 4Port FC
#CHB-2A Normal 32G Ready 4Port FC
#CHB-2B Normal 32G Ready 4Port FC
def inventory_hitachivsp_channel_board(info):
for line in info:
if "location" not in line:
yield line[0], {}
def check_hitachivsp_channel_board(item, params, info):
for line in info:
if item == line[0]:
if line[1] == "Normal":
yield 0, "Channel board status is Normal, Channel board type: %s" %\
line[2]
elif line[1] == "Warning":
yield 1, "Channel board status is Warning, Channel board type: %s" %\
line[2]
elif line[1] == "Blocked":
yield 2, "Channel board status is Blocked, Channel board type: %s" %\
line[2]
elif line[1] == "Failed":
yield 2, "Channel board status is Failed, Channel board type: %s" %\
line[2]
check_info['hitachivsp_channel_board'] = {
'inventory_function': inventory_hitachivsp_channel_board,
'check_function': check_hitachivsp_channel_board,
'service_description': 'Channel Board %s',
'has_perfdata': True
}

View File

@ -0,0 +1,55 @@
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2020 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# tails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
#example output
#<<<hitachivsp_clprs:sep(9)>>>
#clprId cacheMemoryCapacity cacheMemoryUsedCapacity writePendingDataCapacity cacheUsageRate
#0 924672 901454 44959 99
def inventory_hitachivsp_clprs(info):
for line in info:
if "clprId" not in line:
yield line[0], {}
def check_hitachivsp_clprs(item, params, info):
for line in info:
if item == line[0]:
yield 0, "CacheMemoryCapacity[GB]: %s ; CacheMemoryUsedCapacity[GB]: %s ; cacheUsageRate %s " % \
( int(line[1])/1024 , int(line[2])/1024, line[4] ), \
[("CacheMemoryCapacity", int(line[1])/1024, None, None, 0),
("CacheMemoryUsedCapacity", int(line[2])/1024, None, None, 0),
("CacheUsageRate", line[4], None, None, 0)]
check_info['hitachivsp_clprs'] = {
'inventory_function': inventory_hitachivsp_clprs,
'check_function': check_hitachivsp_clprs,
'service_description': 'CLPR %s',
'has_perfdata': True
}

View File

@ -0,0 +1,66 @@
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2020 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# tails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
#example output
#<<<hitachivsp_ctls:sep(9)>>>
#location status temperature temperatureStatus charge
#CTL1 Normal 23 Normal 100
#CTL2 Normal 23 Normal 100
def inventory_hitachivsp_ctls(info):
for line in info:
if "location" not in line:
yield line[0], {}
def check_hitachivsp_ctls(item, params, info):
for line in info:
if item == line[0]:
if line[1] == "Normal" :
yield 0, "Controller status is Normal"
elif line[1] == "Warning" :
yield 1, "Controller status is Warning"
elif line[1] == "Blocked" :
yield 2, "Controller status is Blocked"
elif line[1] == "Failed" :
yield 2, "Controller status is Failed"
if line[3] == "Normal" :
yield 0, "Temperature Status is Normal: %s" % line[2]
elif line[3] == "Warning":
yield 1, "Temperature Status is Warning: %s" % line[2]
elif line[3] == "Failed":
yield 2, "Temperature Status is Failed: %s" % line[2]
check_info['hitachivsp_ctls'] = {
'inventory_function': inventory_hitachivsp_ctls,
'check_function': check_hitachivsp_ctls,
'service_description': '%s',
'has_perfdata': True
}

View File

@ -0,0 +1,60 @@
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2020 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# tails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
#example output
#<<<hitachivsp_disk_boards:sep(9)>>>
#location status type
#DKB-1G Normal Disk Board
#DKB-1H Normal Disk Board
#DKB-2G Normal Disk Board
#DKB-2H Normal Disk Board
def inventory_hitachivsp_disk_boards(info):
for line in info:
if "location" not in line:
yield line[0], {}
def check_hitachivsp_disk_boards(item, params, info):
for line in info:
if item == line[0]:
if line[1] == "Normal":
yield 0, "Disk Board status is Normal"
elif line[1] == "Warning":
yield 1, "Disk Board status is Warning"
elif line[1] == "Blocked":
yield 2, "Disk Board status is Blocked"
elif line[1] == "Failed":
yield 2, "Disk Board status is Failed"
check_info['hitachivsp_disk_boards'] = {
'inventory_function': inventory_hitachivsp_disk_boards,
'check_function': check_hitachivsp_disk_boards,
'service_description': 'Disk Board %s',
'has_perfdata': True
}

View File

@ -0,0 +1,63 @@
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2020 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# tails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
#example output
#<<<hitachivsp_drive_boxes_dbps:sep(9)>>>
#drivebox_location dbps_location dbps_status
#DB-00 DBPS00-1 Normal
#DB-00 DBPS00-2 Normal
#DB-01 DBPS01-1 Normal
#DB-01 DBPS01-2 Normal
#DB-02 DBPS02-1 Normal
#DB-02 DBPS02-2 Normal
#DB-03 DBPS03-1 Normal
#DB-03 DBPS03-2 Normal
def inventory_hitachivsp_drive_boxes_dbps(info):
for line in info:
if "dbps_location" not in line:
yield line[1], {}
def check_hitachivsp_drive_boxes_dbps(item, params, info):
for line in info:
if "dbps_location" not in line:
if item == line[1]:
if line[2] == "Normal":
yield 0, "DriveBox Power Supply status is Normal"
elif line[2] == "Warning":
yield 1, "DriveBox Power Supply status is Warning"
elif line[2] == "Failed":
yield 2, "DriveBox Power Supply status is Failed"
check_info['hitachivsp_drive_boxes_dbps'] = {
'inventory_function': inventory_hitachivsp_drive_boxes_dbps,
'check_function': check_hitachivsp_drive_boxes_dbps,
'service_description': 'DriveBox Power supply %s',
'has_perfdata': False
}

View File

@ -0,0 +1,90 @@
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2020 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# tails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
#example output
#<<<hitachivsp_drive_boxes_drives:sep(9)>>>
#drivebox_location drive_location drive_status drive_recomend_Replacement
#DB-00 HDD00-00 Normal 0
#DB-00 HDD00-01 Normal 0
#DB-00 HDD00-02 Normal 0
#DB-00 HDD00-03 Normal 0
#DB-00 HDD00-04 Normal 0
#DB-00 HDD00-05 Normal 0
#DB-00 HDD00-11 Normal 0
#DB-01 HDD01-00 Normal 0
#DB-01 HDD01-01 Normal 0
#DB-01 HDD01-02 Normal 0
#DB-01 HDD01-03 Normal 0
#DB-01 HDD01-04 Normal 0
#DB-01 HDD01-05 Normal 0
#DB-02 HDD02-00 Normal 0
#DB-02 HDD02-01 Normal 0
#DB-02 HDD02-02 Normal 0
#DB-02 HDD02-03 Normal 0
#DB-02 HDD02-04 Normal 0
#DB-02 HDD02-05 Normal 0
#DB-03 HDD03-00 Normal 0
#DB-03 HDD03-01 Normal 0
#DB-03 HDD03-02 Normal 0
#DB-03 HDD03-03 Normal 0
#DB-03 HDD03-04 Normal 0
#DB-03 HDD03-05 Normal 0
def inventory_hitachivsp_drive_boxes_drives(info):
for line in info:
if "drive_location" not in line:
yield line[1], {}
def check_hitachivsp_drive_boxes_drives(item, params, info):
for line in info:
if item == line[1]:
if line[2] == "Normal":
yield 0, "Drive status is Normal"
elif "Warning" in line[2]:
yield 1, "Drive status is: %s" % line[2]
elif "Copying" in line[2]:
yield 1, "Drive status is: %s" % line[2]
elif "Pending" in line[2]:
yield 1, "Drive status is: %s" % line[2]
elif line[2] == "Copy incomplete":
yield 2, "Drive status is Copy Incomplete"
if line[3] == "1":
yield 1, "Drive replacement is recommended"
else:
yield 0, "Drive replacement is not recommended"
check_info['hitachivsp_drive_boxes_drives'] = {
'inventory_function': inventory_hitachivsp_drive_boxes_drives,
'check_function': check_hitachivsp_drive_boxes_drives,
'service_description': 'Drive %s',
'has_perfdata': True
}

View File

@ -0,0 +1,65 @@
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2020 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# tails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
#example output
#<<<hitachivsp_drive_boxes_encs:sep(9)>>>
#drivebox_location enc_location enc_status
#DB-00 ENC00-1 Normal
#DB-00 ENC00-2 Normal
#DB-01 ENC01-1 Normal
#DB-01 ENC01-2 Normal
#DB-02 ENC02-1 Normal
#DB-02 ENC02-2 Normal
#DB-03 ENC03-1 Normal
#DB-03 ENC03-2 Normal
def inventory_hitachivsp_drive_boxes_encs(info):
for line in info:
if "enc_location" not in line:
yield line[1], {}
def check_hitachivsp_drive_boxes_encs(item, params, info):
for line in info:
if "enc_location" not in line:
if item == line[1]:
if line[2] == "Normal":
yield 0, "Drive Enclosure status is Normal"
elif line[2] == "Warning":
yield 1, "Drive Enclosure status is Warning"
elif line[2] == "Blocked":
yield 2, "Drive Enclosure status is Blocked"
elif line[2] == "Failed":
yield 2, "Drive Enclosure status is Failed"
check_info['hitachivsp_drive_boxes_encs'] = {
'inventory_function': inventory_hitachivsp_drive_boxes_encs,
'check_function': check_hitachivsp_drive_boxes_encs,
'service_description': 'Drive box enclosure %s',
'has_perfdata': True
}

View File

@ -0,0 +1,56 @@
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2020 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# tails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
#.
# .--general-------------------------------------------------------------.
# | _ |
# | __ _ ___ _ __ ___ _ __ __ _| | |
# | / _` |/ _ \ '_ \ / _ \ '__/ _` | | |
# | | (_| | __/ | | | __/ | | (_| | | |
# | \__, |\___|_| |_|\___|_| \__,_|_| |
# | |___/ |
# +----------------------------------------------------------------------+
# | |
# '----------------------------------------------------------------------'
#example output
#<<<hitachivsp_info:sep(9)>>>
#666666 666666666666 88-04-03/00 VSP G700
def inventory_hitachivsp_info(info):
return [(None, None)]
def check_hitachivsp_info(item, _no_params, info):
return 0, "Model: %s, Serial Number: %s , StorageDeviceID: %s, dkcMicroVersion: %s " % \
(info[0][3], info[0][0], info[0][1], info[0][2] )
check_info['hitachivsp_info'] = {
'inventory_function': inventory_hitachivsp_info,
'check_function': check_hitachivsp_info,
'service_description': 'Hitachi VSP Info',
}

View File

@ -0,0 +1,65 @@
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2020 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# tails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
#example output
#<<<hitachivsp_ldevs:sep(9)>>>
#ldevId clprId byteFormatCapacity blockCapacity label status
#0 0 500.00 G 1048576000 vg_test0 NML
#1 0 400.00 G 838860800 vg_test1 NML
#2 0 10.00 T 21474836480 vmware_legacy_ssd0 NML
#3 0 10.00 T 21474836480 vmware_legacy_ssd1 NML
#4 0 5.00 T 10737418240 vmware_legacy_ssd2 NML
#5 0 5.00 T 10737418240 vmware_legacy_ssd3 NML
def inventory_hitachivsp_ldevs(info):
for line in info:
if "ldevId" not in line:
yield line[0], {}
def check_hitachivsp_ldevs(item, params, info):
for line in info:
if item == line[0]:
if line[5] == "NML":
yield 0, "Ldev is in normal status; byteFormatCapacity: %s ; blockCapacity: %s ; label %s ; \
status %s" % (line[2], line[3], line[4], line[5])
elif line[5] == "BLK":
yield 2, "Ldev is Blocked!!; byteFormatCapacity: %s ; blockCapacity: %s ; label %s ; \
status %s" % (line[2], line[3], line[4], line[5])
elif line[5] == "BSY":
yield 2, "Ldev status is being changed!!; byteFormatCapacity: %s ; blockCapacity: %s ; label %s ; \
status %s" % (line[2], line[3], line[4], line[5])
else:
yield 3, "Ldev status is unknown(not supported)"
check_info['hitachivsp_ldevs'] = {
'inventory_function': inventory_hitachivsp_ldevs,
'check_function': check_hitachivsp_ldevs,
'service_description': 'LDEV %s',
'has_perfdata': False
}

View File

@ -0,0 +1,59 @@
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2020 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# tails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
#example output
#<<<hitachivsp_parity_groups:sep(9)>>>
#parityGroupId numOfLdevs usedCapacityRate clprId availableVolumeCapacity totalCapacity physicalCapacity
#1-1 26 44 0 87245 157286 39321
#1-2 51 93 0 10448 157286 39321
#1-3 25 42 0 90317 157286 39321
#1-4 52 95 0 7376 157286 39321
#1-5 54 99 0 1232 157286 39321
#1-6 25 42 0 90317 157286 39321
def inventory_hitachivsp_parity_groups(info):
for line in info:
if "parityGroupId" not in line:
yield line[0], {}
def check_hitachivsp_parity_groups(item, params, info):
for line in info:
if item == line[0]:
yield 0, "UsedCapacityRate: %s; AvailableVolumeCapacity(GB): %s; TotalCapacity(GB): %s" % \
( line[2], int(line[4]), int(line[5]) ), \
[("UsedCapacityRate",line[2], None, None, 0),
("AvailableVolumeCapacity", int(line[4]), None, None,0),
("TotalCapacity", int(line[5]), None, None, 0)]
check_info['hitachivsp_parity_groups'] = {
'inventory_function': inventory_hitachivsp_parity_groups,
'check_function': check_hitachivsp_parity_groups,
'service_description': 'Parity Group %s',
'has_perfdata': True
}

View File

@ -0,0 +1,60 @@
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2020 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# tails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
#example output
#<<<hitachivsp_pools:sep(9)>>>
#poolID poolType poolName totalPhysicalCapacity totalPoolCapacity availableVolumeCapacity usedCapacityRate poolStatus
#0 RT RAID6_HDT_01 397630296 397630296 208964826 47 POLN
#1 HTI THIN_IMAGE_POOL 46453344 46453344 46453344 0 POLN
def inventory_hitachivsp_pools(info):
for line in info:
if "totalPhysicalCapacity" not in line:
yield line[0], {}
def check_hitachivsp_pools(item, _no_params, info):
for line in info:
if item == line[0]:
perf_data = line[6]
if line[7] == "POLE":
yield 2, "Pool is suspended in failure status"
elif line[7] == "POLN":
yield 0, "Pool is Normal"
elif line[7] == "POLF":
yield 2, "Pool is Full"
elif line[7] == "POLS":
yield 2, "Pool is Suspended"
check_info['hitachivsp_pools'] = {
'inventory_function': inventory_hitachivsp_pools,
'check_function': check_hitachivsp_pools,
'service_description': 'Pool %s',
'has_perfdata': False
}

View File

@ -0,0 +1,48 @@
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2020 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# tails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
#example output
#<<<hitachivsp_powerConsumption:sep(9)>>>
#clprId cacheMemoryCapacity cacheMemoryUsedCapacity writePendingDataCapacity cacheUsageRate
#0 924672 901454 44959 99
def inventory_hitachivsp_powerConsumption(info):
yield "Power Consumption", {}
def check_hitachivsp_powerConsumption(item, params, info):
yield 0, "Power Consumption: %s " % int(info[0][1]), \
[("PowerConsumption", int(info[0][1]), None, None, 0)]
check_info['hitachivsp_powerConsumption'] = {
'inventory_function': inventory_hitachivsp_powerConsumption,
'check_function': check_hitachivsp_powerConsumption,
'service_description': '%s',
'has_perfdata': True
}

View File

@ -0,0 +1,75 @@
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2020 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# tails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
#example output
#<<<hitachivsp_sfps:sep(9)>>>
#portId status type speed portCondition
#1A Normal Short Wave 16 Gbps Available (Connected)
#3A Normal Short Wave 16 Gbps Available (Connected)
#5A Normal Short Wave 16 Gbps Available (Connected)
#7A Normal Short Wave 16 Gbps Available (Connected)
#1B Normal Short Wave 16 Gbps Available (Connected)
#3B Normal Short Wave 16 Gbps Available (Connected)
#5B Normal Short Wave 16 Gbps Available (Connected)
#7B Normal Short Wave 16 Gbps Available (Connected)
#2A Normal Short Wave 16 Gbps Available (Connected)
#4A Normal Short Wave 16 Gbps Available (Connected)
#6A Normal Short Wave 16 Gbps Available (Connected)
#8A Normal Short Wave 16 Gbps Available (Connected)
#2B Normal Short Wave 16 Gbps Available (Connected)
#4B Normal Short Wave 16 Gbps Available (Connected)
#6B Normal Short Wave 16 Gbps Available (Connected)
#8B Normal Short Wave 16 Gbps Available (Connected)
def inventory_hitachivsp_sfps(info):
for line in info:
if "portId" not in line:
yield line[0], {}
def check_hitachivsp_sfps(item, params, info):
for line in info:
if item == line[0]:
if line[1] == "Normal":
yield 0, "SFP status is Normal"
elif line[1] == "Warning":
yield 1, "SFP status is Warning"
elif line[1] == "Not fix":
yield 2, "SFP status is Not fix"
if line[4] == "Available (Connected)":
yield 0, "SFP is Connected"
elif line[4] == "Available (Not Connected)":
yield 1, "SFP is not Connected"
elif line[4] == "Not Available":
yield 2, "SFP is not available"
check_info['hitachivsp_sfps'] = {
'inventory_function': inventory_hitachivsp_sfps,
'check_function': check_hitachivsp_sfps,
'service_description': 'SFP Port %s',
'has_perfdata': False
}

1
juniper Submodule

@ -0,0 +1 @@
Subproject commit 96001a48bf6b60347e7370b5b34b7368fd2973e9