tag:blogger.com,1999:blog-6436915226903351789.post5240086807023997099..comments2023-05-18T03:55:07.415-06:00Comments on Anites: Monitoring a UPSSneak Meepleshttp://www.blogger.com/profile/14579238635007516554noreply@blogger.comBlogger41125tag:blogger.com,1999:blog-6436915226903351789.post-13904982216949023142021-03-17T03:34:13.962-06:002021-03-17T03:34:13.962-06:00Could you please post an example for a shutdown sc...Could you please post an example for a shutdown script for a Pi4 with latest OS when BATTERYLEVEL is reached in config?<br /><br />sudo nano doshutdown (in dir /etc/apcupsd/onbattery)<br /><br />thx ChrisAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-80684859941759419482019-06-13T18:42:41.952-06:002019-06-13T18:42:41.952-06:00have you tried to connect multiple UPS to the Pi? ...have you tried to connect multiple UPS to the Pi? They do not seem to have their own path in /dev so not sure how to control them individually Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-81618989178265261582019-01-30T15:36:29.699-07:002019-01-30T15:36:29.699-07:00I know this was written long ago but it is still v...I know this was written long ago but it is still very relevant today. I got it to do all I need right out of the box. The only difference with my system is I had already set it up to email out using Posix as a relay to gmail so I did not have to write scripts full of email code.<br />https://easyengine.io/tutorials/linux/ubuntu-postfix-gmail-smtp<br /><br />Then all i needed to do was change the "to" in the scripts supplied to me instead of "root". I actually cheated and modified root email settings (/root/.forward) to auto forward to me and I didn't need to change the scripts.<br /><br />Thanks for all the good work. you saved me, and a friend, hours and hours.Charles Godwinhttps://www.blogger.com/profile/14025946303723346417noreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-68611370205581905042019-01-11T15:44:11.268-07:002019-01-11T15:44:11.268-07:00This has been really helpful thanks
Regarding the ...This has been really helpful thanks<br />Regarding the alerts what is the syntax in the "to_email" if you want to add multiple emails do you put a , a ; a space?<br />to_emails = ["testemail@yahoo.com"]<br />THanks!!!Anonymoushttps://www.blogger.com/profile/10160041569170208974noreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-62490049974208170572018-12-05T00:50:55.346-07:002018-12-05T00:50:55.346-07:00Thanks for the tip and also, keeping the idea of a...Thanks for the tip and also, keeping the idea of a larger UPS to backup my refrigerator. <a href="https://medium.com/@martconnor312/blackout-is-your-uninterruptible-power-supply-well-maintained-75dbdf8b8c51" rel="nofollow">UPS maintenance</a> should be regularly checked to avoid complications when you need it most.Ryan Marylandhttps://www.blogger.com/profile/15969422136395867078noreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-24872979480409566782018-01-14T11:42:51.054-07:002018-01-14T11:42:51.054-07:00Script works very good, love it! But I can't ...Script works very good, love it! But I can't find the history (time power-outage and power-come-back).<br />With those scirpts, what would be instructions to add to write in a file and give inof? My internet router is in a different place and when the power goes down I lost internet right away so I can't received the mail but having a file that gives information, will help when the power goes back on.firehttps://www.blogger.com/profile/03896259819922118586noreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-77189255760997983172018-01-11T12:48:31.364-07:002018-01-11T12:48:31.364-07:00I just realised it's not necessary to reinvent...I just realised it's not necessary to reinvent the wheel - it's enough to create a script called doshutdown and insert there any actions you want to be performed when shutdown sequence is initiated...Rickyhttps://www.blogger.com/profile/10720316688755389090noreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-4042804301140519922018-01-10T02:40:26.907-07:002018-01-10T02:40:26.907-07:00Hi I managed to do the script that checks every 30...Hi I managed to do the script that checks every 30secs when TIMELEFT is <5 minutes, using the Python version of apcaccess (https://github.com/flyte/apcaccess). Here is the modified onbattery script:<br /><br /><br />#!/usr/bin/env python<br /><br />import smtplib<br />import email.mime.text<br />import syslog<br /><br />syslog.openlog('[UPS]')<br />def log(msg):<br /> syslog.syslog(str(msg))<br /><br />GMAIL_ADDRESS = ‘name@gmail.com’<br />GMAIL_PASSWORD = ‘password’<br /><br /><br />from_email = GMAIL_ADDRESS<br />to_emails = [“recipient@gmail.com”]<br /><br />msg_subject = "ALERT: UPS Power Failure"<br />msg_text = "Auto Notification"<br /><br />log(msg_subject)<br /><br />msg = email.mime.text.MIMEText(msg_text)<br />msg['Subject'] = msg_subject<br />msg['From'] = from_email<br />msg['To'] = ", ".join(to_emails)<br />s = smtplib.SMTP_SSL('smtp.gmail.com', '465')<br />s.login(GMAIL_ADDRESS, GMAIL_PASSWORD)<br />s.sendmail(from_email, to_emails, msg.as_string())<br />s.quit()<br /><br />msg2_subject = "ALERT: UPS triggered Shutdown"<br />msg2_text = "Auto Notification"<br /><br />msg2 = email.mime.text.MIMEText(msg2_text)<br />msg2['Subject'] = msg2_subject<br />msg2['From'] = from_email<br />msg2['To'] = ", ".join(to_emails)<br /><br /><br />while True:<br />>from apcaccess import status as apc<br /><br />>stato=apc.parse(apc.get(host="localhost"), strip_units=True)<br /><br />>value=stato['TIMELEFT']<br /><br />>newval=float(value)<br />>if newval <= 5:<br />>>s = smtplib.SMTP_SSL('smtp.gmail.com', '465')<br />>>s.login(GMAIL_ADDRESS, GMAIL_PASSWORD)<br />>>s.sendmail(from_email, to_emails, msg2.as_string())<br />>>s.quit()<br />>>break<br />>else:<br />>>time.sleep(10)<br /><br />It's my first Python attempt so some of you may be able to perfect it a bit<br /><br />Thanks<br />RRickyhttps://www.blogger.com/profile/10720316688755389090noreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-19142346787516759992018-01-10T02:36:11.192-07:002018-01-10T02:36:11.192-07:00This comment has been removed by the author.Rickyhttps://www.blogger.com/profile/10720316688755389090noreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-44541222683885066832017-12-28T13:33:32.853-07:002017-12-28T13:33:32.853-07:00To include the output of apcaccess you can just re...To include the output of apcaccess you can just replace the line:<br /><br />msg_text = "Auto Notification"<br /><br />with the following:<br /><br />import subprocess<br />msg_text = subprocess.check_output("apcaccess", shell=True)<br /><br />Andershttps://www.blogger.com/profile/01372721832493231775noreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-82054136626916896482017-10-26T10:13:24.699-06:002017-10-26T10:13:24.699-06:00you ll need to script that and place the script in...you ll need to script that and place the script in '/etc/apcupsd/onbattery'<br /><br />you ll probably need to set up a loop to check the TIMELEFT value, and when it is less than 5, run the 'poweroff' command<br /><br /><br />someth like <br />While [On battery]<br />if apcaccess | grep TIMELEFT< 5 minutes THEN run poweroff<br /><br />You ll have to play with the command to confirm the exact wording.<br /><br />v1ncen7https://www.blogger.com/profile/03393995506258988073noreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-2177587082674089212017-10-26T10:12:19.141-06:002017-10-26T10:12:19.141-06:00It may difficult to set it up to power down when 5...It may difficult to set it up to power down when 5 min are left, but you could have a script in the On Battery script to issue a shutdown to the pi, and it it is in the UPS's battery outlet, it would power up with the power coming back. Although, I think when the UPS shuts down, you have to manually turn it back on. This is how my APC's do it.Joe T.https://www.blogger.com/profile/14603543571365667222noreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-6917903443786257812017-10-26T09:53:04.431-06:002017-10-26T09:53:04.431-06:00I just need to set it up so when the power goes of...I just need to set it up so when the power goes off and there is 5 minutes of battery left it shuts down the Raspberry PI3, and when the power goes back online it starts the raspberry again.<br /><br />Anyway to do that?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-4656178136857075032017-08-09T15:44:20.575-06:002017-08-09T15:44:20.575-06:00This comment has been removed by the author.Anonymoushttps://www.blogger.com/profile/00498148707407129757noreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-36709085854936974832017-07-16T19:06:34.702-06:002017-07-16T19:06:34.702-06:00I now have 3 pi's monitoring 3 of the 4 ups un...I now have 3 pi's monitoring 3 of the 4 ups units in my house. They email me once a day with the status of their ups.Joe T.https://www.blogger.com/profile/14603543571365667222noreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-38043200967425270282017-07-16T18:57:08.913-06:002017-07-16T18:57:08.913-06:00It works! I had to make and install the latest ver...It works! I had to make and install the latest version for my Linux Mint 18 system, see:<br /><br /><a href="https://sourceforge.net/projects/apcupsd/files/apcupsd%20-%20Stable/3.14.14/" rel="nofollow">https://sourceforge.net/projects/apcupsd/files/apcupsd%20-%20Stable/3.14.14/</a><br /><br />Please note that those who use an USB cable should use this command:<br /><br />./configure --enable-usb<br /><br />instead of ./configure<br /><br />Prohttps://www.blogger.com/profile/06507269103949145920noreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-56403802160943645562017-06-27T03:41:47.648-06:002017-06-27T03:41:47.648-06:00This comment has been removed by the author.reginald suricthttps://www.blogger.com/profile/02865395258495641241noreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-27443039619961506102017-02-14T17:50:52.256-07:002017-02-14T17:50:52.256-07:00Call your script from the Onbattery script.Call your script from the Onbattery script.Joe T.https://www.blogger.com/profile/14603543571365667222noreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-60247424427769263362017-02-14T13:46:39.168-07:002017-02-14T13:46:39.168-07:00Did anybody perfect the scripts to send more info,...Did anybody perfect the scripts to send more info, like the output from apcaccess?v1ncen7https://www.blogger.com/profile/03393995506258988073noreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-34362812943992517692017-02-14T13:45:37.147-07:002017-02-14T13:45:37.147-07:00This comment has been removed by the author.v1ncen7https://www.blogger.com/profile/03393995506258988073noreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-71099024843477318632017-01-01T05:51:42.274-07:002017-01-01T05:51:42.274-07:00Please note if you’re intended to provide uninterr...Please note if you’re intended to provide uninterruptible power for a refrigerator, you’ll need an UPS with <b>SINE</b> form of output signal. Any ordinary UPS used for PC-s produces meander form of signal in battery mode, which may cause damage to a fridge motor. The same is right for any electrical appliance unit with non-impulse mode of power consumption. So please don’t use UPS with meander or “approximated sine” forms of signal for fridges and similar household appliances. Those UPS are for PC-s only. <b>Talk to a professional electrician, if necessary.</b><br />Good luck!<br />Anonymoushttps://www.blogger.com/profile/03635871455776532158noreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-58175604695858946592016-12-30T15:02:02.731-07:002016-12-30T15:02:02.731-07:00Thanks KennethB, after a lot of research, your app...Thanks KennethB, after a lot of research, your approach with the RPi is really clean and efficient. Had mine up and running easily. I have a question. ON Battery, OFF Battery is all good. What about this scenario: UPS Goes ON BATTERY, Message gets sent. UPS reaches your magic % run-time remaining and shuts down devices. UPS is OFF, so is RPi. POWER gets restored, UPS is back online, RPi is restarted. How do / or can I get notified that the power is back ON after the previous outage message.<br /><br />-FrEDAnonymoushttps://www.blogger.com/profile/03004548721432074177noreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-34362723949207850752016-12-27T07:45:16.950-07:002016-12-27T07:45:16.950-07:00I found a python script for my Dlink DNS-323's...I found a python script for my Dlink DNS-323's on the forum for the NAS.<br />Joe T.https://www.blogger.com/profile/14603543571365667222noreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-48994842522064118812016-12-26T21:54:06.128-07:002016-12-26T21:54:06.128-07:00How do you shutdown your servers? SNMP? I want t...How do you shutdown your servers? SNMP? I want to shutdown my NAS (Qnap TAS-168) using SNMP, how can I send the SNMP command? Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6436915226903351789.post-89512435000335600252016-12-05T06:42:21.560-07:002016-12-05T06:42:21.560-07:00Check out this blog about flexispy phone monitorin...<a href="http://phonetrackingapps.com/flexispy-review/" rel="nofollow">Check out this blog about flexispy phone monitoring application</a>. I bet it will be useful.Anonymousnoreply@blogger.com