diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..5e7980c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "juniper"] + path = juniper + url = https://github.com/spearheadsys/check_mk.git diff --git a/ansible-check_mk/README.md b/ansible-check_mk/README.md deleted file mode 100644 index bffeaac..0000000 --- a/ansible-check_mk/README.md +++ /dev/null @@ -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 ... diff --git a/ansible-check_mk/bootstrap.yml b/ansible-check_mk/bootstrap.yml deleted file mode 100644 index 2355a79..0000000 --- a/ansible-check_mk/bootstrap.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# file: bootstrap.yml -- hosts: all - #vars: - vars_files: [roles/common/vars/usersandpsks.yml, roles/omd/vars/main.yml] - roles: - - common diff --git a/ansible-check_mk/cmkconfinv b/ansible-check_mk/cmkconfinv deleted file mode 100644 index 915893d..0000000 --- a/ansible-check_mk/cmkconfinv +++ /dev/null @@ -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 diff --git a/ansible-check_mk/loadbalancers.yml b/ansible-check_mk/loadbalancers.yml deleted file mode 100644 index d97fd1f..0000000 --- a/ansible-check_mk/loadbalancers.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# file: loadbalancers.yml -- hosts: loadbalancers - vars_files: [roles/common/vars/usersandpsks.yml, roles/omd/vars/main.yml] - roles: - - common - - loadbalancers diff --git a/ansible-check_mk/omd.yml b/ansible-check_mk/omd.yml deleted file mode 100644 index 634404c..0000000 --- a/ansible-check_mk/omd.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# file: omd.yml -- hosts: omd - #vars: - #vars_files: - roles: - - omd diff --git a/ansible-check_mk/roles/common/files/ssh_keys/mariusp.pub b/ansible-check_mk/roles/common/files/ssh_keys/mariusp.pub deleted file mode 100644 index 694f8e5..0000000 --- a/ansible-check_mk/roles/common/files/ssh_keys/mariusp.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/asZXkhLJVGIcPQGUxZDLl/yMwslgn6GyJd6QGKUmR+Snr1hMz01y7WEWPvfXXUqNym6rMU5fAMUr+alcyzMGZYKyymTLfjgp0SUuWG3TGpl3EPxnfGwNcXOvuJE9cnY0q3nhZgQjvn6EdEFDKAmLG1WXlKYjbQUUrHp0wFvEx3TNIXMVJqHxbKi8Uwyvn5EB1emdeJkaAaXJbk1TxALu400Ts0KYJUUyMn5njJjVELwtPVsnb0skmKSXd4dgBLN+wo94YQLpdfCnmho0uPhZfTHHi0+jtJNtUSycOSuOr/TxYGirxOYcb5FoOvzg9L0RyQAj6O+Hzs3RkHB+qast mariusp@marduk.local diff --git a/ansible-check_mk/roles/common/handlers/main.yml b/ansible-check_mk/roles/common/handlers/main.yml deleted file mode 100644 index 079c4f1..0000000 --- a/ansible-check_mk/roles/common/handlers/main.yml +++ /dev/null @@ -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 diff --git a/ansible-check_mk/roles/common/tasks/main.yml b/ansible-check_mk/roles/common/tasks/main.yml deleted file mode 100644 index 31c70b9..0000000 --- a/ansible-check_mk/roles/common/tasks/main.yml +++ /dev/null @@ -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 diff --git a/ansible-check_mk/roles/common/vars/usersandpsks.yml b/ansible-check_mk/roles/common/vars/usersandpsks.yml deleted file mode 100644 index 059f83a..0000000 --- a/ansible-check_mk/roles/common/vars/usersandpsks.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -usersAdd: - - mariusp -usersDel: - - none -usersPSK: - - name: mariusp - psk: ["../files/ssh_keys/mariusp.pub"] diff --git a/ansible-check_mk/roles/loadbalancers/files/check_ha.sh b/ansible-check_mk/roles/loadbalancers/files/check_ha.sh deleted file mode 100644 index b1e599c..0000000 --- a/ansible-check_mk/roles/loadbalancers/files/check_ha.sh +++ /dev/null @@ -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 "<<>>" - echo "up_scale 1000" - echo "<<>>" - echo "down_scale 1000" -else - let "CONNPERSRV=$CONN/$SRVS" - echo "<<>>" - echo "up_scale $CONNPERSRV" - if [ $SRVS -le 2 ]; then - echo "<<>>" - echo "down_scale 16" - else - echo "<<>>" - echo "down_scale $CONNPERSRV" - fi - -fi diff --git a/ansible-check_mk/roles/loadbalancers/files/haproxy.cfg.j2 b/ansible-check_mk/roles/loadbalancers/files/haproxy.cfg.j2 deleted file mode 100644 index ea75cc9..0000000 --- a/ansible-check_mk/roles/loadbalancers/files/haproxy.cfg.j2 +++ /dev/null @@ -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 diff --git a/ansible-check_mk/roles/loadbalancers/handlers/main.yml b/ansible-check_mk/roles/loadbalancers/handlers/main.yml deleted file mode 100644 index d2c9b73..0000000 --- a/ansible-check_mk/roles/loadbalancers/handlers/main.yml +++ /dev/null @@ -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 diff --git a/ansible-check_mk/roles/loadbalancers/tasks/main.yml b/ansible-check_mk/roles/loadbalancers/tasks/main.yml deleted file mode 100644 index 899d49b..0000000 --- a/ansible-check_mk/roles/loadbalancers/tasks/main.yml +++ /dev/null @@ -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 diff --git a/ansible-check_mk/roles/omd/tasks/main.yml b/ansible-check_mk/roles/omd/tasks/main.yml deleted file mode 100644 index a0a9ca2..0000000 --- a/ansible-check_mk/roles/omd/tasks/main.yml +++ /dev/null @@ -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 diff --git a/ansible-check_mk/roles/omd/vars/main.yml b/ansible-check_mk/roles/omd/vars/main.yml deleted file mode 100644 index c56c487..0000000 --- a/ansible-check_mk/roles/omd/vars/main.yml +++ /dev/null @@ -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" diff --git a/ansible-check_mk/roles/webservers/files/konf.jpg b/ansible-check_mk/roles/webservers/files/konf.jpg deleted file mode 100644 index fd91efe..0000000 Binary files a/ansible-check_mk/roles/webservers/files/konf.jpg and /dev/null differ diff --git a/ansible-check_mk/roles/webservers/files/status.conf.j2 b/ansible-check_mk/roles/webservers/files/status.conf.j2 deleted file mode 100644 index cfb047e..0000000 --- a/ansible-check_mk/roles/webservers/files/status.conf.j2 +++ /dev/null @@ -1,6 +0,0 @@ - - SetHandler server-status - Order deny,allow - Deny from all - Allow from 10.88.88.150 127.0.0.1 ::1 - diff --git a/ansible-check_mk/roles/webservers/handlers/main.yml b/ansible-check_mk/roles/webservers/handlers/main.yml deleted file mode 100644 index df85424..0000000 --- a/ansible-check_mk/roles/webservers/handlers/main.yml +++ /dev/null @@ -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 diff --git a/ansible-check_mk/roles/webservers/tasks/main.yml b/ansible-check_mk/roles/webservers/tasks/main.yml deleted file mode 100644 index 13f45a8..0000000 --- a/ansible-check_mk/roles/webservers/tasks/main.yml +++ /dev/null @@ -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 diff --git a/ansible-check_mk/roles/webservers/templates/index.html.j2 b/ansible-check_mk/roles/webservers/templates/index.html.j2 deleted file mode 100644 index b91c123..0000000 --- a/ansible-check_mk/roles/webservers/templates/index.html.j2 +++ /dev/null @@ -1,16 +0,0 @@ - - -Welcome to the 2ND Check_MK Conference! - - - - -
-
-Welcome to the 2ND Check_MK Conference! -
- -

Im running on {{ inventory_hostname }}.

-

Running on {{ ansible_os_family }} ;-}

- - diff --git a/ansible-check_mk/site.yml b/ansible-check_mk/site.yml deleted file mode 100644 index 8431a9f..0000000 --- a/ansible-check_mk/site.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- include: bootstrap.yml -- include: webservers.yml -- include: loadbalancers.yml -- include: omd.yml diff --git a/ansible-check_mk/webservers.yml b/ansible-check_mk/webservers.yml deleted file mode 100644 index bab7828..0000000 --- a/ansible-check_mk/webservers.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# file: webservers.yml -- hosts: webservers - vars_files: [roles/common/vars/usersandpsks.yml, roles/omd/vars/main.yml] - roles: - - common - - webservers diff --git a/check_mk-storeonce/local/share/check_mk/agents/special/agent_storeonce b/check_mk-storeonce/local/share/check_mk/agents/special/agent_storeonce index 5264eb9..8da063d 100644 --- a/check_mk-storeonce/local/share/check_mk/agents/special/agent_storeonce +++ b/check_mk-storeonce/local/share/check_mk/agents/special/agent_storeonce @@ -340,11 +340,11 @@ cluster_xml = \ sysContact - backup.ro@orange.com + emailo@example.com sysLocation - Farm2 - Cluj + RandomLocation isMixedCluster diff --git a/checkmk-teams-notification/teams.sh b/checkmk-teams-notification/teams.sh new file mode 100644 index 0000000..fb99f2d --- /dev/null +++ b/checkmk-teams-notification/teams.sh @@ -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. +. + +TEXT="$NOTIFY_HOSTNAME: $NOTIFY_SERVICEDESC: $NOTIFY_SERVICESTATE $NOTIFY_SERVICEOUTPUT" +URL="" + +curl -H "Content-Type: application/json" -d "{\"text\": \"$TEXT\"}" $URL -4 diff --git a/hitachi-vsp/.gitignore b/hitachi-vsp/.gitignore new file mode 100644 index 0000000..5678398 --- /dev/null +++ b/hitachi-vsp/.gitignore @@ -0,0 +1 @@ +*.idea* diff --git a/hitachi-vsp/.idea/hitachi-vsp.iml b/hitachi-vsp/.idea/hitachi-vsp.iml new file mode 100644 index 0000000..c444878 --- /dev/null +++ b/hitachi-vsp/.idea/hitachi-vsp.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/hitachi-vsp/.idea/inspectionProfiles/profiles_settings.xml b/hitachi-vsp/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/hitachi-vsp/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/hitachi-vsp/.idea/modules.xml b/hitachi-vsp/.idea/modules.xml new file mode 100644 index 0000000..b5e76b9 --- /dev/null +++ b/hitachi-vsp/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/hitachi-vsp/README b/hitachi-vsp/README new file mode 100644 index 0000000..bcfa18c --- /dev/null +++ b/hitachi-vsp/README @@ -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 + + diff --git a/hitachi-vsp/hitachivsp-1.0.mkp b/hitachi-vsp/hitachivsp-1.0.mkp new file mode 100644 index 0000000..e651c5c Binary files /dev/null and b/hitachi-vsp/hitachivsp-1.0.mkp differ diff --git a/hitachi-vsp/lib/python/cmk/gui/plugins/wato/datasource_programs.py b/hitachi-vsp/lib/python/cmk/gui/plugins/wato/datasource_programs.py new file mode 100644 index 0000000..76cbc2d --- /dev/null +++ b/hitachi-vsp/lib/python/cmk/gui/plugins/wato/datasource_programs.py @@ -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, + )) \ No newline at end of file diff --git a/hitachi-vsp/share/check_mk/agents/special/agent_hitachivsp b/hitachi-vsp/share/check_mk/agents/special/agent_hitachivsp new file mode 100755 index 0000000..cbbc2c3 --- /dev/null +++ b/hitachi-vsp/share/check_mk/agents/special/agent_hitachivsp @@ -0,0 +1,1390 @@ +#!/usr/bin/env 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. + +import sys +import getopt +import pprint +import json +import urllib3 +import requests + +def usage(): + sys.stderr.write("""Check_MK Hitachi VSP + +USAGE: agent_hitachivsp [OPTIONS] HOST + +OPTIONS: + -h, --help Show this help message and exit + --address Host address + --user Username + --password Password + --no-cert-check Disable certificate check +""") + sys.exit(1) + + +short_options = "h" +long_options = ["help", "username=", "password=", "address=", "demo", "no-cert-check"] + + +try: + opts, args = getopt.getopt(sys.argv[1:], short_options, long_options) +except getopt.GetoptError as err: + sys.stderr.write("%s\n" % err) + sys.exit(1) + + +opt_demo = False +opt_cert = True +args_dict = {} + + +for o,a in opts: + if o in [ "--address" ]: + args_dict["address"] = a + elif o in [ "--username" ]: + args_dict["username"] = a + elif o in [ "--password" ]: + args_dict["password"] = a + elif o in [ "--demo" ]: + opt_demo = True + elif o in [ "--no-cert-check" ]: + opt_cert = False + elif o in [ "-h", "--help" ]: + usage() + + +def query(url): + if not opt_cert: + urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) + response = requests.get(url, + auth=(args_dict["username"], args_dict["password"]), + verify=opt_cert) + raw_json = response.text + return raw_json + + +output_lines = [] +def output(line): +###this is working correctly only on python3. not needed for python2 +# if type(line) not in [str]: +# output_lines.append(pprint.pprint(line)) +# else: + output_lines.append(line) + + +def get_storage_info(): + if opt_demo: + raw_json = storage_info + return raw_json + url = "https://%(address)s/ConfigurationManager/v1/objects/storages/instance" % args_dict + return query(url) + + +def get_storage_pools(): + if opt_demo: + raw_json = storage_pools + return raw_json + url = "https://%(address)s/ConfigurationManager/v1/objects/pools" % args_dict + return query(url) + + +def get_storage_clprs(): + if opt_demo: + raw_json = storage_clprs + return raw_json + url = "https://%(address)s/ConfigurationManager/v1/objects/clprs" % args_dict + return query(url) + + +def get_storage_ldevs(): + if opt_demo: + raw_json = storage_ldevs + return raw_json + url = "https://%(address)s/ConfigurationManager/v1/objects/ldevs" % args_dict + return query(url) + + +def get_storage_parity_groups(): + if opt_demo: + raw_json = storage_parity_groups + return raw_json + url = "https://%(address)s/ConfigurationManager/v1/objects/parity-groups" % args_dict + return query(url) + + +def get_storage_hardware_status(): + if opt_demo: + raw_json = storage_hardware_status + return raw_json + url = "https://%(address)s/ConfigurationManager/v1/objects/components/instance" % args_dict + return query(url) + + +def process_storage_hardware_status(): + raw_json = get_storage_hardware_status() + full_data = json.loads(raw_json) + system = full_data["system"] + output("<<>>") + output("powerConsumption\t%s" % (system["powerConsumption"])) + ctls = full_data["ctls"] + output("<<>>") + output("location\tstatus\ttemperature\ttemperatureStatus\tcharge") + for ctl in ctls: + output("%s\t%s\t%s\t%s\t%s" % (ctl["location"], ctl["status"], ctl["temperature"], ctl["temperatureStatus"], + ctl["charge"])) + + cachememories = full_data["cacheMemories"] + output("<<>>") + output("location\tstatus\tcacheSize") + for cachemem in cachememories: + output("%s\t%s\t%s" % (cachemem["location"], cachemem["status"], cachemem["cacheSize"])) + + channelsboards = full_data["chbs"] + output("<<>>") + output("location\tstatus\ttype") + for channelboard in channelsboards: + output("%s\t%s\t%s" % (channelboard["location"], channelboard["status"], channelboard["type"])) + + cacheflashmemories = full_data["cacheFlashMemories"] + output("<<>>") + output("location\tstatus\ttype") + for cacheflashmemory in cacheflashmemories: + output("%s\t%s\t%s" % (cacheflashmemory["location"], cacheflashmemory["status"], cacheflashmemory["type"])) + + disk_boards = full_data["dkbs"] + output("<<>>") + output("location\tstatus\ttype") + for dkb in disk_boards: + output("%s\t%s\t%s" % (dkb["location"], dkb["status"], dkb["type"])) + + sfps = full_data["sfps"] + output("<<>>") + output("portId\tstatus\ttype\tspeed\tportCondition") + for sfp in sfps: + output("%s\t%s\t%s\t%s\t%s" % (sfp["portId"], sfp["status"], sfp["type"], sfp["speed"], sfp["portCondition"])) + + backup_modules = full_data["bkmfs"] + output("<<>>") + output("location\tstatus\tbat_location\tbat_status\tbat_life") + for backup_module in backup_modules: + if backup_module["batteries"]: + battery = backup_module["batteries"][0] + output("%s\t%s\t%s\t%s\t%s" % (backup_module["location"], backup_module["status"], + battery["location"], + battery["status"], + battery["life"])) + else: + output("%s\t%s\t\t\t" % (backup_module["location"], backup_module["status"])) + + driveboxes = full_data["driveBoxes"] + output("<<>>") + output("drivebox_location\tdrive_location\tdrive_status\tdrive_recomend_Replacement") + for drivebox in driveboxes: + drives=drivebox["drives"] + for drive in drives: + output("%s\t%s\t%s\t%s" % (drivebox["location"], drive["location"], drive["status"], + drive["recomendReplacement"])) + + output("<<>>") + output("drivebox_location\tenc_location\tenc_status") + for drivebox in driveboxes: + encs=drivebox["encs"] + for enc in encs: + output("%s\t%s\t%s" % (drivebox["location"], enc["location"], enc["status"] )) + + output("<<>>") + output("drivebox_location\tdbps_location\tdbps_status") + for drivebox in driveboxes: + dbps=drivebox["dbps"] + for power_supply in dbps: + output("%s\t%s\t%s" % (drivebox["location"], power_supply["location"], power_supply["status"] )) + +def process_storage_parity_groups(): + output("<<>>") + raw_json = get_storage_parity_groups() + full_data = json.loads(raw_json) + data = full_data["data"] + output("parityGroupId\tnumOfLdevs\tusedCapacityRate\tclprId\tavailableVolumeCapacity\t" + "totalCapacity\tphysicalCapacity") + for parity_group in data: + output("%s\t%s\t%s\t%s\t%s\t%s\t%s" % (parity_group["parityGroupId"], parity_group["numOfLdevs"], + parity_group["usedCapacityRate"], parity_group["clprId"], + parity_group["availableVolumeCapacity"], parity_group["totalCapacity"], + parity_group["physicalCapacity"] )) + + +def process_storage_ldevs(): + output("<<>>") + raw_json = get_storage_ldevs() + full_data = json.loads(raw_json) + data = full_data["data"] + output("ldevId\tclprId\tbyteFormatCapacity\tblockCapacity\t" + "label\tstatus") + for ldev in data: + output("%s\t%s\t%s\t%s\t%s\t%s" % (ldev["ldevId"], ldev["clprId"], ldev["byteFormatCapacity"], + ldev["blockCapacity"], ldev["label"], ldev["status"])) + + +def process_storage_clprs(): + output("<<>>") + raw_json = get_storage_clprs() + full_data = json.loads(raw_json) + data = full_data["data"] + output("clprId\tcacheMemoryCapacity\tcacheMemoryUsedCapacity\twritePendingDataCapacity\t" + "writePendingDataCapacity\tcacheUsageRate") + for clpr in data: + output("%s\t%s\t%s\t%s\t%s" % (clpr["clprId"], clpr["cacheMemoryCapacity"], clpr["cacheMemoryUsedCapacity"], + clpr["writePendingDataCapacity"], clpr["cacheUsageRate"])) + + +def process_storage_pools (): + output("<<>>") + raw_json = get_storage_pools() + full_data = json.loads(raw_json) + data = full_data["data"] + output("poolID\tpoolType\tpoolName\ttotalPhysicalCapacity\ttotalPoolCapacity\tavailableVolumeCapacity\tusedCapacityRate\tpoolStatus") + for pool in data: + output("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s" % (pool["poolId"], pool["poolType"], pool["poolName"], + pool["totalPhysicalCapacity"], pool["totalPoolCapacity"], + pool["availableVolumeCapacity"], pool["usedCapacityRate"], + pool["poolStatus"],)) + + +def process_storage_info(): + output("<<>>") + raw_json = get_storage_info() + data = json.loads(raw_json) + output("%s\t%s\t%s\t%s" % (data["serialNumber"], data["storageDeviceId"], data["dkcMicroVersion"], data["model"])) + +def main(): + try: + process_storage_info() + process_storage_pools() + process_storage_clprs() + process_storage_ldevs() + process_storage_parity_groups() + process_storage_hardware_status() + sys.stdout.write("\n".join(output_lines) + "\n") + except Exception as e: + sys.stderr.write("Connection error: %s" % e) + sys.exit(1) + + +storage_info = """{ + "storageDeviceId": "666666666666", + "model": "VSP G700", + "serialNumber": 666666, + "ctl1Ip": "192.168.223.69", + "ctl2Ip": "192.168.223.70", + "dkcMicroVersion": "88-04-03/00", + "communicationModes": [ + { + "communicationMode": "lanConnectionMode" + } + ], + "isSecure": true +}""" + +storage_clprs="""{ + "data": [ + { + "clprId": 0, + "clprName": "CLPR0", + "cacheMemoryCapacity": 924672, + "cacheMemoryUsedCapacity": 901454, + "writePendingDataCapacity": 44959, + "sideFilesCapacity": 0, + "cacheUsageRate": 99, + "writePendingDataRate": 5, + "sideFilesUsageRate": 0 + } + ] +}""" + + +storage_hardware_status = """{ + "system": { + "powerConsumption": 1357 + }, + "ctls": [ + { + "location": "CTL1", + "status": "Normal", + "temperature": 23, + "temperatureStatus": "Normal", + "charge": 100, + "type": "-" + }, + { + "location": "CTL2", + "status": "Normal", + "temperature": 23, + "temperatureStatus": "Normal", + "charge": 100, + "type": "-" + } + ], + "cacheMemories": [ + { + "location": "CTL1 CMG0", + "status": "Normal", + "cacheSize": 256 + }, + { + "location": "CTL1 CMG1", + "status": "Normal", + "cacheSize": 256 + }, + { + "location": "CTL2 CMG0", + "status": "Normal", + "cacheSize": 256 + }, + { + "location": "CTL2 CMG1", + "status": "Normal", + "cacheSize": 256 + } + ], + "chbs": [ + { + "location": "CHB-1A", + "status": "Normal", + "type": "32G Ready 4Port FC" + }, + { + "location": "CHB-1B", + "status": "Normal", + "type": "32G Ready 4Port FC" + }, + { + "location": "CHB-2A", + "status": "Normal", + "type": "32G Ready 4Port FC" + }, + { + "location": "CHB-2B", + "status": "Normal", + "type": "32G Ready 4Port FC" + } + ], + "cacheFlashMemories": [ + { + "location": "CFM-10", + "status": "Normal", + "type": "BM45" + }, + { + "location": "CFM-11", + "status": "Normal", + "type": "BM45" + }, + { + "location": "CFM-20", + "status": "Normal", + "type": "BM45" + }, + { + "location": "CFM-21", + "status": "Normal", + "type": "BM45" + } + ], + "dkbs": [ + { + "location": "DKB-1G", + "status": "Normal", + "type": "Disk Board" + }, + { + "location": "DKB-1H", + "status": "Normal", + "type": "Disk Board" + }, + { + "location": "DKB-2G", + "status": "Normal", + "type": "Disk Board" + }, + { + "location": "DKB-2H", + "status": "Normal", + "type": "Disk Board" + } + ], + "lanbs": [ + { + "location": "LAN1", + "status": "Normal" + }, + { + "location": "LAN2", + "status": "Normal" + } + ], + "sfps": [ + { + "portId": "1A", + "status": "Normal", + "type": "Short Wave", + "speed": "16 Gbps", + "portCondition": "Available (Connected)" + }, + { + "portId": "3A", + "status": "Normal", + "type": "Short Wave", + "speed": "16 Gbps", + "portCondition": "Available (Connected)" + }, + { + "portId": "5A", + "status": "Normal", + "type": "Short Wave", + "speed": "16 Gbps", + "portCondition": "Available (Connected)" + }, + { + "portId": "7A", + "status": "Normal", + "type": "Short Wave", + "speed": "16 Gbps", + "portCondition": "Available (Connected)" + }, + { + "portId": "1B", + "status": "Normal", + "type": "Short Wave", + "speed": "16 Gbps", + "portCondition": "Available (Connected)" + }, + { + "portId": "3B", + "status": "Normal", + "type": "Short Wave", + "speed": "16 Gbps", + "portCondition": "Available (Connected)" + }, + { + "portId": "5B", + "status": "Normal", + "type": "Short Wave", + "speed": "16 Gbps", + "portCondition": "Available (Connected)" + }, + { + "portId": "7B", + "status": "Normal", + "type": "Short Wave", + "speed": "16 Gbps", + "portCondition": "Available (Connected)" + }, + { + "portId": "2A", + "status": "Normal", + "type": "Short Wave", + "speed": "16 Gbps", + "portCondition": "Available (Connected)" + }, + { + "portId": "4A", + "status": "Normal", + "type": "Short Wave", + "speed": "16 Gbps", + "portCondition": "Available (Connected)" + }, + { + "portId": "6A", + "status": "Normal", + "type": "Short Wave", + "speed": "16 Gbps", + "portCondition": "Available (Connected)" + }, + { + "portId": "8A", + "status": "Normal", + "type": "Short Wave", + "speed": "16 Gbps", + "portCondition": "Available (Connected)" + }, + { + "portId": "2B", + "status": "Normal", + "type": "Short Wave", + "speed": "16 Gbps", + "portCondition": "Available (Connected)" + }, + { + "portId": "4B", + "status": "Normal", + "type": "Short Wave", + "speed": "16 Gbps", + "portCondition": "Available (Connected)" + }, + { + "portId": "6B", + "status": "Normal", + "type": "Short Wave", + "speed": "16 Gbps", + "portCondition": "Available (Connected)" + }, + { + "portId": "8B", + "status": "Normal", + "type": "Short Wave", + "speed": "16 Gbps", + "portCondition": "Available (Connected)" + } + ], + "bkmfs": [ + { + "location": "BKMF-10", + "status": "Normal", + "batteries": [] + }, + { + "location": "BKMF-11", + "status": "Normal", + "batteries": [ + { + "location": "BAT-B11", + "status": "Normal", + "life": 90 + } + ] + }, + { + "location": "BKMF-12", + "status": "Normal", + "batteries": [ + { + "location": "BAT-B12", + "status": "Normal", + "life": 90 + } + ] + }, + { + "location": "BKMF-13", + "status": "Normal", + "batteries": [ + { + "location": "BAT-B13", + "status": "Normal", + "life": 90 + } + ] + }, + { + "location": "BKMF-20", + "status": "Normal", + "batteries": [] + }, + { + "location": "BKMF-21", + "status": "Normal", + "batteries": [ + { + "location": "BAT-B21", + "status": "Normal", + "life": 90 + } + ] + }, + { + "location": "BKMF-22", + "status": "Normal", + "batteries": [ + { + "location": "BAT-B22", + "status": "Normal", + "life": 90 + } + ] + }, + { + "location": "BKMF-23", + "status": "Normal", + "batteries": [ + { + "location": "BAT-B23", + "status": "Normal", + "life": 90 + } + ] + } + ], + "dkcpss": [ + { + "location": "DKCPS1", + "status": "Normal" + }, + { + "location": "DKCPS2", + "status": "Normal" + } + ], + "driveBoxes": [ + { + "location": "DB-00", + "type": "DBF", + "led": "OFF", + "drives": [ + { + "location": "HDD00-00", + "modelCode": "NFHAJ-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + }, + { + "location": "HDD00-01", + "modelCode": "NFHAJ-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + }, + { + "location": "HDD00-02", + "modelCode": "NFHAJ-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + }, + { + "location": "HDD00-03", + "modelCode": "NFHAJ-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + }, + { + "location": "HDD00-04", + "modelCode": "NFHAJ-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + }, + { + "location": "HDD00-05", + "modelCode": "NFHAJ-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + }, + { + "location": "HDD00-11", + "modelCode": "NFHAJ-Q13RSS", + "status": "Normal", + "usage": "Spare", + "recomendReplacement": 0 + } + ], + "encs": [ + { + "location": "ENC00-1", + "status": "Normal" + }, + { + "location": "ENC00-2", + "status": "Normal" + } + ], + "dbps": [ + { + "location": "DBPS00-1", + "status": "Normal" + }, + { + "location": "DBPS00-2", + "status": "Normal" + } + ] + }, + { + "location": "DB-01", + "type": "DBF", + "led": "OFF", + "drives": [ + { + "location": "HDD01-00", + "modelCode": "NFHAK-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + }, + { + "location": "HDD01-01", + "modelCode": "NFHAK-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + }, + { + "location": "HDD01-02", + "modelCode": "NFHAK-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + }, + { + "location": "HDD01-03", + "modelCode": "NFHAK-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + }, + { + "location": "HDD01-04", + "modelCode": "NFHAK-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + }, + { + "location": "HDD01-05", + "modelCode": "NFHAK-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + } + ], + "encs": [ + { + "location": "ENC01-1", + "status": "Normal" + }, + { + "location": "ENC01-2", + "status": "Normal" + } + ], + "dbps": [ + { + "location": "DBPS01-1", + "status": "Normal" + }, + { + "location": "DBPS01-2", + "status": "Normal" + } + ] + }, + { + "location": "DB-02", + "type": "DBF", + "led": "OFF", + "drives": [ + { + "location": "HDD02-00", + "modelCode": "NFHAJ-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + }, + { + "location": "HDD02-01", + "modelCode": "NFHAJ-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + }, + { + "location": "HDD02-02", + "modelCode": "NFHAJ-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + }, + { + "location": "HDD02-03", + "modelCode": "NFHAJ-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + }, + { + "location": "HDD02-04", + "modelCode": "NFHAJ-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + }, + { + "location": "HDD02-05", + "modelCode": "NFHAJ-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + } + ], + "encs": [ + { + "location": "ENC02-1", + "status": "Normal" + }, + { + "location": "ENC02-2", + "status": "Normal" + } + ], + "dbps": [ + { + "location": "DBPS02-1", + "status": "Normal" + }, + { + "location": "DBPS02-2", + "status": "Normal" + } + ] + }, + { + "location": "DB-03", + "type": "DBF", + "led": "OFF", + "drives": [ + { + "location": "HDD03-00", + "modelCode": "NFHAK-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + }, + { + "location": "HDD03-01", + "modelCode": "NFHAK-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + }, + { + "location": "HDD03-02", + "modelCode": "NFHAK-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + }, + { + "location": "HDD03-03", + "modelCode": "NFHAK-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + }, + { + "location": "HDD03-04", + "modelCode": "NFHAK-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + }, + { + "location": "HDD03-05", + "modelCode": "NFHAK-Q13RSS", + "status": "Normal", + "usage": "DATA", + "recomendReplacement": 0 + } + ], + "encs": [ + { + "location": "ENC03-1", + "status": "Normal" + }, + { + "location": "ENC03-2", + "status": "Normal" + } + ], + "dbps": [ + { + "location": "DBPS03-1", + "status": "Normal" + }, + { + "location": "DBPS03-2", + "status": "Normal" + } + ] + } + ], + "fans": [], + "upsMode": "Standard Mode", + "pecbs": [], + "chbb": {}, + "pcps": [], + "swpks": [], + "chbbfans": [], + "chbbpss": [] +}""" + + +storage_pools = """ +{ + "data" : [ { + "poolId" : 0, + "poolStatus" : "POLN", + "usedCapacityRate" : 47, + "usedPhysicalCapacityRate" : 47, + "poolName" : "RAID6_HDT_01", + "availableVolumeCapacity" : 208964826, + "availablePhysicalVolumeCapacity" : 208964826, + "totalPoolCapacity" : 397630296, + "totalPhysicalCapacity" : 397630296, + "numOfLdevs" : 136, + "firstLdevId" : 3, + "warningThreshold" : 80, + "depletionThreshold" : 90, + "virtualVolumeCapacityRate" : -1, + "isMainframe" : false, + "isShrinking" : true, + "locatedVolumeCount" : 242, + "totalLocatedCapacity" : 234976098, + "blockingMode" : "NB", + "totalReservedCapacity" : 0, + "reservedVolumeCount" : 0, + "poolActionMode" : "AUT", + "tierOperationStatus" : "MON", + "dat" : "VAL", + "poolType" : "RT", + "monitoringMode" : "CM", + "tiers" : [ { + "tierNumber" : 1, + "tierLevelRange" : "00000001", + "tierDeltaRange" : "00000005", + "tierUsedCapacity" : 31524696, + "tierTotalCapacity" : 37087848, + "tablespaceRate" : 10, + "performanceRate" : 4, + "progressOfReplacing" : 100, + "bufferRate" : 5 + }, { + "tierNumber" : 2, + "tierLevelRange" : "00000000", + "tierDeltaRange" : "00000005", + "tierUsedCapacity" : 98679336, + "tierTotalCapacity" : 116093208, + "tablespaceRate" : 10, + "performanceRate" : 12, + "progressOfReplacing" : 100, + "bufferRate" : 5 + }, { + "tierNumber" : 3, + "tierLevelRange" : "00000000", + "tierDeltaRange" : "00000000", + "tierUsedCapacity" : 58461480, + "tierTotalCapacity" : 244449240, + "tablespaceRate" : 10, + "performanceRate" : 62, + "progressOfReplacing" : 100, + "bufferRate" : 5 + } ], + "dataReductionAccelerateCompCapacity" : 0, + "dataReductionAccelerateCompRate" : 0, + "compressionRate" : 0, + "dataReductionAccelerateCompIncludingSystemData" : { + "isReductionCapacityAvailable" : true, + "reductionCapacity" : 0, + "isReductionRateAvailable" : true, + "reductionRate" : 0 + }, + "capacitiesExcludingSystemData" : { + "usedVirtualVolumeCapacity" : 386386968576 + } + }, { + "poolId" : 1, + "poolStatus" : "POLN", + "usedCapacityRate" : 0, + "usedPhysicalCapacityRate" : 0, + "snapshotCount" : 0, + "poolName" : "THIN_IMAGE_POOL", + "availableVolumeCapacity" : 46453344, + "availablePhysicalVolumeCapacity" : 46453344, + "totalPoolCapacity" : 46453344, + "totalPhysicalCapacity" : 46453344, + "numOfLdevs" : 16, + "firstLdevId" : 22, + "warningThreshold" : 80, + "virtualVolumeCapacityRate" : -1, + "isMainframe" : false, + "isShrinking" : false, + "poolType" : "HTI", + "dataReductionAccelerateCompCapacity" : 0, + "dataReductionAccelerateCompRate" : 0, + "compressionRate" : 0, + "dataReductionAccelerateCompIncludingSystemData" : { + "isReductionCapacityAvailable" : true, + "reductionCapacity" : 0, + "isReductionRateAvailable" : false + }, + "capacitiesExcludingSystemData" : { + "usedVirtualVolumeCapacity" : 0 + } + } ] +}""" + +storage_ldevs = """ { + "data" : [ { + "ldevId" : 0, + "clprId" : 0, + "emulationType" : "OPEN-V-CVS", + "byteFormatCapacity" : "500.00 G", + "blockCapacity" : 1048576000, + "numOfPorts" : 4, + "ports" : [ { + "portId" : "CL2-B", + "hostGroupNumber" : 1, + "hostGroupName" : "demosrv.example.com", + "lun" : 1 + }, { + "portId" : "CL1-B", + "hostGroupNumber" : 1, + "hostGroupName" : "demosrv.example.com", + "lun" : 1 + }, { + "portId" : "CL2-A", + "hostGroupNumber" : 1, + "hostGroupName" : "demosrv.example.com", + "lun" : 1 + }, { + "portId" : "CL1-A", + "hostGroupNumber" : 1, + "hostGroupName" : "demosrv.example.com", + "lun" : 1 + } ], + "attributes" : [ "CVS", "HDP" ], + "label" : "vg_test0", + "status" : "NML", + "mpBladeId" : 0, + "ssid" : "0004", + "poolId" : 0, + "numOfUsedBlock" : 0, + "isFullAllocationEnabled" : false, + "resourceGroupId" : 0, + "dataReductionStatus" : "DISABLED", + "dataReductionMode" : "disabled", + "isAluaEnabled" : false + }, { + "ldevId" : 1, + "clprId" : 0, + "emulationType" : "OPEN-V-CVS", + "byteFormatCapacity" : "400.00 G", + "blockCapacity" : 838860800, + "numOfPorts" : 4, + "ports" : [ { + "portId" : "CL2-B", + "hostGroupNumber" : 1, + "hostGroupName" : "demosrv.example.com", + "lun" : 2 + }, { + "portId" : "CL1-B", + "hostGroupNumber" : 1, + "hostGroupName" : "demosrv.example.com", + "lun" : 2 + }, { + "portId" : "CL2-A", + "hostGroupNumber" : 1, + "hostGroupName" : "demosrv.example.com", + "lun" : 2 + }, { + "portId" : "CL1-A", + "hostGroupNumber" : 1, + "hostGroupName" : "demosrv.example.com", + "lun" : 2 + } ], + "attributes" : [ "CVS", "HDP" ], + "label" : "vg_test1", + "status" : "NML", + "mpBladeId" : 1, + "ssid" : "0004", + "poolId" : 0, + "numOfUsedBlock" : 0, + "isFullAllocationEnabled" : false, + "resourceGroupId" : 0, + "dataReductionStatus" : "DISABLED", + "dataReductionMode" : "disabled", + "isAluaEnabled" : false + }, { + "ldevId" : 2, + "clprId" : 0, + "emulationType" : "OPEN-V-CVS", + "byteFormatCapacity" : "10.00 T", + "blockCapacity" : 21474836480, + "numOfPorts" : 52, + "ports" : [ { + "portId" : "CL2-B", + "hostGroupNumber" : 2, + "hostGroupName" : "demosrv0803", + "lun" : 6 + }, { + "portId" : "CL1-B", + "hostGroupNumber" : 2, + "hostGroupName" : "demosrv0803", + "lun" : 6 + }, { + "portId" : "CL2-A", + "hostGroupNumber" : 2, + "hostGroupName" : "demosrv0803", + "lun" : 6 + }, { + "portId" : "CL1-A", + "hostGroupNumber" : 2, + "hostGroupName" : "demosrv0803", + "lun" : 6 + } ], + "attributes" : [ "CVS", "HDP" ], + "label" : "vmware_legacy_ssd0", + "status" : "NML", + "mpBladeId" : 0, + "ssid" : "0004", + "poolId" : 0, + "numOfUsedBlock" : 9604460544, + "isFullAllocationEnabled" : false, + "resourceGroupId" : 0, + "dataReductionStatus" : "DISABLED", + "dataReductionMode" : "disabled", + "isAluaEnabled" : false + }, { + "ldevId" : 3, + "clprId" : 0, + "emulationType" : "OPEN-V-CVS", + "byteFormatCapacity" : "10.00 T", + "blockCapacity" : 21474836480, + "numOfPorts" : 52, + "ports" : [ { + "portId" : "CL2-B", + "hostGroupNumber" : 2, + "hostGroupName" : "demosrv0803", + "lun" : 5 + }, { + "portId" : "CL1-B", + "hostGroupNumber" : 2, + "hostGroupName" : "demosrv0803", + "lun" : 5 + }, { + "portId" : "CL2-A", + "hostGroupNumber" : 2, + "hostGroupName" : "demosrv0803", + "lun" : 5 + }, { + "portId" : "CL1-A", + "hostGroupNumber" : 2, + "hostGroupName" : "demosrv0803", + "lun" : 5 + } ], + "attributes" : [ "CVS", "HDP" ], + "label" : "vmware_legacy_ssd1", + "status" : "NML", + "mpBladeId" : 1, + "ssid" : "0004", + "poolId" : 0, + "numOfUsedBlock" : 7754084352, + "isFullAllocationEnabled" : false, + "resourceGroupId" : 0, + "dataReductionStatus" : "DISABLED", + "dataReductionMode" : "disabled", + "isAluaEnabled" : false + }, { + "ldevId" : 4, + "clprId" : 0, + "emulationType" : "OPEN-V-CVS", + "byteFormatCapacity" : "5.00 T", + "blockCapacity" : 10737418240, + "numOfPorts" : 52, + "ports" : [ { + "portId" : "CL2-B", + "hostGroupNumber" : 2, + "hostGroupName" : "demosrv0803", + "lun" : 4 + }, { + "portId" : "CL1-B", + "hostGroupNumber" : 2, + "hostGroupName" : "demosrv0803", + "lun" : 4 + }, { + "portId" : "CL2-A", + "hostGroupNumber" : 2, + "hostGroupName" : "demosrv0803", + "lun" : 4 + }, { + "portId" : "CL1-A", + "hostGroupNumber" : 2, + "hostGroupName" : "demosrv0803", + "lun" : 4 + } ], + "attributes" : [ "CVS", "HDP" ], + "label" : "vmware_legacy_ssd2", + "status" : "NML", + "mpBladeId" : 0, + "ssid" : "0004", + "poolId" : 0, + "numOfUsedBlock" : 5074944, + "isFullAllocationEnabled" : false, + "resourceGroupId" : 0, + "dataReductionStatus" : "DISABLED", + "dataReductionMode" : "disabled", + "isAluaEnabled" : false + }, { + "ldevId" : 5, + "clprId" : 0, + "emulationType" : "OPEN-V-CVS", + "byteFormatCapacity" : "5.00 T", + "blockCapacity" : 10737418240, + "numOfPorts" : 52, + "ports" : [ { + "portId" : "CL2-B", + "hostGroupNumber" : 2, + "hostGroupName" : "demosrv0803", + "lun" : 3 + }, { + "portId" : "CL1-B", + "hostGroupNumber" : 2, + "hostGroupName" : "demosrv0803", + "lun" : 3 + }, { + "portId" : "CL2-A", + "hostGroupNumber" : 2, + "hostGroupName" : "demosrv0803", + "lun" : 3 + }, { + "portId" : "CL1-A", + "hostGroupNumber" : 2, + "hostGroupName" : "demosrv0803", + "lun" : 3 + } ], + "attributes" : [ "CVS", "HDP" ], + "label" : "vmware_legacy_ssd3", + "status" : "NML", + "mpBladeId" : 1, + "ssid" : "0004", + "poolId" : 0, + "numOfUsedBlock" : 1014042624, + "isFullAllocationEnabled" : false, + "resourceGroupId" : 0, + "dataReductionStatus" : "DISABLED", + "dataReductionMode" : "disabled", + "isAluaEnabled" : false + } ] +}""" + +storage_parity_groups = """ { + "data": [ + { + "parityGroupId": "1-1", + "numOfLdevs": 26, + "usedCapacityRate": 44, + "availableVolumeCapacity": 87245, + "raidLevel": "RAID5", + "raidType": "3D+1P", + "clprId": 0, + "driveType": "NFHAF-Q13RSS", + "driveTypeName": "SSD(FMC)", + "totalCapacity": 157286, + "physicalCapacity": 39321, + "isAcceleratedCompressionEnabled": true, + "availableVolumeCapacityInKB": 91483790592 + }, + { + "parityGroupId": "1-2", + "numOfLdevs": 51, + "usedCapacityRate": 93, + "availableVolumeCapacity": 10448, + "raidLevel": "RAID5", + "raidType": "3D+1P", + "clprId": 0, + "driveType": "NFHAF-Q13RSS", + "driveTypeName": "SSD(FMC)", + "totalCapacity": 157286, + "physicalCapacity": 39321, + "isAcceleratedCompressionEnabled": true, + "availableVolumeCapacityInKB": 10955611392 + }, + { + "parityGroupId": "1-3", + "numOfLdevs": 25, + "usedCapacityRate": 42, + "availableVolumeCapacity": 90317, + "raidLevel": "RAID5", + "raidType": "3D+1P", + "clprId": 0, + "driveType": "NFHAF-Q13RSS", + "driveTypeName": "SSD(FMC)", + "totalCapacity": 157286, + "physicalCapacity": 39321, + "isAcceleratedCompressionEnabled": true, + "availableVolumeCapacityInKB": 94704917760 + }, + { + "parityGroupId": "1-4", + "numOfLdevs": 52, + "usedCapacityRate": 95, + "availableVolumeCapacity": 7376, + "raidLevel": "RAID5", + "raidType": "3D+1P", + "clprId": 0, + "driveType": "NFHAF-Q13RSS", + "driveTypeName": "SSD(FMC)", + "totalCapacity": 157286, + "physicalCapacity": 39321, + "isAcceleratedCompressionEnabled": true, + "availableVolumeCapacityInKB": 7734484224 + }, + { + "parityGroupId": "1-5", + "numOfLdevs": 54, + "usedCapacityRate": 99, + "availableVolumeCapacity": 1232, + "raidLevel": "RAID5", + "raidType": "3D+1P", + "clprId": 0, + "driveType": "NFHAF-Q13RSS", + "driveTypeName": "SSD(FMC)", + "totalCapacity": 157286, + "physicalCapacity": 39321, + "isAcceleratedCompressionEnabled": true, + "availableVolumeCapacityInKB": 1292229888 + }, + { + "parityGroupId": "1-6", + "numOfLdevs": 25, + "usedCapacityRate": 42, + "availableVolumeCapacity": 90317, + "raidLevel": "RAID5", + "raidType": "3D+1P", + "clprId": 0, + "driveType": "NFHAF-Q13RSS", + "driveTypeName": "SSD(FMC)", + "totalCapacity": 157286, + "physicalCapacity": 39321, + "isAcceleratedCompressionEnabled": true, + "availableVolumeCapacityInKB": 94704917760 + } + ] +}""" +if __name__ == "__main__": + main() diff --git a/hitachi-vsp/share/check_mk/checks/agent_hitachivsp b/hitachi-vsp/share/check_mk/checks/agent_hitachivsp new file mode 100644 index 0000000..99ad1e2 --- /dev/null +++ b/hitachi-vsp/share/check_mk/checks/agent_hitachivsp @@ -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 + diff --git a/hitachi-vsp/share/check_mk/checks/hitachivsp_backup_modules b/hitachi-vsp/share/check_mk/checks/hitachivsp_backup_modules new file mode 100644 index 0000000..bea5bfa --- /dev/null +++ b/hitachi-vsp/share/check_mk/checks/hitachivsp_backup_modules @@ -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 +#<<>> +#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 +} + diff --git a/hitachi-vsp/share/check_mk/checks/hitachivsp_cache_flash_memories b/hitachi-vsp/share/check_mk/checks/hitachivsp_cache_flash_memories new file mode 100644 index 0000000..3b7b2e5 --- /dev/null +++ b/hitachi-vsp/share/check_mk/checks/hitachivsp_cache_flash_memories @@ -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 +#<<>> +#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 +} + diff --git a/hitachi-vsp/share/check_mk/checks/hitachivsp_cache_memories b/hitachi-vsp/share/check_mk/checks/hitachivsp_cache_memories new file mode 100644 index 0000000..2d15f5f --- /dev/null +++ b/hitachi-vsp/share/check_mk/checks/hitachivsp_cache_memories @@ -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 +#<<>> +#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 +} + diff --git a/hitachi-vsp/share/check_mk/checks/hitachivsp_channel_board b/hitachi-vsp/share/check_mk/checks/hitachivsp_channel_board new file mode 100644 index 0000000..f0c434f --- /dev/null +++ b/hitachi-vsp/share/check_mk/checks/hitachivsp_channel_board @@ -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 +#<<>> +#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 +} + diff --git a/hitachi-vsp/share/check_mk/checks/hitachivsp_clprs b/hitachi-vsp/share/check_mk/checks/hitachivsp_clprs new file mode 100644 index 0000000..822cfd3 --- /dev/null +++ b/hitachi-vsp/share/check_mk/checks/hitachivsp_clprs @@ -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 +#<<>> +#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 +} + diff --git a/hitachi-vsp/share/check_mk/checks/hitachivsp_ctls b/hitachi-vsp/share/check_mk/checks/hitachivsp_ctls new file mode 100644 index 0000000..5f11725 --- /dev/null +++ b/hitachi-vsp/share/check_mk/checks/hitachivsp_ctls @@ -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 +#<<>> +#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 +} + diff --git a/hitachi-vsp/share/check_mk/checks/hitachivsp_disk_boards b/hitachi-vsp/share/check_mk/checks/hitachivsp_disk_boards new file mode 100644 index 0000000..5fb8040 --- /dev/null +++ b/hitachi-vsp/share/check_mk/checks/hitachivsp_disk_boards @@ -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 +#<<>> +#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 +} + diff --git a/hitachi-vsp/share/check_mk/checks/hitachivsp_drive_boxes_dbps b/hitachi-vsp/share/check_mk/checks/hitachivsp_drive_boxes_dbps new file mode 100644 index 0000000..95c1033 --- /dev/null +++ b/hitachi-vsp/share/check_mk/checks/hitachivsp_drive_boxes_dbps @@ -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 +#<<>> +#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 +} + diff --git a/hitachi-vsp/share/check_mk/checks/hitachivsp_drive_boxes_drives b/hitachi-vsp/share/check_mk/checks/hitachivsp_drive_boxes_drives new file mode 100644 index 0000000..c29a253 --- /dev/null +++ b/hitachi-vsp/share/check_mk/checks/hitachivsp_drive_boxes_drives @@ -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 +#<<>> +#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 +} + diff --git a/hitachi-vsp/share/check_mk/checks/hitachivsp_drive_boxes_enc b/hitachi-vsp/share/check_mk/checks/hitachivsp_drive_boxes_enc new file mode 100644 index 0000000..04d8678 --- /dev/null +++ b/hitachi-vsp/share/check_mk/checks/hitachivsp_drive_boxes_enc @@ -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 +#<<>> +#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 +} + diff --git a/hitachi-vsp/share/check_mk/checks/hitachivsp_info b/hitachi-vsp/share/check_mk/checks/hitachivsp_info new file mode 100644 index 0000000..8923395 --- /dev/null +++ b/hitachi-vsp/share/check_mk/checks/hitachivsp_info @@ -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 +#<<>> +#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', +} diff --git a/hitachi-vsp/share/check_mk/checks/hitachivsp_ldevs b/hitachi-vsp/share/check_mk/checks/hitachivsp_ldevs new file mode 100644 index 0000000..2c71d06 --- /dev/null +++ b/hitachi-vsp/share/check_mk/checks/hitachivsp_ldevs @@ -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 +#<<>> +#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 +} + diff --git a/hitachi-vsp/share/check_mk/checks/hitachivsp_parity_groups b/hitachi-vsp/share/check_mk/checks/hitachivsp_parity_groups new file mode 100644 index 0000000..3eefdd8 --- /dev/null +++ b/hitachi-vsp/share/check_mk/checks/hitachivsp_parity_groups @@ -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 +#<<>> +#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 +} + diff --git a/hitachi-vsp/share/check_mk/checks/hitachivsp_pools b/hitachi-vsp/share/check_mk/checks/hitachivsp_pools new file mode 100644 index 0000000..b22ab07 --- /dev/null +++ b/hitachi-vsp/share/check_mk/checks/hitachivsp_pools @@ -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 +#<<>> +#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 +} diff --git a/hitachi-vsp/share/check_mk/checks/hitachivsp_powerConsumption b/hitachi-vsp/share/check_mk/checks/hitachivsp_powerConsumption new file mode 100644 index 0000000..334dc60 --- /dev/null +++ b/hitachi-vsp/share/check_mk/checks/hitachivsp_powerConsumption @@ -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 +#<<>> +#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 +} + diff --git a/hitachi-vsp/share/check_mk/checks/hitachivsp_sfps b/hitachi-vsp/share/check_mk/checks/hitachivsp_sfps new file mode 100644 index 0000000..79cee5b --- /dev/null +++ b/hitachi-vsp/share/check_mk/checks/hitachivsp_sfps @@ -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 +#<<>> +#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 +} + diff --git a/juniper b/juniper new file mode 160000 index 0000000..96001a4 --- /dev/null +++ b/juniper @@ -0,0 +1 @@ +Subproject commit 96001a48bf6b60347e7370b5b34b7368fd2973e9