Alerting on macos with Example

All your general support questions for OpenZFS on OS X.

Alerting on macos with Example

Postby mike0810 » Fri Dec 02, 2022 2:48 am

Hi,

recently two of my disks were unavailable, gladly out of two different mirror pools.
I discovered this after a long time, but was able to resilver.

But as a general question: How do you configure alerting if the pool degrades or something on macos?
I mean just to get an email would be very nice.

Any suggestions?

Thanks a lot!
Last edited by mike0810 on Thu Jan 05, 2023 4:35 am, edited 1 time in total.
mike0810
 
Posts: 55
Joined: Fri Jan 16, 2015 5:17 pm

Re: Alerting on macos

Postby lundman » Sat Dec 03, 2022 4:54 pm

In theory, zed runs after OpenZFS install, and it has scripts which can send email. So it could be worth checking into that, just like Linux.

Another more GUI friendly way is ZetaWatch or similar 3rd party software.
User avatar
lundman
 
Posts: 1335
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: Alerting on macos

Postby mike0810 » Sat Dec 17, 2022 4:51 am

I want to share my experience:
So I decided to use pushover APP on ios to get alerts. ZED supports that.
1. Download the app, register your user and a new applicaton. You get a user token and an app token.
2. Open (as sudo) /etc/zfs/zed.d/zed.rc
3. Edit the following sections:
(for testing I set verbosity to 1, will turn it back to 0 later)
Code: Select all
##
# Notification verbosity.
#   If set to 0, suppress notification if the pool is healthy.
#   If set to 1, send notification regardless of pool health.
#
ZED_NOTIFY_VERBOSE=1
...
##
# Pushover token.
# This defines the application from which the notification will be sent.
#   <https://pushover.net/api#registration>
# Disabled by default; uncomment to enable.
# ZED_PUSHOVER_USER, below, must also be configured.
#
ZED_PUSHOVER_TOKEN="<Your_App_Token>"

##
# Pushover user key.
# This defines which user or group will receive Pushover notifications.
#  <https://pushover.net/api#identifiers>
# Disabled by default; uncomment to enable.
# ZED_PUSHOVER_TOKEN, above, must also be configured.
ZED_PUSHOVER_USER="<Your_User_Token>"


After that, run:
Code: Select all
ps aux | grep zed


output:
Code: Select all
root               <your_process_id>   0.0  0.0 409087488   1904   ??  Ss   Wed11AM   0:00.12 /usr/local/zfs/bin/zed -vfF


And then execute HUP with the process ID you got:
Code: Select all
sudo kill -HUP <your_process_id>


Test by creating a sparse image pool and scrub it:
Code: Select all
cd /tmp
dd if=/dev/zero of=sparse_file bs=1 count=0 seek=512M
sudo zpool create test /tmp/sparse_file
sudo zpool scrub test


This should get you an alert on the pushover app.
mike0810
 
Posts: 55
Joined: Fri Jan 16, 2015 5:17 pm

Re: Alerting on macos

Postby lundman » Sat Dec 17, 2022 4:31 pm

That's great, cheers for sharing. About the only comment is "pkill -HUP zed", saving you a couple of steps.

hmm you know what, pkill is Solaris, I see I have it aliases to

"killall -HUP zed".
User avatar
lundman
 
Posts: 1335
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan


Return to General Help

Who is online

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