LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-02-2011, 06:04 PM   #1
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Rep: Reputation: 54
apcupsd - is there a way to get a UPSes status?


Is there a way with apcupsd to get current ups status? Like battery percentage left, that kind of thing? I've been struggling trying to get it to work with an old UPS, and after it just made the UPS shut off (causing the server to go down) I decided to just try with my UPS upstairs instead (just wired the management through my patch panel for now). I got it going to the point where it detects a power outage, but is there not a way I can query the status to get more info?

I have it setup to eventually shut down but it would be nice to get status such as how long I have before it does so, and so on.

There's a GUI utility that I downloaded but it just says connection refused.
 
Old 06-02-2011, 06:18 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Have you tried running apcaccess status (as root) from a shell? If it doesn't work you may have to re-configure your apcupsd.conf file.
 
Old 06-02-2011, 06:21 PM   #3
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
Yeah I just get

Error contacting apcupsd @ localhost:3551: Connection refused

I know it's running, because if I unplug the UPS I do get a power failure notice.

Another thing, how do I change the shutdown sequence? The documentation says to edit apccontrol but it's very vague as to what you have to do. I tried a bunch of things, no luck. It just calls shutdown, I want to call my own script as I need to do a graceful shutdown of VMs.
 
Old 06-02-2011, 06:34 PM   #4
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Have a look in /etc/apcupsd/apcupsd.conf (it may be in a different location on your box). The following settings should be all that is needed:
Code:
NETSERVER on
NISPORT 3551
As far as the shutdown script goes, I run Slackware and the apcupsd installer modified the system shutdown script to include the /etc/apcupsd/apccontrol killpower command. The man page for apccontrol says not to modify apccontrol, but instead:
Code:
The recommended way to customise an event action is simply to create an
 executable program or script file with the same name as the event and put 
that file in the /etc/apcupsd directory. Now, when the selected event occurs, 
apccontrol will execute your program or script.
 
Old 06-02-2011, 06:45 PM   #5
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
Yep the server command is on. Basically I have pretty much everything set as default.

For the custom shutdown I also tried creating a file as the doc says but it still wont call it. It's like if any of the changes I'm making arn't actually taking effect. I do restart the service each time as well.
 
Old 06-02-2011, 07:02 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Basically, you can create your own script for a specific case i.e. powercut, killpower, onbattery etc. If your script exists it will be called first when apccontrol executes.

http://www.vologda.ru/~slivin/doc/ap...l/ch10s01.html

Have you check the apcupsd logs?
 
1 members found this post helpful.
Old 06-02-2011, 07:19 PM   #7
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
Hmm maybe my problem is I need to create a file for all of the possible causes of a shutdown, not just the doshutdown command. I will try that and see if that helps.
 
Old 06-02-2011, 08:11 PM   #8
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
Ok so it turns out that's what it is, I need to have a script for each command, not just doshutdown. Guess it makes sense eh. It works now. I don't really care about the status part anymore though it would be nice. I figured this would be harder to troubleshoot and the status would have helped troubleshoot, but I got it working and that's what counts.

When the system needs to shut down for any reason the same script gets called and all my VMs are turned off and given a grace period of 3 minutes then the system itself is shut down. Should give enough time.

Moved the UPS to the server room and it's all setup now. Was having too much trouble with the existing UPS there, so I swapped with my workstation.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
APCUPSD Problem, apcaccess status is blank davide123 Linux - Software 8 02-04-2011 01:51 PM
Does Linux get info from UPSes? Mr. Alex Linux - Hardware 1 11-21-2010 01:54 PM
What's the Current Status of apcupsd, or Any Alternatives MQMan Linux - Software 1 01-03-2009 02:55 PM
Help with apcupsd Rustylinux Red Hat 1 07-31-2008 10:13 PM
Installing RedHat 8.0 onto Dell PowerEdge SC1425 - hdc: status error: status = 0x58 fishsponge Linux - General 0 07-11-2006 09:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration