Re: [Nut-upsuser] Megatec driver floods logs #2 mail notifications

2009-12-30 Thread Yury V. Zaytsev
On Tue, 2009-12-29 at 15:20 +0100, Arjen de Korte wrote:
 Citeren Yury V. Zaytsev y...@shurup.com:
 
  Please keep the list traffic on the list so that the others can benefit.
 
 But please note that the messages are in English. If it is in Russian,  
 feel free to take it off-list.

Or rather use Google translate to translate it into English. I don't
want to speak for the others (but probably it's still the case for most,
that's why this list is still around), but personally I don't have time
to provide free private support to anyone. 

Season greetings!
 
-- 
Sincerely yours,
Yury V. Zaytsev


___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] Megatec driver floods logs #2 mail notifications

2009-12-29 Thread Yury V. Zaytsev
Hi!

Please keep the list traffic on the list so that the others can benefit.

1) Be sure that an MTA is installed and working:

mail -s Test y...@mail.com EOF
Test!
EOF

2) Be sure that the script has correct permissions:

chmod ugo+x /mnt/data/scripts/ups-notifier

3) Be sure that it actually works:

/mnt/data/scripts/ups-notifier lineup
/mnt/data/scripts/ups-notifier linedown
/mnt/data/scripts/ups-notifier lineup

You should get only 2 e-mails!

4) Be sure that your configuration is correct:

upsmon.conf:

# ZYV
NOTIFYCMD /usr/sbin/upssched 

# ZYV
NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC
NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC

upssched.conf:

CMDSCRIPT /mnt/data/scripts/ups-notifier 

# ZYV
PIPEFN /var/run/nut/upssched.pipe
LOCKFN /var/run/nut/upssched.lock

# ZYV

# The timers, here 3 min after the ONBATT (ups on battery) event
AT ONBATT * START-TIMER linedown 180

# Cancel the countdown is power is back
AT ONLINE * CANCEL-TIMER linedown

AT ONLINE * EXECUTE lineup

HTH,
 
-- 
Sincerely yours,
Yury V. Zaytsev

On Tue, 2009-12-29 at 19:14 +0800, Михаил wrote:
 Юрий!
 Подскажите , какие изменения нужно сделать в upsmon.conf , чтобы ваш скрипт 
 выполнялся? 
 указал путь к скрипту-
 
 NOTIFYCMD /sw/sbin/notifyme
 
 Я убрал коммет в строках:
 ___
 
 NOTIFYFLAG ONLINE SYSLOG
 NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC
 __
 И  подправил скрипт под себя, должен работать. 
 
 Проверяю так - выдергиваю вилку ( питание ups из сети) , спустя минуту 
 вставляю обратно. В консоли появляется сообщение
 
 Broadcast Message from _mdnsrespon...@mihails-power-mac-g4.local  
  
 (no tty) at 18:48 ULAT... 
  
   
  
 UPS su620i...@localhost:3493 on battery   
  
   
  
   
  
 Broadcast Message from _mdnsrespon...@mihails-power-mac-g4.local  
  
 (no tty) at 18:52 ULAT... 
  
   
  
 UPS su620i...@localhost:3493 on line power 
 _
 но письмо не приходит.
 
 Спасибо.
 Михаил
 pano@gmail.com
 
 
 
 On 29 Dec 2009, at 05:38, Yury V. Zaytsev wrote:
 
  On Mon, 2009-12-28 at 22:02 +0100, Arjen de Korte wrote:
  
  This is trivial to script. Create an empty file somewhere your  
  CMDSCRIPT has write access to when the 'linedown' timer elapses (ie,  
  when you send the warning mail). In your 'lineup' event check for the  
  presence of this file. If it is there, you need to send a message that  
  the power is back and remove the file. You can improve this above, by  
  also checking the age of the file (to prevent triggering on stale  
  files that are accidentally left behind).
  
  Hi!
  
  Thanks for the ideas! Please find my implementation attached. Hopefully
  it will be of use to someone... at least now it's googleable :-)
  
  -- 
  Sincerely yours,
  Yury V. Zaytsev
  ups-notifier___
  Nut-upsuser mailing list
  Nut-upsuser@lists.alioth.debian.org
  http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser



___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Megatec driver floods logs #2 mail notifications

2009-12-29 Thread Arjen de Korte

Citeren Yury V. Zaytsev y...@shurup.com:


Please keep the list traffic on the list so that the others can benefit.


But please note that the messages are in English. If it is in Russian,  
feel free to take it off-list.


Best regards, Arjen
--
Please keep list traffic on the list


___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] Megatec driver floods logs #2 mail notifications

2009-12-28 Thread Yury V. Zaytsev
Hi!

On Mon, 2009-12-28 at 08:26 -0500, Justin Piszcz wrote:
 
 For no. 1:

I'm actually trying to make use of upssched to avoid notifications for
short outages like ~ 1 minute or so. So far I've added two lines:

# The timers, here 60 sec after the ONBATT (ups on battery) event
AT ONBATT * START-TIMER onbatt 60

# Cancel the countdown is power is back
AT ONLINE * CANCEL-TIMER onbatt

As far as I understand, my

CMDSCRIPT /mnt/data/scripts/ups-notifier

will get triggered with onbatt parameter if the outage lasts more than
60 seconds, but I would like it to be triggered if, say when the power
comes back online within a reasonable amount of time and the shutdown is
canceled to inform everybody that there's no need to rush to the lab.

Is there a way to achieve these two goals at the same time?

Thanks! 
 
-- 
Sincerely yours,
Yury V. Zaytsev


___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] Megatec driver floods logs #2 mail notifications

2009-12-28 Thread Yury V. Zaytsev
Hi!

On Mon, 2009-12-28 at 20:54 +0100, Arjen de Korte wrote:

 I don't understand what you mean with first and second goal. Please  
 make a timeline with events and what you want to happen at each point  
 in time.

OK, I will try to put it the other way around :-) (let's assume that the
UPS battery is fully charged for clarity)

1) If the power goes down but then comes back within 1-3 minutes do
nothing (don't send emails etc.)

2) If the power goes down for longer then 3 minutes send a power down
e-mail.

3) If the power comes back send a power back e-mail and cancel shutdown.

4) If the power does not come back and the battery is drained (in my
tests in can last for ~15 minutes) shutdown the machine and hope for the
best.

So far I was not able to achieve this by simple means. So I settled with
the following setup:

# The timers, here 3 min after the ONBATT (ups on battery) event
AT ONBATT * START-TIMER linedown 180

# Cancel the countdown is power is back
AT ONLINE * CANCEL-TIMER linedown

AT ONLINE * EXECUTE lineup

It sends a power back e-mail no matter what, but probably we can live
with it.

Thanks!
 
-- 
Sincerely yours,
Yury V. Zaytsev


___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] Megatec driver floods logs #2 mail notifications

2009-12-28 Thread Arjen de Korte

Citeren Yury V. Zaytsev y...@shurup.com:

[...]


It sends a power back e-mail no matter what, but probably we can live
with it.


This is trivial to script. Create an empty file somewhere your  
CMDSCRIPT has write access to when the 'linedown' timer elapses (ie,  
when you send the warning mail). In your 'lineup' event check for the  
presence of this file. If it is there, you need to send a message that  
the power is back and remove the file. You can improve this above, by  
also checking the age of the file (to prevent triggering on stale  
files that are accidentally left behind).


Best regards, Arjen
--
Please keep list traffic on the list


___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] Megatec driver floods logs #2 mail notifications

2009-12-28 Thread Yury V. Zaytsev
On Mon, 2009-12-28 at 22:02 +0100, Arjen de Korte wrote:

 This is trivial to script. Create an empty file somewhere your  
 CMDSCRIPT has write access to when the 'linedown' timer elapses (ie,  
 when you send the warning mail). In your 'lineup' event check for the  
 presence of this file. If it is there, you need to send a message that  
 the power is back and remove the file. You can improve this above, by  
 also checking the age of the file (to prevent triggering on stale  
 files that are accidentally left behind).

Hi!

Thanks for the ideas! Please find my implementation attached. Hopefully
it will be of use to someone... at least now it's googleable :-)
 
-- 
Sincerely yours,
Yury V. Zaytsev


ups-notifier
Description: application/shellscript
___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser