arcstat in rc7 on BigSur

All your general support questions for OpenZFS on OS X.

arcstat in rc7 on BigSur

Postby abc123 » Wed May 19, 2021 11:09 am

Running arcstat on Big Sur fails:

Code: Select all
$ arcstat
Traceback (most recent call last):
  File "/usr/local/zfs/bin/arcstat", line 554, in <module>
    main()
  File "/usr/local/zfs/bin/arcstat", line 527, in main
    init()
  File "/usr/local/zfs/bin/arcstat", line 395, in init
    snap_stats()
  File "/usr/local/zfs/bin/arcstat", line 226, in snap_stats
    kstat_update()
NameError: name 'kstat_update' is not defined


Same for arc_summary

Code: Select all
russell@kylie ~> arc_summary
Traceback (most recent call last):
  File "/usr/local/zfs/bin/arc_summary", line 966, in <module>
    main()
  File "/usr/local/zfs/bin/arc_summary", line 917, in main
    kstats = get_kstats()
  File "/usr/local/zfs/bin/arc_summary", line 411, in get_kstats
    result[section] = load_kstats(section)
NameError: name 'load_kstats' is not defined


Python setup:
Code: Select all
$ python --version
Python 2.7.16
$ which python
/usr/bin/python


This is a new install of zfs rc7 (not had any previous version installed). Any suggestions to try and fix it?

Thanks
abc123
 
Posts: 63
Joined: Mon Jan 30, 2017 11:46 pm

Re: arcstat in rc7 on BigSur

Postby jeffc » Wed May 19, 2021 11:21 am

It's not new to rc7. I'm still running rc5 and I see it too.
jeffc
 
Posts: 13
Joined: Wed Jan 13, 2021 5:35 pm

Re: arcstat in rc7 on BigSur

Postby lundman » Wed May 19, 2021 1:41 pm

They removed the arcstat.pl (perl) version which we had tweaked to work for osx. Now there is only the python, which has yet been updated. It is supposed to
call "sysctl kstat" to fetch the values.
User avatar
lundman
 
Posts: 1335
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: arcstat in rc7 on BigSur

Postby abc123 » Wed Jan 05, 2022 7:53 am

OK, here's a mod for the arcstat script. Add the following at about line 186:

Code: Select all
elif sys.platform.startswith('darwin'):
    import subprocess

    def kstat_update():
        global kstat

        process = subprocess.Popen(['sysctl', 'kstat.zfs.misc.arcstats'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
        kstats = process.communicate()[0].decode('ascii').splitlines()

        kstat = {}
        for l in kstats:
            items = l.split(':')
            name = items[0]
            value = items[1].strip()
            kstat[name[24:]] = int(value)


Python isn't my first language :)
abc123
 
Posts: 63
Joined: Mon Jan 30, 2017 11:46 pm

Re: arcstat in rc7 on BigSur

Postby abc123 » Wed Jan 05, 2022 11:43 pm

What's the difference between sysctl and zsysctl? Which should we use here?

Also, do you think we need to fully qualify the path? Given they're running it from terminal, it should be on the path anyway. And something I saw suggested the location of sysctl has changed in different versions of OS X which makes it trickier.

I'll look at arc_summary next.
abc123
 
Posts: 63
Joined: Mon Jan 30, 2017 11:46 pm

Re: arcstat in rc7 on BigSur

Postby lundman » Thu Jan 06, 2022 2:05 am

I'll look at merging your changes into arcstat.

zsysctl i thought was what we run after kextload to load any settings set in zsysctl.conf, so they stay across boots.
User avatar
lundman
 
Posts: 1335
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: arcstat in rc7 on BigSur

Postby abc123 » Thu Jan 06, 2022 5:46 am

OK, I'll leave it as sysctl

Attached are my copies of arcstat and arc_summary, both which now work, although I was a little unsure on what to do with the vdev params for arc_summary so have taken Linux's approach for now.

These are modified from 2.1.0-1 release versions.
Attachments
zfs_arc.zip
(15 KiB) Downloaded 187 times
abc123
 
Posts: 63
Joined: Mon Jan 30, 2017 11:46 pm

Re: arcstat in rc7 on BigSur

Postby lundman » Thu Jan 06, 2022 6:53 pm

If you wanted to make a PR that would be immensely helpful, but otherwise I can pick out the changes you've made.
User avatar
lundman
 
Posts: 1335
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: arcstat in rc7 on BigSur

Postby abc123 » Thu Jan 06, 2022 9:51 pm

OK, I've given it a go.
abc123
 
Posts: 63
Joined: Mon Jan 30, 2017 11:46 pm

Re: arcstat in rc7 on BigSur

Postby lundman » Thu Jan 06, 2022 9:59 pm

Can't believe that worked! Thanks for the PR
User avatar
lundman
 
Posts: 1335
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Next

Return to General Help

Who is online

Users browsing this forum: Google [Bot] and 27 guests

cron