aklyuk / zabbix-ibm-storwize

Python script for monitoring IBM Storwize storages
15 stars 20 forks source link

Error messages while running the script #1

Closed mbuyukkarakas closed 4 years ago

mbuyukkarakas commented 4 years ago

Dear aklyuk, Thank you for that project. I tried to run at shell on zabbix v4.4.1 / Centos 7.4. Recieved some error messages.

Thank you.

pwd /usr/lib/zabbix/externalscripts

./storwize_get_state.py --storwize_ip=10.1.1.101 --storwize_port=80 --storwize_user=wizezbx --storwize_password='hbr-123!' --storage_name="zbxserver" --discovery

Traceback (most recent call last): File "./storwize_get_state.py", line 358, in main() File "./storwize_get_state.py", line 349, in main result_discovery = discovering_resources(arguments.storwize_user, arguments.storwize_password, arguments.storwize_ip, arguments.storwize_port, arguments.storage_name, list_resources) File "./storwize_get_state.py", line 234, in discovering_resources return send_data_to_zabbix(xer, storage_name) File "./storwize_get_state.py", line 161, in send_data_to_zabbix send_code = subprocess.call([sender_command, "-vv", "-c", config_path, "-s", storage_name, "-T", "-i", temp_file], stdout = subprocess.PIPE, stderr = subprocess.PIPE) File "/usr/lib64/python2.7/subprocess.py", line 524, in call return Popen(*popenargs, **kwargs).wait() File "/usr/lib64/python2.7/subprocess.py", line 711, in init errread, errwrite) File "/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory

aklyuk commented 4 years ago

hi.

# Create log-object LOG_FILENAME = "/tmp/storwize_state.log"

is this file exist? what permission it have?

mbuyukkarakas commented 4 years ago

Hello, current permissions are ;

-rw-r--r-- 1 root root 19K Nov 22 14:47 storwize_state.log

mbuyukkarakas commented 4 years ago

Hello, current permissions are ;

-rw-r--r-- 1 root root 19K Nov 22 14:47 storwize_state.log

When I check /tmp directory I see some files and take a look inside

