ImTheLucKyOne / check_mk_emcunity

Check_MK Extensions for Dell EMC Unity Storages
GNU General Public License v3.0
5 stars 8 forks source link

what does uemccli run as #10

Closed cadencep45 closed 5 years ago

cadencep45 commented 5 years ago

1 What account does the uemcli queries run as 2 from looking at

more agent_emcunity

#!/usr/bin/env python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# |             ____ _               _        __  __ _  __           |
# |            / ___| |__   ___  ___| | __   |  \/  | |/ /           |
# |           | |   | '_ \ / _ \/ __| |/ /   | |\/| | ' /            |
# |           | |___| | | |  __/ (__|   <    | |  | | . \            |
# |            \____|_| |_|\___|\___|_|\_\___|_|  |_|_|\_\           |
# |                                                                  |
# | Copyright Mathias Kettner 2014             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.
#
# Written/Edited by Philipp Näther
# philipp.naether@stadt-meissen.de

import getopt, os, sys, re, subprocess

def usage():
    sys.stderr.write("""Check_MK emcunity Agent

USAGE: agent_emcunity [OPTIONS] HOST
       agent_emcunity -h

ARGUMENTS:
   HOST                               Hostname or IP address of the target SP

OPTIONS:
  -h, --help                          Show this help message and exit
  -u USER, --user USER                Set the admin user
  -p PASSWORD, --password PASSWORD    Set the password for admin user
  --debug           

it seems even though we have cached the password in the emc bitlocker and can query the unity application passwordless we are using the username and password explicitly for each call. I this correct ( as I working back through the code so could well be wrong )

ImTheLucKyOne commented 5 years ago

The way it is designed as a whole (with the WATO rule) is meant to work only with username/password combination. As stated in the readme, you have to set the datasource program WATO rule and define the user/password there. With this given credentials the uemcli is called by the agent.

cadencep45 commented 5 years ago

I had the wrong tree installed, working now, i.e.

[cid:image001.png@01D4AC21.CBC96A20]

One thing I am confused about is username and password.

I created an operator read-only account for this service, this words fine.

However I would really like to use the fact once you have saved the user login into the local ‘lockbox’, you should be able to do passwordless login this removing the need for using username/password for check_mk queries. The reason I am saying this is to avoid a password being captured in a packet sniff.

Ps its damn good.

-Bob

From: Philipp N. [mailto:notifications@github.com] Sent: 14 January 2019 14:56 To: ImTheLucKyOne/check_mk_emcunity check_mk_emcunity@noreply.github.com Cc: Flynn, Bob Bob.Flynn@msx.bala.susq.com; Author author@noreply.github.com Subject: Re: [ImTheLucKyOne/check_mk_emcunity] what does uemccli run as (#10)

The way it is designed as a whole (with the WATO rule) is meant to work only with username/password combination. As stated in the readme, you have to set the datasource program WATO rule and define the user/password there. With this given credentials the uemcli is called by the agent.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ImTheLucKyOne/check_mk_emcunity/issues/10#issuecomment-454032451, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AsVb8D6S4VbGx8iwluqVrs3akaY3693Bks5vDJpsgaJpZM4Z1eu2.


IMPORTANT: The information contained in this email and/or its attachments is confidential and may only be used by the person to whom it is addressed. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this email and/or any attachment by an unintended recipient is strictly prohibited. Neither this email nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this email and/or any of its attachments are free of viruses. Any views expressed are personal to the author, except where specifically stated to be the views of SIG. SIG accepts no liability of any kind either for any errors arising as a result of electronic transmission or for any loss or damage which may be sustained by any person as a result of this email and/or its attachments being communicated to any person other than the intended recipient.

Susquehanna International Group Limited is a private company limited by shares and registered in Ireland. Registration No.: 445356. Registered Office Address: International Centre Memorial Road IFSC Dublin 1 Ireland

Susquehanna International Securities Limited is a private company limited by shares and registered in Ireland. Registration No.: 337946. Registered Office Address: International Centre Memorial Road IFSC Dublin 1 Ireland

Susquehanna International Securities Limited (UK Branch). Registration No.: FC033877

Liffeyview Property Holdings Limited is a private company limited by shares and registered in Ireland. Registration No.: 534083. Registered Office Address: International Centre Memorial Road IFSC Dublin 1 Ireland

Heights Capital Ireland, LLC is a branch registered in Ireland under registration no. 908306 of Heights Capital Ireland, LLC incorporated in Delaware USA under registration no.: 5762692

SAL Trading, LLC is a branch registered in Ireland under registration no. 906667 of SAL Trading, LLC incorporated in Delaware USA under registration no.: 4984826

Susquehanna International Securities Limited is regulated by the Central Bank of Ireland. Susquehanna International Securities Limited (UK Branch) is regulated by the Financial Conduct Authority for conduct of business rules

If this email relates to investment services and activities as defined in Directive 2014/65/EU of the European Parliament and of the Council of 15 May 2014 on Markets in Financial Instruments (MiFID II), you are receiving the email from Susquehanna International Securities Limited

ImTheLucKyOne commented 5 years ago

Good point, I will check how this could be integrated the easiest way. I wasn't aware of the functionality to do passwordless login to a EMC device using lockbox.

Could you provide some info about how the uemcli call works with a lockbox installed? Is it just uemcli -d HOST?

cadencep45 commented 5 years ago

Ref

https://community.emc.com/docs/DOC-66387

Example

[root@dubstormgmt8003 unity]# uemcli -d 10.170.95.45 -silent /stor/general/system show 1: Free space = 260917115748352 (237.3T) Used space = 555392958464 (517.2G) Total space = 261472508706816 (237.8T) Compression space saved = 268435456 (256.0M) Compression percent = 0% Compression ratio = 1:1 Data Reduction space saved = 268435456 (256.0M) Data Reduction percent = 0% Data Reduction ratio = 1:1

Here I am querying a unity device at 10.170.95.45 with the stored username/password so I can do the query without an on-the-wire password.

From: Philipp N. [mailto:notifications@github.com] Sent: 14 January 2019 16:17 To: ImTheLucKyOne/check_mk_emcunity check_mk_emcunity@noreply.github.com Cc: Flynn, Bob Bob.Flynn@msx.bala.susq.com; Author author@noreply.github.com Subject: Re: [ImTheLucKyOne/check_mk_emcunity] what does uemccli run as (#10)

Good point, I will check how this could be integrated the easiest way. I wasn't aware of the functionality to do passwordless login to a EMC device using lockbox.

Could you provide some info about how the uemcli call works with a lockbox installed? Is it just uemcli -d HOST?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ImTheLucKyOne/check_mk_emcunity/issues/10#issuecomment-454063390, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AsVb8KAQtgadYAtV4AjQjiaFmIdGD11Pks5vDK2BgaJpZM4Z1eu2.


IMPORTANT: The information contained in this email and/or its attachments is confidential and may only be used by the person to whom it is addressed. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this email and/or any attachment by an unintended recipient is strictly prohibited. Neither this email nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this email and/or any of its attachments are free of viruses. Any views expressed are personal to the author, except where specifically stated to be the views of SIG. SIG accepts no liability of any kind either for any errors arising as a result of electronic transmission or for any loss or damage which may be sustained by any person as a result of this email and/or its attachments being communicated to any person other than the intended recipient.

Susquehanna International Group Limited is a private company limited by shares and registered in Ireland. Registration No.: 445356. Registered Office Address: International Centre Memorial Road IFSC Dublin 1 Ireland

Susquehanna International Securities Limited is a private company limited by shares and registered in Ireland. Registration No.: 337946. Registered Office Address: International Centre Memorial Road IFSC Dublin 1 Ireland

Susquehanna International Securities Limited (UK Branch). Registration No.: FC033877

Liffeyview Property Holdings Limited is a private company limited by shares and registered in Ireland. Registration No.: 534083. Registered Office Address: International Centre Memorial Road IFSC Dublin 1 Ireland

Heights Capital Ireland, LLC is a branch registered in Ireland under registration no. 908306 of Heights Capital Ireland, LLC incorporated in Delaware USA under registration no.: 5762692

SAL Trading, LLC is a branch registered in Ireland under registration no. 906667 of SAL Trading, LLC incorporated in Delaware USA under registration no.: 4984826

Susquehanna International Securities Limited is regulated by the Central Bank of Ireland. Susquehanna International Securities Limited (UK Branch) is regulated by the Financial Conduct Authority for conduct of business rules

If this email relates to investment services and activities as defined in Directive 2014/65/EU of the European Parliament and of the Council of 15 May 2014 on Markets in Financial Instruments (MiFID II), you are receiving the email from Susquehanna International Securities Limited

ImTheLucKyOne commented 5 years ago

Ok I will have a look into this. I am sure it is going to work in a nice way. I will keep you up to date here.

cadencep45 commented 5 years ago

Vielen Dank

From: Philipp N. [mailto:notifications@github.com] Sent: 15 January 2019 14:19 To: ImTheLucKyOne/check_mk_emcunity check_mk_emcunity@noreply.github.com Cc: Flynn, Bob Bob.Flynn@msx.bala.susq.com; Author author@noreply.github.com Subject: Re: [ImTheLucKyOne/check_mk_emcunity] what does uemccli run as (#10)

Ok I will have a look into this. I am sure it is going to work in a nice way. I will keep you up to date here.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ImTheLucKyOne/check_mk_emcunity/issues/10#issuecomment-454407240, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AsVb8CyVieNI3zRci4qOZfxSFSIg7z6gks5vDeM6gaJpZM4Z1eu2.


IMPORTANT: The information contained in this email and/or its attachments is confidential and may only be used by the person to whom it is addressed. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this email and/or any attachment by an unintended recipient is strictly prohibited. Neither this email nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this email and/or any of its attachments are free of viruses. Any views expressed are personal to the author, except where specifically stated to be the views of SIG. SIG accepts no liability of any kind either for any errors arising as a result of electronic transmission or for any loss or damage which may be sustained by any person as a result of this email and/or its attachments being communicated to any person other than the intended recipient.

Susquehanna International Group Limited is a private company limited by shares and registered in Ireland. Registration No.: 445356. Registered Office Address: International Centre Memorial Road IFSC Dublin 1 Ireland

Susquehanna International Securities Limited is a private company limited by shares and registered in Ireland. Registration No.: 337946. Registered Office Address: International Centre Memorial Road IFSC Dublin 1 Ireland

Susquehanna International Securities Limited (UK Branch). Registration No.: FC033877

Liffeyview Property Holdings Limited is a private company limited by shares and registered in Ireland. Registration No.: 534083. Registered Office Address: International Centre Memorial Road IFSC Dublin 1 Ireland

Heights Capital Ireland, LLC is a branch registered in Ireland under registration no. 908306 of Heights Capital Ireland, LLC incorporated in Delaware USA under registration no.: 5762692

SAL Trading, LLC is a branch registered in Ireland under registration no. 906667 of SAL Trading, LLC incorporated in Delaware USA under registration no.: 4984826

Susquehanna International Securities Limited is regulated by the Central Bank of Ireland. Susquehanna International Securities Limited (UK Branch) is regulated by the Financial Conduct Authority for conduct of business rules

If this email relates to investment services and activities as defined in Directive 2014/65/EU of the European Parliament and of the Council of 15 May 2014 on Markets in Financial Instruments (MiFID II), you are receiving the email from Susquehanna International Securities Limited

ImTheLucKyOne commented 5 years ago

Ok, please replace the files in your system with the attached files. You have to reopen your existing WATO rule and select the lockbox login value. Please report if it works.

replace.zip

cadencep45 commented 5 years ago

Ok,

I will work with our check_mk admin to test tomorrow.

From: Philipp N. [mailto:notifications@github.com] Sent: 15 January 2019 17:17 To: ImTheLucKyOne/check_mk_emcunity check_mk_emcunity@noreply.github.com Cc: Flynn, Bob Bob.Flynn@msx.bala.susq.com; Author author@noreply.github.com Subject: Re: [ImTheLucKyOne/check_mk_emcunity] what does uemccli run as (#10)

Ok, please replace the files in your system with the attached files. You have to reopen your existing WATO rule and select the lockbox login value. Please report if it works.

replace.ziphttps://github.com/ImTheLucKyOne/check_mk_emcunity/files/2760665/replace.zip

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ImTheLucKyOne/check_mk_emcunity/issues/10#issuecomment-454474387, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AsVb8KyEinoMjGyZp0v8Qg9mjb6RdqmXks5vDg0HgaJpZM4Z1eu2.


IMPORTANT: The information contained in this email and/or its attachments is confidential and may only be used by the person to whom it is addressed. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this email and/or any attachment by an unintended recipient is strictly prohibited. Neither this email nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this email and/or any of its attachments are free of viruses. Any views expressed are personal to the author, except where specifically stated to be the views of SIG. SIG accepts no liability of any kind either for any errors arising as a result of electronic transmission or for any loss or damage which may be sustained by any person as a result of this email and/or its attachments being communicated to any person other than the intended recipient.

Susquehanna International Group Limited is a private company limited by shares and registered in Ireland. Registration No.: 445356. Registered Office Address: International Centre Memorial Road IFSC Dublin 1 Ireland

Susquehanna International Securities Limited is a private company limited by shares and registered in Ireland. Registration No.: 337946. Registered Office Address: International Centre Memorial Road IFSC Dublin 1 Ireland

Susquehanna International Securities Limited (UK Branch). Registration No.: FC033877

Liffeyview Property Holdings Limited is a private company limited by shares and registered in Ireland. Registration No.: 534083. Registered Office Address: International Centre Memorial Road IFSC Dublin 1 Ireland

Heights Capital Ireland, LLC is a branch registered in Ireland under registration no. 908306 of Heights Capital Ireland, LLC incorporated in Delaware USA under registration no.: 5762692

SAL Trading, LLC is a branch registered in Ireland under registration no. 906667 of SAL Trading, LLC incorporated in Delaware USA under registration no.: 4984826

Susquehanna International Securities Limited is regulated by the Central Bank of Ireland. Susquehanna International Securities Limited (UK Branch) is regulated by the Financial Conduct Authority for conduct of business rules

If this email relates to investment services and activities as defined in Directive 2014/65/EU of the European Parliament and of the Council of 15 May 2014 on Markets in Financial Instruments (MiFID II), you are receiving the email from Susquehanna International Securities Limited

cadencep45 commented 5 years ago

Can I ask you a favour ?

I am developing a piggy back check to all cpu of unity to be graphed/alerted on as its one of the indicators of stress of the system, so

[root@dubstormgmt8003 local]# ./unity_cpu.py
<<<<dubnas308-spa-mgmt>>>>
/usr/bin/uemcli -d dubnas308-spa-mgmt -u bobf -p ChangemeNow123! /metrics/value/hist -path sp.*.cpu.summary.utilization show -interval 60
Storage system address: dubnas308-spa-mgmt
Storage system port: 443
HTTPS connection

Timestamp           |SP        |summary
                    |          |CPU
                    |          |Util %
--------------------+----------+-------
2019-01-17 11:08:00 |spa       |  4.887
                    |spb       |  40.48
2019-01-17 11:09:00 |spa       |  5.075
                    |spb       |  37.33
2019-01-17 11:10:00 |spa       |  4.649
                    |spb       |  43.64
2019-01-17 11:11:00 |spa       |  5.616
                    |spb       |  41.32
2019-01-17 11:12:00 |spa       |  8.175
                    |spb       |  41.50
2019-01-17 11:13:00 |spa       |  4.509
                    |spb       |  40.49
2019-01-17 11:14:00 |spa       |  4.627
                    |spb       |  44.48
2019-01-17 11:15:00 |spa       |  4.691
                    |spb       |  42.15
2019-01-17 11:16:00 |spa       |  5.071
                    |spb       |  38.10
2019-01-17 11:17:00 |spa       |  4.682
                    |spb       |  41.46
2019-01-17 11:18:00 |spa       |  4.820
                    |spb       |  41.56
2019-01-17 11:19:00 |spa       |  4.685
                    |spb       |  43.95
2019-01-17 11:20:00 |spa       |  6.780
                    |spb       |  39.92
2019-01-17 11:21:00 |spa       |  8.776
                    |spb       |  43.52
2019-01-17 11:22:00 |spa       |  5.072
                    |spb       |  41.61
2019-01-17 11:23:00 |spa       |  5.960
                    |spb       |  40.81
2019-01-17 11:24:00 |spa       |  4.974
                    |spb       |  46.52
2019-01-17 11:25:00 |spa       |  4.994
                    |spb       |  37.25
2019-01-17 11:26:00 |spa       |  4.847
                    |spb       |  41.86
2019-01-17 11:27:00 |spa       |  4.566
                    |spb       |  40.40
2019-01-17 11:28:00 |spa       |  4.813
                    |spb       |  42.72
2019-01-17 11:29:00 |spa       |  4.918
                    |spb       |  40.31
2019-01-17 11:30:00 |spa       |  4.869
                    |spb       |  43.05
2019-01-17 11:31:00 |spa       |  4.994
                    |spb       |  37.94
2019-01-17 11:32:00 |spa       |  4.871
                    |spb       |  39.03
2019-01-17 11:33:00 |spa       |  4.993
                    |spb       |  36.64
2019-01-17 11:34:00 |spa       |  8.114
                    |spb       |  42.15
2019-01-17 11:35:00 |spa       |  8.964
                    |spb       |  42.27
2019-01-17 11:36:00 |spa       |  5.101
                    |spb       |  42.34
2019-01-17 11:37:00 |spa       |  4.814
                    |spb       |  39.88
2019-01-17 11:38:00 |spa       |  4.611
                    |spb       |  45.98
2019-01-17 11:39:00 |spa       |  4.999
                    |spb       |  38.99
2019-01-17 11:40:00 |spa       |  6.128
                    |spb       |  41.84
2019-01-17 11:41:00 |spa       |  5.043
                    |spb       |  40.28
2019-01-17 11:42:00 |spa       |  4.209
                    |spb       |  43.01
2019-01-17 11:43:00 |spa       |  4.459
                    |spb       |  44.15
2019-01-17 11:44:00 |spa       |  4.988
                    |spb       |  39.85
2019-01-17 11:45:00 |spa       |  4.933
                    |spb       |  38.69
2019-01-17 11:46:00 |spa       |  5.098
                    |spb       |  37.66
2019-01-17 11:47:00 |spa       |  4.773
                    |spb       |  40.03
2019-01-17 11:48:00 |spa       |  5.024
                    |spb       |  40.42
2019-01-17 11:49:00 |spa       |  4.867
                    |spb       |  38.78
2019-01-17 11:50:00 |spa       |  4.777
                    |spb       |  39.33
2019-01-17 11:51:00 |spa       |  4.977
                    |spb       |  37.00
2019-01-17 11:52:00 |spa       |  4.724
                    |spb       |  40.31
2019-01-17 11:53:00 |spa       |  4.969
                    |spb       |  36.00
2019-01-17 11:54:00 |spa       |  4.624
                    |spb       |  42.79
2019-01-17 11:55:00 |spa       |  4.924
                    |spb       |  39.89
2019-01-17 11:56:00 |spa       |  4.821
                    |spb       |  42.19
2019-01-17 11:57:00 |spa       |  4.576
                    |spb       |  40.54
2019-01-17 11:58:00 |spa       |  4.968
                    |spb       |  38.43
2019-01-17 11:59:00 |spa       |  4.588
                    |spb       |  43.38
2019-01-17 12:00:00 |spa       |  5.130
                    |spb       |  34.23
2019-01-17 12:01:00 |spa       |  5.139
                    |spb       |  40.66
2019-01-17 12:02:00 |spa       |  4.578
                    |spb       |  41.15
2019-01-17 12:03:00 |spa       |  10.62
                    |spb       |  45.15
2019-01-17 12:04:00 |spa       |  8.085
                    |spb       |  42.99
2019-01-17 12:05:00 |spa       |  4.970
                    |spb       |  37.23
2019-01-17 12:06:00 |spa       |  5.672
                    |spb       |  37.54
2019-01-17 12:07:00 |spa       |  4.865
                    |spb       |  38.03
2019-01-17 12:08:00 |spa       |  5.181
                    |spb       |  36.42
2019-01-17 12:09:00 |spa       |  4.722
                    |spb       |  38.98
2019-01-17 12:10:00 |spa       |  4.976
                    |spb       |  37.57
2019-01-17 12:11:00 |spa       |  4.831
                    |spb       |  41.92
2019-01-17 12:12:00 |spa       |  4.626
                    |spb       |  38.53
2019-01-17 12:13:00 |spa       |  5.121
                    |spb       |  35.66
2019-01-17 12:14:00 |spa       |  4.754
                    |spb       |  42.46
2019-01-17 12:15:00 |spa       |  4.966
                    |spb       |  37.53
2019-01-17 12:16:00 |spa       |  4.925
                    |spb       |  41.13
2019-01-17 12:17:00 |spa       |  4.675
                    |spb       |  42.79
2019-01-17 12:18:00 |spa       |  4.824
                    |spb       |  43.52
2019-01-17 12:19:00 |spa       |  4.903
                    |spb       |  41.97
2019-01-17 12:20:00 |spa       |  4.858
                    |spb       |  40.06
2019-01-17 12:21:00 |spa       |  5.140
                    |spb       |  35.26
2019-01-17 12:22:00 |spa       |  4.803
                    |spb       |  37.77
2019-01-17 12:23:00 |spa       |  5.039
                    |spb       |  40.08
2019-01-17 12:24:00 |spa       |  4.614
                    |spb       |  46.38
2019-01-17 12:25:00 |spa       |  5.003
                    |spb       |  38.91
2019-01-17 12:26:00 |spa       |  5.205
                    |spb       |  34.77
2019-01-17 12:27:00 |spa       |  4.733
                    |spb       |  37.57
2019-01-17 12:28:00 |spa       |  4.951
                    |spb       |  38.35
2019-01-17 12:29:00 |spa       |  4.623
                    |spb       |  43.14
2019-01-17 12:30:00 |spa       |  4.907
                    |spb       |  39.22
2019-01-17 12:31:00 |spa       |  4.956
                    |spb       |  35.83
2019-01-17 12:32:00 |spa       |  4.792
                    |spb       |  37.03
2019-01-17 12:33:00 |spa       |  4.897
                    |spb       |  38.74
2019-01-17 12:34:00 |spa       |  4.858
                    |spb       |  40.01
2019-01-17 12:35:00 |spa       |  4.942
                    |spb       |  38.42
2019-01-17 12:36:00 |spa       |  5.193
                    |spb       |  35.92
2019-01-17 12:37:00 |spa       |  4.836
                    |spb       |  40.00
2019-01-17 12:38:00 |spa       |  4.996
                    |spb       |  38.15
2019-01-17 12:39:00 |spa       |  5.019
                    |spb       |  36.28
2019-01-17 12:40:00 |spa       |  5.767
                    |spb       |  44.27
2019-01-17 12:41:00 |spa       |  4.939
                    |spb       |  37.85
2019-01-17 12:42:00 |spa       |  4.351
                    |spb       |  42.94
2019-01-17 12:43:00 |spa       |  4.766
                    |spb       |  41.36
2019-01-17 12:44:00 |spa       |  4.870
                    |spb       |  37.68
2019-01-17 12:45:00 |spa       |  4.879
                    |spb       |  41.13
2019-01-17 12:46:00 |spa       |  4.905
                    |spb       |  39.38
2019-01-17 12:47:00 |spa       |  4.689
                    |spb       |  36.81
[root@dubstormgmt8003 local]# more unity_cpu.py
#!/usr/bin/env python
# Date 09/1//2019
# By Bob Flynn
# Summary
# Queries Unity via EMC cli tool uemcli to get CPU status and updates check-mk with
# warning if advisoryalert is set
# critical if hard threshold alert is set
# Dependencies
# Version       By      Comment
# V 1.0         BF      Initial version created

import os,sys

unity_array = "my_unity"
unity_username = "my_username"
unity_password =  “my_password"
print("<<<<{0}>>>>".format(unity_array))
def check_mk_state(sp_cpu):
        check_mk_status = 0
        if sp_cpu > 70:
                check_mk_status = 1
        if sp_cpu > 90:
                check_mk_status = 2
        return check_mk_status
check = False
basecmd = str("/usr/bin/uemcli -d " + unity_array +" -u "+ unity_username+" -p "+unity_password)
cpu_cmd = " /metrics/value/hist -path sp.*.cpu.summary.utilization show -interval 60"
execline = basecmd +  cpu_cmd
print execline
# content =  os.popen(execline).read()[1:2][-1]
content =  os.popen(execline).read()
print (content)
exit(0)

while ( not check):
# read all lines at once
        content =  os.popen(execline).read()
        words = content.split()
        if len( words) > 0:
                if words[0] == "Operation":
                        check = False
                        print content
                        print words[0],"xx"
                else:
                        check = True
spa= words[len(words)-4]
spb= words[len(words)-1]
spa_query =  ("{0} {1}{2} {3}  ".format(check_mk_state(float(spa)),"[LC_PB]SPA_CPU cpu=",spa,spa))
print ("{0} {1}{2} {3}  ".format(check_mk_state(float(spa)),"[LC_PB]SPA_CPU cpu=",spa,spa))
print ("{0} {1}{2} {3}  ".format(check_mk_state(float(spb)),"[LC_PB]SPB_CPU cpu=",spb,spb))
print("<<<<>>>>")

The problem I have is when I run script above interactively, it works When I exercise it in cmk via

telnet 127.0.0.1 6556

on the piggy back client, I get

telnet 127.0.0.1 6556 | tail -10
Connection closed by foreign host.
postfix:the Postfix mail system is running:PID:1310
<<<job>>>
<<<local>>>
<<<<my_unity>>>>
/usr/bin/uemcli -d dubnas308-spa-mgmt -u bobf -p ChangemeNow123! /metrics/value/hist -path sp.*.cpu.summary.utilization show -interval 60
Operation failed. Error code: 0x1000030
HOME file system status checking is failed. Please make sure that your home directory is in a good status. (Error Code:0x1000030)

I suspect its uemcli interacting with cmk causing uemcli to not find its lockbox but want to check if someone else sees the same error message.

Could you modify script to add your own unity application/username/password and see if script

  1. Runs interactively

  2. Runs through check_mk telnet

From: Flynn, Bob Sent: 15 January 2019 17:19 To: 'ImTheLucKyOne/check_mk_emcunity' reply@reply.github.com; ImTheLucKyOne/check_mk_emcunity check_mk_emcunity@noreply.github.com Cc: Author author@noreply.github.com Subject: RE: [ImTheLucKyOne/check_mk_emcunity] what does uemccli run as (#10)

Ok,

I will work with our check_mk admin to test tomorrow.

From: Philipp N. [mailto:notifications@github.com] Sent: 15 January 2019 17:17 To: ImTheLucKyOne/check_mk_emcunity check_mk_emcunity@noreply.github.com<mailto:check_mk_emcunity@noreply.github.com> Cc: Flynn, Bob Bob.Flynn@msx.bala.susq.com<mailto:Bob.Flynn@msx.bala.susq.com>; Author author@noreply.github.com<mailto:author@noreply.github.com> Subject: Re: [ImTheLucKyOne/check_mk_emcunity] what does uemccli run as (#10)

Ok, please replace the files in your system with the attached files. You have to reopen your existing WATO rule and select the lockbox login value. Please report if it works.

replace.ziphttps://github.com/ImTheLucKyOne/check_mk_emcunity/files/2760665/replace.zip

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ImTheLucKyOne/check_mk_emcunity/issues/10#issuecomment-454474387, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AsVb8KyEinoMjGyZp0v8Qg9mjb6RdqmXks5vDg0HgaJpZM4Z1eu2.


IMPORTANT: The information contained in this email and/or its attachments is confidential and may only be used by the person to whom it is addressed. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this email and/or any attachment by an unintended recipient is strictly prohibited. Neither this email nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this email and/or any of its attachments are free of viruses. Any views expressed are personal to the author, except where specifically stated to be the views of SIG. SIG accepts no liability of any kind either for any errors arising as a result of electronic transmission or for any loss or damage which may be sustained by any person as a result of this email and/or its attachments being communicated to any person other than the intended recipient.

Susquehanna International Group Limited is a private company limited by shares and registered in Ireland. Registration No.: 445356. Registered Office Address: International Centre Memorial Road IFSC Dublin 1 Ireland

Susquehanna International Securities Limited is a private company limited by shares and registered in Ireland. Registration No.: 337946. Registered Office Address: International Centre Memorial Road IFSC Dublin 1 Ireland

Susquehanna International Securities Limited (UK Branch). Registration No.: FC033877

Liffeyview Property Holdings Limited is a private company limited by shares and registered in Ireland. Registration No.: 534083. Registered Office Address: International Centre Memorial Road IFSC Dublin 1 Ireland

Heights Capital Ireland, LLC is a branch registered in Ireland under registration no. 908306 of Heights Capital Ireland, LLC incorporated in Delaware USA under registration no.: 5762692

SAL Trading, LLC is a branch registered in Ireland under registration no. 906667 of SAL Trading, LLC incorporated in Delaware USA under registration no.: 4984826

Susquehanna International Securities Limited is regulated by the Central Bank of Ireland. Susquehanna International Securities Limited (UK Branch) is regulated by the Financial Conduct Authority for conduct of business rules

If this email relates to investment services and activities as defined in Directive 2014/65/EU of the European Parliament and of the Council of 15 May 2014 on Markets in Financial Instruments (MiFID II), you are receiving the email from Susquehanna International Securities Limited

ImTheLucKyOne commented 5 years ago

It does not work because when the agent is called by the tcp socket connection, it does not know the environment variable HOME. The problem is, you can't set the environment variable in your local plugin. That just does not work. For testing I once wrote a small "hack" for the uemcli binary /usr/bin/uemcli that sets the environment variable if it can not find HOME:

if [[ $(whoami) == "root" ]]; then
    export HOME="/root"
else
    export HOME="/home/"$(whoami)
fi

I am not sure if this is a security issue, but I hope you basically understand what is going wrong in your plugin.

If you would allow me to use some of your code I would try to implement the cpu check into my emc extension.

ImTheLucKyOne commented 5 years ago

Oh and... you probably need to change the else portion since check_mk/omd uses different home directories. Or simply get rid of it and set HOME only if root executes the binary.

cadencep45 commented 5 years ago

Tks.

Python ified it as

import os,sys,subprocess

myenv={ 'HOME': '/root'} p1 = subprocess.Popen('uemcli -d 10.170.95.45 -silent /metrics/value/hist -path sp.*.cpu.summary.utilization show -interval 60 ',shell=True,env=myenv, stdo ut=subprocess.PIPE)

and

[root@dubstormgmt8003 local]# telnet 127.0.0.1 6556 | tail -10 Connection closed by foreign host. <<<postfix_mailq_status:sep(58)>>> postfix:the Postfix mail system is running:PID:1310 <<>> <<>> <<<>>> 0 [LC_PB]SPA_CPU cpu=4.670 4.670 0 [LC_PB]SPB_CPU cpu=44.28 44.28 <<<<>>>> <<>>

So hat tip to you ☺

From: Philipp N. [mailto:notifications@github.com] Sent: 17 January 2019 14:30 To: ImTheLucKyOne/check_mk_emcunity check_mk_emcunity@noreply.github.com Cc: Flynn, Bob Bob.Flynn@msx.bala.susq.com; Author author@noreply.github.com Subject: Re: [ImTheLucKyOne/check_mk_emcunity] what does uemccli run as (#10)

It does not work because when the agent is called by the tcp socket connection, it does not know the environment variable HOME. The problem is, you can't set the environment variable in your local plugin. That just does not work. For testing I once wrote a small "hack" for the uemcli binary /usr/bin/uemcli that sets the environment variable if it can not find HOME:

if [[ $(whoami) == "root" ]]; then

export HOME="/root"

else

export HOME="/home/"$(whoami)

fi

I am not sure if this is a security issue, but I hope you basically understand what is going wrong in your plugin.

If you would allow me to use some of your code I would try to implement the cpu check into my emc extension.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ImTheLucKyOne/check_mk_emcunity/issues/10#issuecomment-455190997, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AsVb8P8IB_3PNXdF-VbAw6cfv6P-ZdT4ks5vEIjmgaJpZM4Z1eu2.


IMPORTANT: The information contained in this email and/or its attachments is confidential and may only be used by the person to whom it is addressed. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this email and/or any attachment by an unintended recipient is strictly prohibited. Neither this email nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this email and/or any of its attachments are free of viruses. Any views expressed are personal to the author, except where specifically stated to be the views of SIG. SIG accepts no liability of any kind either for any errors arising as a result of electronic transmission or for any loss or damage which may be sustained by any person as a result of this email and/or its attachments being communicated to any person other than the intended recipient.

Susquehanna International Group Limited is a private company limited by shares and registered in Ireland. Registration No.: 445356. Registered Office Address: International Centre Memorial Road IFSC Dublin 1 Ireland

Susquehanna International Securities Limited is a private company limited by shares and registered in Ireland. Registration No.: 337946. Registered Office Address: International Centre Memorial Road IFSC Dublin 1 Ireland

Susquehanna International Securities Limited (UK Branch). Registration No.: FC033877

Liffeyview Property Holdings Limited is a private company limited by shares and registered in Ireland. Registration No.: 534083. Registered Office Address: International Centre Memorial Road IFSC Dublin 1 Ireland

Heights Capital Ireland, LLC is a branch registered in Ireland under registration no. 908306 of Heights Capital Ireland, LLC incorporated in Delaware USA under registration no.: 5762692

SAL Trading, LLC is a branch registered in Ireland under registration no. 906667 of SAL Trading, LLC incorporated in Delaware USA under registration no.: 4984826

Susquehanna International Securities Limited is regulated by the Central Bank of Ireland. Susquehanna International Securities Limited (UK Branch) is regulated by the Financial Conduct Authority for conduct of business rules

If this email relates to investment services and activities as defined in Directive 2014/65/EU of the European Parliament and of the Council of 15 May 2014 on Markets in Financial Instruments (MiFID II), you are receiving the email from Susquehanna International Securities Limited

ImTheLucKyOne commented 5 years ago

Oh ok, calling the subprocess with the environment variable didn't came to my mind :'D

Does the new WATO rule for login selection work?

cadencep45 commented 5 years ago

Not completed testing yet, was sorting out the local check problem below.

From: Philipp N. [mailto:notifications@github.com] Sent: 18 January 2019 08:44 To: ImTheLucKyOne/check_mk_emcunity check_mk_emcunity@noreply.github.com Cc: Flynn, Bob Bob.Flynn@msx.bala.susq.com; Author author@noreply.github.com Subject: Re: [ImTheLucKyOne/check_mk_emcunity] what does uemccli run as (#10)

Oh ok, calling the subprocess with the environment variable didn't came to my mind :'D

Does the new WATO rule for login selection work?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ImTheLucKyOne/check_mk_emcunity/issues/10#issuecomment-455469338, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AsVb8H-q9YyL9gojhv9XQnJb1Me5GYgZks5vEYlKgaJpZM4Z1eu2.


IMPORTANT: The information contained in this email and/or its attachments is confidential and may only be used by the person to whom it is addressed. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this email and/or any attachment by an unintended recipient is strictly prohibited. Neither this email nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this email and/or any of its attachments are free of viruses. Any views expressed are personal to the author, except where specifically stated to be the views of SIG. SIG accepts no liability of any kind either for any errors arising as a result of electronic transmission or for any loss or damage which may be sustained by any person as a result of this email and/or its attachments being communicated to any person other than the intended recipient.

Susquehanna International Group Limited is a private company limited by shares and registered in Ireland. Registration No.: 445356. Registered Office Address: International Centre Memorial Road IFSC Dublin 1 Ireland

Susquehanna International Securities Limited is a private company limited by shares and registered in Ireland. Registration No.: 337946. Registered Office Address: International Centre Memorial Road IFSC Dublin 1 Ireland

Susquehanna International Securities Limited (UK Branch). Registration No.: FC033877

Liffeyview Property Holdings Limited is a private company limited by shares and registered in Ireland. Registration No.: 534083. Registered Office Address: International Centre Memorial Road IFSC Dublin 1 Ireland

Heights Capital Ireland, LLC is a branch registered in Ireland under registration no. 908306 of Heights Capital Ireland, LLC incorporated in Delaware USA under registration no.: 5762692

SAL Trading, LLC is a branch registered in Ireland under registration no. 906667 of SAL Trading, LLC incorporated in Delaware USA under registration no.: 4984826

Susquehanna International Securities Limited is regulated by the Central Bank of Ireland. Susquehanna International Securities Limited (UK Branch) is regulated by the Financial Conduct Authority for conduct of business rules

If this email relates to investment services and activities as defined in Directive 2014/65/EU of the European Parliament and of the Council of 15 May 2014 on Markets in Financial Instruments (MiFID II), you are receiving the email from Susquehanna International Securities Limited