aklyuk / zabbix-emc-unity

Python script for monitoring EMC Unity strages
22 stars 20 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 9 months 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 3 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?