View previous topic :: View next topic |
Author |
Message |
Joseph_sys Advocate
Joined: 08 Jun 2004 Posts: 2712 Location: Edmonton, AB
|
Posted: Sun Jun 07, 2015 3:40 pm Post subject: apcupsd - not emailing me when power down |
|
|
My remote box is connected direclty to apcups and it is running "apcupsd"
However, when I pull the cord out of the wall the "onbattery" script is not
email me anything.
My configuration: apcupsd.conf
Code: | UPSCABLE usb
UPSTYPE usb
DEVICE
POLLTIME 60
LOCKFILE /var/lock
SCRIPTDIR /etc/apcupsd
PWRFAILDIR /etc/apcupsd
NOLOGINDIR /etc
ONBATTERYDELAY 6
BATTERYLEVEL 60
MINUTES 10
TIMEOUT 0
ANNOY 300
ANNOYDELAY 60
NOLOGON disable
KILLDELAY 0
NETSERVER on
NISIP 0.0.0.0
NISPORT 3551
EVENTSFILE /var/log/apcupsd.events
EVENTSFILEMAX 10
UPSCLASS standalone
UPSMODE disable
STATTIME 0
STATFILE /var/log/apcupsd.status
LOGSTATS off
DATATIME 0 |
onbattery - script suppose to be called by "/etc/apcupsd/apccontrol" and execute it.
What am I missing?
I have "mailto" installed and it is working. I sent an email to "root" and I received it.
There is nothing to be configured in "onbattery" script. |
|
Back to top |
|
|
mvaterlaus Apprentice
Joined: 01 Oct 2010 Posts: 234 Location: Switzerland
|
Posted: Mon Jun 08, 2015 8:22 am Post subject: |
|
|
hi,
you have to edit the on battery event script and send yourself a mail when the script is executet. Normally, apcupsd sends a message via wall, so all logged in users are notified that the ups is running on battery. If you do not implement the mailing part, you wont get any mails.
You could also send a mail for every event by replacing the ${WALL} command in the apccontrol script, but if you overwrite the wall command, your logged in users are not notified when the ups status changes and they probably will get an unexpected logout. _________________ For calming down your eyes or clearing your mind: www.patrickwehli.ch |
|
Back to top |
|
|
Joseph_sys Advocate
Joined: 08 Jun 2004 Posts: 2712 Location: Edmonton, AB
|
Posted: Mon Jun 08, 2015 8:01 pm Post subject: |
|
|
mvaterlaus wrote: | hi,
you have to edit the on battery event script and send yourself a mail when the script is executet. Normally, apcupsd sends a message via wall, so all logged in users are notified that the ups is running on battery. If you do not implement the mailing part, you wont get any mails.
You could also send a mail for every event by replacing the ${WALL} command in the apccontrol script, but if you overwrite the wall command, your logged in users are not notified when the ups status changes and they probably will get an unexpected logout. |
onbattery - script suppose to be called by "/etc/apcupsd/apccontrol" and execute it. What am I missing?
I have "mailto" installed and it is working. I sent an email to "root" and I received it.
There is nothing to be configured in "onbattery" script:
Code: | #!/bin/sh
#
# This shell script if placed in /etc/apcupsd
# will be called by /etc/apcupsd/apccontrol when the UPS
# goes on batteries.
# We send an email message to root to notify him.
#
SYSADMIN=root
APCUPSD_MAIL="/bin/mail"
HOSTNAME=`hostname`
MSG="$HOSTNAME Power Failure !!!"
#
(
echo "Subject: $MSG"
echo " "
echo "$MSG"
echo " "
/sbin/apcaccess status
) | $APCUPSD_MAIL -s "$MSG" $SYSADMIN
exit 0
The script is called by apccontrol and SYSADMIN=root |
Yes, I have "/bin/mail" on the path.
So I don't know why isn't it working. |
|
Back to top |
|
|
mvaterlaus Apprentice
Joined: 01 Oct 2010 Posts: 234 Location: Switzerland
|
Posted: Mon Jun 08, 2015 8:33 pm Post subject: |
|
|
ok. i didn't know the mail part is already scripted in gentoo. please have a look at the var ONBATTERYDELAY in your apcupsd.conf. It will tell you, how long it takes unitl the event ONBATTERY is raised.
also, have a look at /var/log/apcupsd.event and pull out the cable to see if the event appears in the log. _________________ For calming down your eyes or clearing your mind: www.patrickwehli.ch |
|
Back to top |
|
|
Joseph_sys Advocate
Joined: 08 Jun 2004 Posts: 2712 Location: Edmonton, AB
|
Posted: Mon Jun 08, 2015 11:30 pm Post subject: |
|
|
mvaterlaus wrote: | ok. i didn't know the mail part is already scripted in gentoo. please have a look at the var ONBATTERYDELAY in your apcupsd.conf. It will tell you, how long it takes unitl the event ONBATTERY is raised.
also, have a look at /var/log/apcupsd.event and pull out the cable to see if the event appears in the log. |
I just checked the log "apcupsd.events" is not registering anything from apcupsd.
I unplug/plug the power from the wall and there was no entry in the /var/log/apcupsd.events
Code: | tail /var/log/apcupsd.events
2015-06-06 17:29:57 -0600 Valid lock file for pid=2386, but not ours pid=32492
2015-06-06 17:29:57 -0600 apcupsd FATAL ERROR in device.c at line 71
Unable to create UPS lock file.
If apcupsd or apctest is already running,
please stop it and run this program again.
2015-06-06 17:29:57 -0600 Valid lock file for pid=2386, but not ours pid=32492
2015-06-06 17:29:57 -0600 apcupsd error shutdown completed
2015-06-06 17:35:07 -0600 apcupsd exiting, signal 15
2015-06-06 17:35:07 -0600 apcupsd shutdown succeeded
2015-06-06 17:35:46 -0600 apcupsd 3.14.8 (16 January 2010) gentoo startup succeeded |
My configuration: apcupsd.conf Code: | sed -e 's/#.*//' -e '/^$/ d' apcupsd.conf
UPSCABLE usb
UPSTYPE
DEVICE
LOCKFILE /var/lock
SCRIPTDIR /etc/apcupsd
PWRFAILDIR /etc/apcupsd
NOLOGINDIR /etc
ONBATTERYDELAY 6
BATTERYLEVEL 60
MINUTES 10
TIMEOUT 0
ANNOY 300
ANNOYDELAY 60
NOLOGON disable
KILLDELAY 0
NETSERVER on
NISIP 0.0.0.0
NISPORT 3551
EVENTSFILE /var/log/apcupsd.events
EVENTSFILEMAX 10
UPSCLASS standalone
UPSMODE disable
STATTIME 0
STATFILE /var/log/apcupsd.status
LOGSTATS off
DATATIME 0 |
apccontrol - I did not touch it.
The apcupsd is started. |
|
Back to top |
|
|
mvaterlaus Apprentice
Joined: 01 Oct 2010 Posts: 234 Location: Switzerland
|
|
Back to top |
|
|
Joseph_sys Advocate
Joined: 08 Jun 2004 Posts: 2712 Location: Edmonton, AB
|
Posted: Tue Jun 09, 2015 10:27 pm Post subject: |
|
|
apctest - is working Code: | apctest
2015-06-09 16:21:45 apctest 3.14.8 (16 January 2010) gentoo
Checking configuration ...
Attached to driver: usb
sharenet.type = DISABLE
cable.type = USB_CABLE
You are using a USB cable type, so I'm entering USB test mode
mode.type = USB_UPS
Setting up the port ...
Hello, this is the apcupsd Cable Test program.
This part of apctest is for testing USB UPSes.
Getting UPS capabilities...SUCCESS
Please select the function you want to perform.
1) Test kill UPS power
2) Perform self-test
3) Read last self-test result
4) View/Change battery date
5) View manufacturing date
6) View/Change alarm behavior
7) View/Change sensitivity
8) View/Change low transfer voltage
9) View/Change high transfer voltage
10) Perform battery calibration
11) Test alarm
12) View/Change self-test interval
Q) Quit |
Though the problem I think it might be my small box. "Intel(R) Atom(TM) CPU 330 @ 1.60GHz"
Though, I don't know how this could be causing a problem.
On a remote location I have two computers connected to this APCUPS, one is this Atom and another one full-tower box that is running apcupsd in a slave mode; and it is working correctly. When power goes down I get and email from my tower-box; but not from small one Atom. |
|
Back to top |
|
|
|