more /tmp/v7000_1574422458.tmp v7000 lsvdisk 1574422457 {"data": [{"{#ID}": "24","{#NAME}": "NVME01"},{"{#ID}": "25","{#NAME}": "NVME02"},{"{#ID}": "26","{#NAME}": "NVME03"},{"{#ID}": "27","{#NAME}": "NVME04"},{" {#ID}": "28","{#NAME}": "CSAS01"},{"{#ID}": "29","{#NAME}": "CSAS02"},{"{#ID}": "30","{#NAME}": "CSAS03"},{"{#ID}": "31","{#NAME}": "CSAS04"},{"{#ID}": "32","{#NAME}": "CSAS05"},{"{

ID}": "33","{#NAME}": "CSAS06"},{"{#ID}": "34","{#NAME}": "CSAS07"},{"{#ID}": "35","{#NAME}": "SAS08"},{"{#ID}": "36","{#NAME}": "SAS09"},{"{#ID}": "37","{#NAME}": "SAS10"},{"{#ID}

It looks the script can read from V7000

aklyuk commented 4 years ago

you have run this script from user root. File permissions is 0644. Other users (as example zabbix) cannot write to this file. you can change owner and permissions on this file: chown zabbix:zabbix storwize_state.log && chmod 0755 storwize_state.log

or delete this file and run script from user zabbix: sudo -u zabbix ./storwize_state.log *******

mbuyukkarakas commented 4 years ago

Thank you.

When I run the script with sudo -u zabbix, the script gives me the same error messages.

But when I check the /tmp/storwize_state.log it looks like completed. So do you have any idea why the scripts gives me the error messages at running explicitly.

more /tmp/storwize_state.log 10.10.1.245 - 2019-11-22 15:12:08,064 - storwize_logger - INFO - Starting Discovering 10.10.1.245 - 2019-11-22 15:12:08,195 - storwize_logger - INFO - Connection Established Successfully 10.10.1.245 - 2019-11-22 15:12:08,389 - storwize_logger - INFO - Starting discovering resource - lsvdisk 10.10.1.245 - 2019-11-22 15:12:08,393 - storwize_logger - INFO - Succes get resource - lsvdisk 10.10.1.245 - 2019-11-22 15:12:08,573 - storwize_logger - INFO - Starting discovering resource - lsmdisk 10.10.1.245 - 2019-11-22 15:12:08,574 - storwize_logger - INFO - Succes get resource - lsmdisk 10.10.1.245 - 2019-11-22 15:12:08,752 - storwize_logger - INFO - Starting discovering resource - lsmdiskgrp 10.10.1.245 - 2019-11-22 15:12:08,753 - storwize_logger - INFO - Succes get resource - lsmdiskgrp 10.10.1.245 - 2019-11-22 15:12:08,926 - storwize_logger - INFO - Starting discovering resource - lsenclosure 10.10.1.245 - 2019-11-22 15:12:08,927 - storwize_logger - INFO - Succes get resource - lsenclosure 10.10.1.245 - 2019-11-22 15:12:09,100 - storwize_logger - INFO - Starting discovering resource - lsenclosurebattery 10.10.1.245 - 2019-11-22 15:12:09,100 - storwize_logger - INFO - Succes get resource - lsenclosurebattery 10.10.1.245 - 2019-11-22 15:12:09,310 - storwize_logger - INFO - Starting discovering resource - lsenclosurepsu 10.10.1.245 - 2019-11-22 15:12:09,312 - storwize_logger - INFO - Succes get resource - lsenclosurepsu 10.10.1.245 - 2019-11-22 15:12:09,493 - storwize_logger - INFO - Starting discovering resource - lsenclosurecanister 10.10.1.245 - 2019-11-22 15:12:09,494 - storwize_logger - INFO - Succes get resource - lsenclosurecanister 10.10.1.245 - 2019-11-22 15:12:09,651 - storwize_logger - INFO - Starting discovering resource - lsdrive 10.10.1.245 - 2019-11-22 15:12:09,656 - storwize_logger - INFO - Succes get resource - lsdrive 10.10.1.245 - 2019-11-22 15:12:09,806 - storwize_logger - INFO - Starting discovering resource - lsportfc 10.10.1.245 - 2019-11-22 15:12:09,808 - storwize_logger - INFO - Succes get resource - lsportfc 10.10.1.245 - 2019-11-22 15:12:10,048 - storwize_logger - INFO - Starting discovering resource - lsportsas 10.10.1.245 - 2019-11-22 15:12:10,049 - storwize_logger - INFO - Succes get resource - lsportsas 10.10.1.245 - 2019-11-22 15:12:10,052 - storwize_logger - INFO - Connection Closed Successfully

aklyuk commented 4 years ago

sorry. i have mistake. file is /tmp/v7000_**.tmp you can add comment to this string os.remove(temp_file) Run script from user zabbix and check file /tmp/v7000_**.tmp

mbuyukkarakas commented 4 years ago

Still the same and I dont understand what I'm doing wrong. I will write down step by step ;

QUESTION : Where should I write the storage IP address ? Any missing thing in macros ?

So what am I doing wrong ? Can you please describe the necessary steps to run this template. Thank you.

mbuyukkarakas commented 4 years ago
error

That is what I got.

aklyuk commented 4 years ago

may be file is /etc/zabbix/zabbix_agentd.conf /etc/zabbix/zabbix_agentd.conf exist on host? from this file script get paramter server_active

mbuyukkarakas commented 4 years ago

No. The conf file exists. The reason behind this error must be something different. Personnaly I think its code related or a dependent package is missing or something else.

aklyuk commented 4 years ago

is Selinux enabled?

mbuyukkarakas commented 4 years ago

Dear aklyuk, selinux is disabled.

aklyuk commented 4 years ago

is zabbix_sender installed?

apm-github commented 4 years ago

Hi, We have the same problem too

aklyuk commented 4 years ago

Hi, We have the same problem too

is zabbix_sender installed ?

i have changed this string in script - sender_command = "/usr/bin/zabbix_sender2222" and i got same error. Check your zabbix_sender location

apm-github commented 4 years ago

Thanks, after installation zabbix-sender problem was resolved.

mbuyukkarakas commented 4 years ago

I agree, after installing zabbix-sender the problem resolved. It's working perfectly. Thank you.