aklyuk / zabbix-emc-unity

Python script for monitoring EMC Unity strages
23 stars 22 forks source link

Error 401 #4

Open alpha86be opened 4 years ago

alpha86be commented 4 years ago

Hi I am trying to monitor my Unity 300 with your script. When debugging I only get number 60 as return. Checking the log I find that the error code is 401 but username and password are correct if I try in the web browser. Can you help me? Regards

aklyuk commented 4 years ago

What role have your user? Role must be an operator

alpha86be commented 4 years ago

Confirmed. The user I have created is operator. Is it possible it has something to do with Python version? This is the error from the log file: 2020-02-17 17:57:34,770 - unity_logger - ERROR - Connection Return Code = 401 And this is the test sentence: python2 ./zabbix-emc-unity-master/unity_get_state.py --api_ip=192.168.3.65 --api_port=443 --api_user=zabbixuser --api_password='Password' --storage_name=tcadminemc01 --discovery I have tried with both Python2 and Python3.

aklyuk commented 4 years ago

On unity_reference 401 is unauthorized. Try this code on python interpreter:

api_login_url = "https://{0}:{1}/api/types/loginSessionInfo".format(api_ip, api_port) session_unity = requests.Session() session_unity.auth = (api_user, api_password) session_unity.headers = {'X-EMC-REST-CLIENT': 'true', 'Content-type': 'application/json', 'Accept': 'application/json'} login = session_unity.get(api_login_url, verify=False)

May be on unity300 authentication has some differences.

alpha86be commented 4 years ago

We found the problem. We needed to uninstall python2 and also install zabbix_sender then it started to work.

bmarques79 commented 4 years ago

I have the template/script in a Windows server used as a jump server to the Unity. On the log when i try to execute unity_get_state.py --api_ip=10.10.1.11 --api_port=443 --api_user=zabbix --api_password='password' --storage_name="unity1" --discovery give the following errors: 2020-04-23 01:27:35,830 - unity_logger - ERROR - Connection Return Code = 401 2020-04-23 01:28:14,346 - unity_logger - ERROR - Connection Return Code = 401 2020-04-23 01:34:14,742 - unity_logger - ERROR - Connection Return Code = 401 2020-04-23 11:44:35,243 - unity_logger - ERROR - Connection Return Code = 401 2020-04-23 12:15:39,652 - unity_logger - ERROR - Connection Return Code = 401 2020-04-23 12:15:59,465 - unity_logger - ERROR - Connection Return Code = 401 2020-04-23 12:18:50,279 - unity_logger - ERROR - Connection Return Code = 401 2020-04-23 12:19:32,327 - unity_logger - ERROR - Connection Return Code = 401 2020-04-23 12:20:00,467 - unity_logger - ERROR - Connection Return Code = 401 2020-04-23 12:20:02,327 - unity_logger - ERROR - Connection Return Code = 401

I don't have Python2 and i already installed the zabbix_sender, but the problem persists.

Can you help me?

Thanks in advance, BMarques

bmarques79 commented 4 years ago

Solved!

tliff commented 4 years ago

Solved!

@bmarques79 Did you ever find out what the reason was?

OGraciaV commented 3 years ago

Hello @bmarques79 How have you solved the 401 error? Thanks!

OGraciaV commented 3 years ago

We found the problem. We needed to uninstall python2 and also install zabbix_sender then it started to work.

Hi @alpha86be , can you help me?

I have the same error, can you send me step by step?

Best Regards,

larodsine commented 1 year ago

Goodnight! I'm having this error:

2023-10-02 19:03:05,768 - unity_logger - INFO - Connection established 2023-10-02 19:03:05,775 - unity_logger - ERROR - Error occurred in get state 2023-10-02 19:04:37,169 - unity_logger - ERROR - Connection Return Code = 404

Do you have any idea what it is?

Monitoring is being done through my zabbix proxy.

image

image

Diga1129 commented 8 months ago

@bmarques79

I encountered the same problem. Currently, even with curl, I'm getting a 401 error. However, since there is a UI on the machine, I can connect successfully using a browser on it, so I'm ruling out any network issues. Account login is also not a problem. However, even when using the command:

bash Copy code ./unity_get_state.py --api_ip='X.X.X.X' --api_port='443' --api_user='zabbix' --api_password='PASSWORD' --storage_name="zabbix web前端配置的主机名" --discovery I still receive a 401 error.

Could you provide some suggestions for resolving this issue?

Neo914 commented 4 months ago

Hello I have a problem of the same type I have a Zabbix server proxy and a Zabbix main server, the latter monitoring the Zabbix proxy. From the Zabbix proxy I have the Python script that is run to explore my Dell Unity and upload all the discovery elements in my Zabbix but I have a problem to remount the elements in Zabbix HMI.

root@deb:/usr/lib/zabbix/externalscripts# python3 unity_get_state.py --api_ip ..**. --api_port 443 --api_user --api_password *** --storage_name DellEMC_unity --discovery 1 root@deb:/usr/lib/zabbix/externalscripts# python3 unity_get_state.py --api_ip ..**.* --api_port 443 --api_user --api_password ***** --storage_name DellEMC_unity --status 1 root@deb:/usr/lib/zabbix/externalscripts#

in the log unity_state.log I don't have an error

2024-07-09 11:41:07,751 - unity_logger - INFO - Connection established 2024-07-09 11:41:12,247 - unity_logger - INFO - Logout successful 2024-07-09 11:41:35,916 - unity_logger - INFO - Connection established 2024-07-09 11:41:40,324 - unity_logger - INFO - Logout successful 2024-07-09 11:41:50,849 - unity_logger - INFO - Connection established 2024-07-09 11:41:55,705 - unity_logger - INFO - Logout successful

on the other hand when I do the tests manually

root@deb:/usr/bin# zabbix_sender -z server_zabbix -p 10051 -s "DellEMC_unity" -k "health.disk.[{#ID}] " -o 4 -vv zabbix_sender [4022880]: DEBUG: In connect_to_server() [server_zabbix]:10051 [timeout:60, connection timeout:3] zabbix_sender [4022880]: DEBUG: In is_ip4() ip:'...**' zabbix_sender [4022880]: DEBUG: End of is_ip4():SUCCEED zabbix_sender [4022880]: DEBUG: answer [{"response":"success","info":"processed: 0; failed: 1; total: 1; seconds spent: 0.000019"}] Response from "server_zabbix:10051": "processed: 0; failed: 1; total: 1; seconds spent: 0.000019" sent: 1; skipped: 0; total: 1 root@deb:/usr/bin#

Can you help me understand the sticking point?