[Nut-upsuser] Apple Mac slave

Robbie van der Walle rvanderwalle at gmail.com
Fri Jun 9 09:43:15 UTC 2017


>> After the first test and the NAS is restarted I had to change the setting battery.charge.low again to 80 
> 
> Does the NAS DSM reset battery.charge.low to 10 or is it internal to the UPS?  You will have to experiment by disconnecting the UPS control lead from the NAS and connecting it (if possible) to the Mac.  After setting to 80 and a power off-on cycle is the value 80 or 10?

Ok I will have try this.  I am also searching on the NAS if it set somehow. 

>> 3. Users from the NAS are warned, not yet the Mac user.  Only when executing automatic power-fail shutdown. 
> 
> In upsmon.conf on the Mac, what are the values of NOTIFYMSG ONBATT and NOTIFYFLAG ONBATT?  Does program wall work on the Mac? It fails on a lot of Linux boxes with graphical interfaces - to get a message to the user, you have to use notify-send, which means setting up upssched.

# NOTIFYMSG - change messages sent by upsmon when certain events occur
#
# You can change the default messages to something else if you like.
#
# NOTIFYMSG <notify type> "message"
#
# NOTIFYMSG ONLINE	"UPS %s on line power"
# NOTIFYMSG ONBATT	"UPS %s on battery"
# NOTIFYMSG LOWBATT	"UPS %s battery is low"
# NOTIFYMSG FSD		"UPS %s: forced shutdown in progress"
# NOTIFYMSG COMMOK	"Communications with UPS %s established"
# NOTIFYMSG COMMBAD	"Communications with UPS %s lost"
# NOTIFYMSG SHUTDOWN	"Auto logout and shutdown proceeding"
# NOTIFYMSG REPLBATT	"UPS %s battery needs to be replaced"
# NOTIFYMSG NOCOMM	"UPS %s is unavailable"
# NOTIFYMSG NOPARENT	"upsmon parent process died - shutdown impossible"
#
# Note that %s is replaced with the identifier of the UPS in question.
#
# Possible values for <notify type>:
#
# ONLINE   : UPS is back online
# ONBATT   : UPS is on battery
# LOWBATT  : UPS has a low battery (if also on battery, it's "critical")
# FSD      : UPS is being shutdown by the master (FSD = "Forced Shutdown")
# COMMOK   : Communications established with the UPS
# COMMBAD  : Communications lost to the UPS
# SHUTDOWN : The system is being shutdown
# REPLBATT : The UPS battery is bad and needs to be replaced
# NOCOMM   : A UPS is unavailable (can't be contacted for monitoring)
# NOPARENT : The process that shuts down the system has died (shutdown impossible)

# --------------------------------------------------------------------------
# NOTIFYFLAG - change behavior of upsmon when NOTIFY events occur
#
# By default, upsmon sends walls (global messages to all logged in users)
# and writes to the syslog when things happen.  You can change this.
#
# NOTIFYFLAG <notify type> <flag>[+<flag>][+<flag>] ...
#
# NOTIFYFLAG ONLINE	SYSLOG+WALL
# NOTIFYFLAG ONBATT	SYSLOG+WALL
# NOTIFYFLAG LOWBATT	SYSLOG+WALL
# NOTIFYFLAG FSD	SYSLOG+WALL
# NOTIFYFLAG COMMOK	SYSLOG+WALL
# NOTIFYFLAG COMMBAD	SYSLOG+WALL
# NOTIFYFLAG SHUTDOWN	SYSLOG+WALL
# NOTIFYFLAG REPLBATT	SYSLOG+WALL
# NOTIFYFLAG NOCOMM	SYSLOG+WALL
# NOTIFYFLAG NOPARENT	SYSLOG+WALL
#
# Possible values for the flags:
#
# SYSLOG - Write the message in the syslog 
# WALL   - Write the message to all users on the system
# EXEC   - Execute NOTIFYCMD (see above) with the message
# IGNORE - Don't do anything
#
# If you use IGNORE, don't use any other flags on the same line.

NOTIFYFLAG ONLINE EXEC
NOTIFYFLAG ONBATT EXEC
NOTIFYFLAG LOWBATT EXEC
NOTIFYFLAG NOCOMM EXEC
NOTIFYFLAG COMMBAD IGNORE 
NOTIFYFLAG COMMOK IGNORE
NOTIFYFLAG SHUTDOWN IGNORE
NOTIFYFLAG FSD EXEC
NOTIFYFLAG NOPARENT SYSLOG


> Does program wall work on the Mac?

file testwall:

hallo 

tried: wall testwall and result:

Broadcast Message from                                        
        (/dev/ttys002) at 11:28 CEST...                                        
                                                                               
hallo	                          


So wall work in a terminal only. 

> It fails on a lot of Linux boxes with graphical interfaces - to get a message to the user, you have to use notify-send, which means setting up upssched.

# NOTIFYCMD <command>
#
# upsmon calls this to send messages when things happen
#
# This command is called with the full text of the message as one argument.
# The environment string NOTIFYTYPE will contain the type string of
# whatever caused this event to happen.
#
# Note that this is only called for NOTIFY events that have EXEC set with
# NOTIFYFLAG.  See NOTIFYFLAG below for more details.
#
# Making this some sort of shell script might not be a bad idea.  For more
# information and ideas, see pager.txt in the docs directory.
#
# Example:
# NOTIFYCMD /usr/local/ups/bin/notifyme

NOTIFYCMD /sw/sbin/upssched



Results second test 1 after changing on NAS, Control Panel Hardware & Power, Power recovery, Restart automatically after a power failure. And changing on the Mac, system preferences, energy saver, start up automatically after a power failure. 


1 Pull power cord

2 Ups beeps NAS and Mac work

3 NAS users warned. Mac not

4 low bat, first slave Mac shutdown.  Than Master NAS shutdown. ( report in log NAS, server is on battery, server going to safe shutdown) 

5 UPS shutdown after 29 seconds. 

6 reconnect power 

7 NAS now starts up but Mac doesn’t 





Kind Regards,

Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20170609/9d45d41e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3583 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20170609/9d45d41e/attachment-0001.bin>


More information about the Nut-upsuser mailing list