Enable providing afpstats via D-Bus interface
Running 11.1-U2-RC5 and issuing the afpstats command from the CLI produces a traceback. Please find the verbiage below.
root@truenasbck:~ # afpstats
Traceback (most recent call last):
File "/usr/local/bin/afpstats", line 16, in main
File "/usr/local/lib/python2.7/site-packages/dbus/bus.py", line 241, in get_object
File "/usr/local/lib/python2.7/site-packages/dbus/proxies.py", line 248, in init
self._named_service = conn.activate_name_owner(bus_name)
File "/usr/local/lib/python2.7/site-packages/dbus/bus.py", line 180, in activate_name_owner
File "/usr/local/lib/python2.7/site-packages/dbus/bus.py", line 278, in start_service_by_name
'su', (bus_name, flags)))
File "/usr/local/lib/python2.7/site-packages/dbus/connection.py", line 651, in call_blocking
DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.netatalk.AFPStats was not provided by any .service files
#4 Updated by Vladimir Vinogradenko about 2 years ago
- Status changed from Not Started to Broken
- Reason for Blocked set to Waiting for feedback
I have found this https://redmine.ixsystems.com/issues/7886 and not a single evidence that situation has changed since then.
Has it ever been working on FreeNAS?
#5 Updated by Caleb St. John about 2 years ago
It seems like afpstats has never worked based on the last comment on that ticket. If we have another tool to you use (afpuser), then we should either
1. remove afpstats utility
2. symlink the afpstats utility to the afpusers utility
What do you think, Vlad?
#7 Updated by Dru Lavigne about 2 years ago
- Project changed from TrueNAS to FreeNAS
- Category changed from OS to OS
- Assignee changed from Ash Gokhale to Timur Bakeyev
- Target version changed from N/A to 11.2-RC2
- Support Suite Ticket deleted (
- Migration Needed deleted (
- Hide from ChangeLog deleted (
- Support Department Priority deleted (
After discussion with Kris, passing to Timur as will require a change to net/netatalk3. It is also possible that one of the default config options is breaking it.
#8 Updated by Timur Bakeyev about 2 years ago
It looks like that all
afpstats does is calling equivalent of:
dbus-send --system --dest=org.netatalk.AFPStats /org/netatalk/AFPStats --type=method_call org.netatalk.AFPStats.GetUsers
Possibly with the
--print-reply flag also. Need to test that on a live system with some AFP users connected to...
#11 Updated by Timur Bakeyev about 2 years ago
Ok, to make things work we need:
- Enable DBUS support for the
net/natatalk3port on the build
- In the
afpstats = yes
- Make sure server is restarted.
So, the fix is simple, if there are no objections - I'd implement it. I think
afpstats should be statically enabled, no need to make any switches for it in the GUI.
# dbus-send --system --dest=org.netatalk.AFPStats /org/netatalk/AFPStats --print-reply=literal --type=method_call org.netatalk.AFPStats.GetUsers array [ ] # afpstats #
As I don't have real consumers for it.
afpusers seems to be broken as well, at least in 11.1-U1:
# afpusers File "/usr/local/bin/afpusers", line 97 print "PID UID Username Name Logintime Mac" ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(int "PID UID Username Name Logintime Mac")?
#13 Updated by Timur Bakeyev about 2 years ago
It seems to work for me on 11-STABLE:
# afpusers PID UID Username Name Logintime Mac root@fn110-sdk:~# uname -a FreeBSD fn110-sdk.freenas 11.1-STABLE FreeBSD 11.1-STABLE #17 63185ca20c3(freenas/11-stable): Sat Jan 20 04:01:44 UTC 2018 root@gauntlet:/freenas-sdk/freenas/_BE/objs/freenas-sdk/freenas/_BE/os/sys/FreeNAS.amd64 amd64
#16 Updated by Caleb St. John about 2 years ago
I can confirm Timur's fix resolves the afpstats issue.
1. Compiling the netatalk3 port with dbus
2. afpstats = yes under the [Global] section of /usr/local/etc/afp.conf
This produces the following output from afpstats while an AFP session is active:
root@freenas:~ # afpstats
name: afp, pid: 70674, logintime: Feb 07 07:52:41, state: active, volumes: afp-share
#19 Updated by Timur Bakeyev about 2 years ago
- Status changed from In Progress to Done
- Target version changed from 11.2-RC2 to 11.1-U2
- Reason for Blocked deleted (
Waiting for feedback)