Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when running zfs.py under zabbix-agent #12

Open
bmansvk opened this issue Feb 28, 2022 · 2 comments
Open

Error when running zfs.py under zabbix-agent #12

bmansvk opened this issue Feb 28, 2022 · 2 comments

Comments

@bmansvk
Copy link

bmansvk commented Feb 28, 2022

When I execute following from Zabbix server, I see following error:

$ zabbix_get -s 10.165.254.254 -k zfs
Traceback (most recent call last):
  File "/etc/zabbix/scripts/zfs.py", line 171, in <module>
    scrub, vdev_errors = pool_status()
  File "/etc/zabbix/scripts/zfs.py", line 70, in pool_status
    ], split=r'\s+')
  File "/etc/zabbix/scripts/zfs.py", line 17, in run
    stderr=DEVNULL
  File "/usr/lib64/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib64/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/sbin/zpool', 'status', '-Pp']' returned non-zero exit status 1.

But running zfs.py under zabbix user on monitored server it runs OK:

$ /etc/zabbix/scripts/zfs.py
{
  "vdevs": {
    "/dev/disk/by-id/wwn-0x5000c500861366f7-part1": {
      "name": "/dev/disk/by-id/wwn-0x5000c500861366f7-part1",
      "size": 0,
      "alloc": 0,
      "free": 0,
      "frag": 0,
      "usage": 0,
      "online": 1,
      "errors": {
        "read": 0,
        "write": 0,
        "cksum": 0
      }
    },
    "/dev/disk/by-id/wwn-0x5000c50086127bab-part1": {
      "name": "/dev/disk/by-id/wwn-0x5000c50086127bab-part1",
      "size": 0,
      "alloc": 0,
      "free": 0,
      "frag": 0,
      "usage": 0,
      "online": 1,
      "errors": {
        "read": 0,
        "write": 0,
        "cksum": 0
      }
    },
    "/dev/disk/by-id/wwn-0x5000c50086129857-part1": {
      "name": "/dev/disk/by-id/wwn-0x5000c50086129857-part1",
      "size": 0,
      "alloc": 0,
      "free": 0,
      "frag": 0,
      "usage": 0,
      "online": 1,
      "errors": {
        "read": 0,
        "write": 0,
        "cksum": 0
      }
    },
    "/dev/disk/by-id/wwn-0x5000c500861374f3-part1": {
      "name": "/dev/disk/by-id/wwn-0x5000c500861374f3-part1",
      "size": 0,
      "alloc": 0,
      "free": 0,
      "frag": 0,
      "usage": 0,
      "online": 1,
      "errors": {
        "read": 0,
        "write": 0,
        "cksum": 0
      }

Output seems to be OK.

$ /sbin/zpool status -Pp
  pool: dpoolsas00
 state: ONLINE
  scan: scrub repaired 0B in 08:25:28 with 0 errors on Sat Feb 26 06:40:27 2022
config:

	NAME                                                                                                                           STATE     READ WRITE CKSUM
	dpoolsas00                                                                                                                     ONLINE       0     0     0
	  mirror-0                                                                                                                     ONLINE       0     0     0
	    /dev/disk/by-id/wwn-0x5000c500861366f7-part1                                                                               ONLINE       0     0     0
	    /dev/disk/by-id/wwn-0x5000c50086127bab-part1                                                                               ONLINE       0     0     0
	  mirror-1                                                                                                                     ONLINE       0     0     0
	    /dev/disk/by-id/wwn-0x5000c50086129857-part1                                                                               ONLINE       0     0     0
	    /dev/disk/by-id/wwn-0x5000c500861374f3-part1                                                                               ONLINE       0     0     0
	  mirror-4                                                                                                                     ONLINE       0     0     0
	    /dev/disk/by-id/wwn-0x5000c50086148e4f-part1                                                                               ONLINE       0     0     0
	    /dev/disk/by-id/wwn-0x5000c500c9ebd69b-part1                                                                               ONLINE       0     0     0
	special
	  mirror-3                                                                                                                     ONLINE       0     0     0
	    /dev/disk/by-id/nvme-nvme.8086-435643513534343530304c4634303041474e-494e54454c205353445045444d573430304734-00000001-part1  ONLINE       0     0     0
	    /dev/disk/by-id/nvme-nvme.8086-43564351353434353030583834303041474e-494e54454c205353445045444d573430304734-00000001-part1  ONLINE       0     0     0
	logs
	  mirror-2                                                                                                                     ONLINE       0     0     0
	    /dev/disk/by-id/wwn-nvme.8086-50484d42373432333031544432383043474e-494e54454c2053534450454431443238304741-00000001-part2   ONLINE       0     0     0
	    /dev/disk/by-id/wwn-nvme.8086-50484d42373433353030454832383043474e-494e54454c2053534450454431443238304741-00000001-part2   ONLINE       0     0     0
	cache
	  /dev/disk/by-id/wwn-nvme.8086-50484d42373432333031544432383043474e-494e54454c2053534450454431443238304741-00000001-part4     ONLINE       0     0     0
	  /dev/disk/by-id/wwn-nvme.8086-50484d42373433353030454832383043474e-494e54454c2053534450454431443238304741-00000001-part4     ONLINE       0     0     0

errors: No known data errors

  pool: dpoolsata00
 state: ONLINE
  scan: scrub repaired 0B in 03:12:22 with 0 errors on Sat Feb 26 01:27:29 2022
config:

	NAME                                              STATE     READ WRITE CKSUM
	dpoolsata00                                       ONLINE       0     0     0
	  mirror-0                                        ONLINE       0     0     0
	    /dev/disk/by-id/wwn-0x5000039fe6f3b566-part1  ONLINE       0     0     0
	    /dev/disk/by-id/wwn-0x5000039fe6f3b52d-part1  ONLINE       0     0     0

errors: No known data errors

  pool: dpoolsata01
 state: ONLINE
  scan: scrub repaired 0B in 00:43:45 with 0 errors on Fri Feb 25 22:58:59 2022
config:

	NAME                                              STATE     READ WRITE CKSUM
	dpoolsata01                                       ONLINE       0     0     0
	  raidz1-0                                        ONLINE       0     0     0
	    /dev/disk/by-id/wwn-0x50014ee2b5401324-part1  ONLINE       0     0     0
	    /dev/disk/by-id/wwn-0x50014ee2b53fc66a-part1  ONLINE       0     0     0
	    /dev/disk/by-id/wwn-0x50014ee26997baae-part1  ONLINE       0     0     0
	    /dev/disk/by-id/wwn-0x50014ee20a94f773-part1  ONLINE       0     0     0

errors: No known data errors

Do you have any indea what can be the issue? Running zfs-2.0.7 on RHEL8.

@syntaxerrormmm
Copy link

Running zfs-2.0.7 on RHEL8

I suspect it might have to do with SELinux, somehow.
/etc/zabbix is the worst place to put scripts in, the default place would be /usr/lib/zabbix/externalscripts.

@blind-oracle
Copy link
Owner

No idea. Well, you can move the script wherever you like and adjust the .conf file. And try disabling the SELinux (setenforce 0 or how it's done) and see if that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants