SOLVED Data for UPS is stale

bloomo

Explorer
Joined
Apr 4, 2014
Messages
58
PLEASE SEE MY LATER POST FOR THE SOLUTION
THANKS TO DLAVIGNE AND CYBERJOCK FOR THEIR HELP

Hi FreeNAS brethren,
I've scoured the forums and found a few entries with suggestions, but after adding what I could find as the most useful suggestion: "polinterval=11" to my GUI UPS auxiliary parameters to delay the data check, there is still no change. My logs are still inundated with the below messages:

May 14 16:59:27 TheShed upsmon[2516]: Communications with UPS CyberUPS established
May 14 17:01:06 TheShed upsd[2508]: Data for UPS [CyberUPS] is stale - check driver
May 14 17:01:07 TheShed upsd[2508]: UPS [CyberUPS] data is no longer stale
May 14 17:06:57 TheShed upsd[2508]: Data for UPS [CyberUPS] is stale - check driver
May 14 17:06:59 TheShed upsd[2508]: UPS [CyberUPS] data is no longer stale
May 14 17:35:54 TheShed upsd[2508]: Data for UPS [CyberUPS] is stale - check driver
May 14 17:35:55 TheShed upsd[2508]: UPS [CyberUPS] data is no longer stale
May 14 17:38:17 TheShed upsd[2508]: Data for UPS [CyberUPS] is stale - check driver
May 14 17:38:19 TheShed upsd[2508]: UPS [CyberUPS] data is no longer stale
May 14 17:39:21 TheShed upsd[2508]: Data for UPS [CyberUPS] is stale - check driver
May 14 17:39:22 TheShed upsmon[2516]: Poll UPS [CyberUPS] failed - Data stale
May 14 17:39:22 TheShed upsmon[2516]: Communications with UPS CyberUPS lost
May 14 17:39:23 TheShed upsd[2508]: UPS [CyberUPS] data is no longer stale
May 14 17:39:27 TheShed upsmon[2516]: Communications with UPS CyberUPS established
May 14 17:48:42 TheShed upsd[2508]: Data for UPS [CyberUPS] is stale - check driver
May 14 17:48:43 TheShed upsd[2508]: UPS [CyberUPS] data is no longer stale

This goes on for hours. Any thoughts? The UPS is responding to the upsc shell command and seems to be working fine apart from choking my log.

(UPS is a Cyber Power CP1000PFCLCD using the right driver on /dev/ugen1.5 as master)
 

bloomo

Explorer
Joined
Apr 4, 2014
Messages
58
Does bumping DEADTIME or MAXAGE improve it?
Thanks for this dlavigne. I've read it and the advice and logic sounds solid. Maybe I'm being daft, but I can't find the upsd.conf file in my system to edit... I've tried browsing and searching for it from Flow (mac sftp client) and I've even tried running
Code:
find . -name "upsd.conf"
from the shell... nuthin'. Do I just add the adjustment lines in the UPS auxiliary parameters in the GUI?
 
D

dlavigne

Guest
Now that is a good question and I wonder if the current UPS GUI updates/uses that file. My understanding is that the auxiliary parameters field updates ups.conf. Try adding it there and see if it makes a difference (e.g solves your problem), and more interestingly, generates that file. If it does neither, please create a bug report at bugs.freenas.org and post the issue number here. At the very least it is a doc bug, but it might also be a "not yet but should be implemented" bug.
 

bloomo

Explorer
Joined
Apr 4, 2014
Messages
58
Now that is a good question and I wonder if the current UPS GUI updates/uses that file. My understanding is that the auxiliary parameters field updates ups.conf. Try adding it there and see if it makes a difference (e.g solves your problem), and more interestingly, generates that file. If it does neither, please create a bug report at bugs.freenas.org and post the issue number here. At the very least it is a doc bug, but it might also be a "not yet but should be implemented" bug.
Found it, was using the wrong find file command. Needed to search all directories of all files everywhere.
It's in /etc/local/nut
upsd.conf and upsmon.conf are in there too. I'll give it a shot and report back.
 

bloomo

Explorer
Joined
Apr 4, 2014
Messages
58
Now that is a good question and I wonder if the current UPS GUI updates/uses that file. My understanding is that the auxiliary parameters field updates ups.conf. Try adding it there and see if it makes a difference (e.g solves your problem), and more interestingly, generates that file. If it does neither, please create a bug report at bugs.freenas.org and post the issue number here. At the very least it is a doc bug, but it might also be a "not yet but should be implemented" bug.
So I'm using "vi" to edit upsd.conf from Shell, but once open it's empty except for a single line: "Listen 127.0.0.1". Is this normal? Shouldn't there be a ton of stuff inside it??

upsmon.conf has plenty in there, but no lines pertaining to "deadtime". I guess I'm a little worried of adding lines unless I know the format. I would think that it would just take the fomat of
Code:
maxage=25
but I may hold off until I get confirmation from someone here...
 

bloomo

Explorer
Joined
Apr 4, 2014
Messages
58
Ha, really edging my way towards glory here...
So I managed to edit upsd.conf with vi from the shell and found the upsd.conf.sample files to guide the values I'm using. I added "MAXAGE 25" before the "LISTEN" line.

Before I did that I used "mount -uw /" and after I used "mount -ur", hoping that the changes to the .conf would stick past boot... but they're not...

Any thoughts?? Am I missing something?
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Yeah, you can't edit the files as they are "generated" on bootup based on your WebGUI settings.

You might be able to do something like:

service upsd stop
edit the file
service upsd start
 

bloomo

Explorer
Joined
Apr 4, 2014
Messages
58
Yeah, you can't edit the files as they are "generated" on bootup based on your WebGUI settings.

You might be able to do something like:

service upsd stop
edit the file
service upsd start
Ola cyberjock. Thanks for chiming in. I was starting to figure out trying to stop all UPS service and trying it all again. Weirdly, there are NO ups processes in my "running processes". When I run"service upsd stop", I get:
upsd does not exist in /etc/rc.d or the local startup
directories (/etc/ix.rc.d /usr/local/etc/rc.d)
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
oh.. I think it's nut or nut_upsmon. I don't use a UPS that is tied to my FreeNAS box so I can't check that for you.
 

bloomo

Explorer
Joined
Apr 4, 2014
Messages
58
Do you think turning the switch off in the services section should do the same thing?

Sent from my T0LTE using Tapatalk
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
well, if you turn it off it might delete the config file you are wanting to edit. That's why I recommended you do it from the CLI.

The important thing to keep in mind is you don't want to conflict with the WebGUI. If you stop the service from the CLI make sure you start it from the CLI again. ;)
 

bloomo

Explorer
Joined
Apr 4, 2014
Messages
58
Got it. That's probably why there are no services running right now... I edited a .conf that was in the process of being used.

Sent from my T0LTE using Tapatalk
 

bloomo

Explorer
Joined
Apr 4, 2014
Messages
58
Update: Used "service nut stop" to stop all the ups processes while I edited the upsd.conf. Started the nut service again and restarted and.... duh doh doh. No dice. The upsd.conf had reset itself again. If anyone has any bright ideas about getting changes to stick, your help would greatly unclog my log, so to speak :).
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
you started the nut service and restarted? Wha? You just stop the service from the CLI, make the change, then start the service. No rebooting or anything. This isn't meant as a permanent change. This was meant to prove that the fix will work, then we'll get the devs to implement it officially.
 

bloomo

Explorer
Joined
Apr 4, 2014
Messages
58
Yup, was still trying to make the changes stick. I was stopping and starting the service from the CLI.
It still doesn't make sense to me why the upsd.conf is being rewritten when the machine restarts. I get why ups.conf does as the GUI aux parameters take presidence.

I get what we're trying to achieve now. (It's been a long day and am admittedly being stubborn about not winning). Will report back soon...
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Literally all of the FreeNAS files are generated as the system boots up. Then, when you stop and start the services they are regenerated appropriately. This is why we tell people not to try to edit them and stuff. It'll never work and you'll be fighting a system that wants full control.

Once you've proven that the given change solves the problem we can look at trying to get it incorporated for everyone.
 

bloomo

Explorer
Joined
Apr 4, 2014
Messages
58
Makes sense. Protect us from ourselves right :)

I'll report back.

Sent from my T0LTE using Tapatalk
 

bloomo

Explorer
Joined
Apr 4, 2014
Messages
58
Literally all of the FreeNAS files are generated as the system boots up. Then, when you stop and start the services they are regenerated appropriately. This is why we tell people not to try to edit them and stuff. It'll never work and you'll be fighting a system that wants full control.

Once you've proven that the given change solves the problem we can look at trying to get it incorporated for everyone.

UPDATE: Sorry for the delay of a couple days, but I wanted to remove other variables ("pollinterval = 11" in the GUI) to make sure this was a true and last measure solve for the Stale Data issue. (With my UPS, anyway: Cyber Power CP1000PFCLCD).

Since I have implemented the below, my log has been beautifully silent. No more UPS stale data messages. This is what I did for anyone else that wants to try it:

# Enter the CLI through Shell or SSH in.
# Turn nut off (all the ups services):
Code:
service nut stop

# Mount / as read write:
Code:
mount -uw /

# Edit upsd.conf (I used vi. I can't show you here how to use it in totality, you’ll need to google-fu it, but will give a step by step of what I did).
Code:
vi /etc/local/nut/upsd.conf

# You're in the vi editor.
# Press (Shift)o #(not a zero, a capital OW is the result you want. This will insert a line at the top).
# Enter this value into the list.
Code:
MAXAGE 25

# Press esc which will exit you out of edit mode.
Code:
:wq!

# You are back at the CLI. Make / read only again.
Code:
mount -ur /

Start the nut service again.
Code:
service nut start


You should now have a wonderfully silent log, free of UPS stale data messages. I DID NOT add the DEADTIME value to upsmon.conf because on my UPS it didn’t need it. It also directly affects how long you run on battery without knowing what’s going on with the UPS so I didn’t want to mess with it.

Hopefully this can be adjusted in an upcoming release or added as an aux parameter field in the GUI one day. Right now, only the ups.conf is editable through GUI. But upsmon and upsd all have different values that affect different aspects of the nut service.

Hopefully all my info above is correct. Cyberdog/anyone else, let me know if you see any problems. Hope this helps someone. Below is part of the runout of my drivers and other ups data from upsc. My UPS is a Cyber Power CP1000PFCLCD.

device.mfr: CP1000PFCLCD
device.model: CRDA103*AF1
device.serial: CPS
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: /dev/ugen1.5
driver.version: 2.7.1
driver.version.data: CyberPower HID 0.3
driver.version.internal: 0.38
input.transfer.high: 139
input.transfer.low: 88
input.voltage: 122.0
input.voltage.nominal: 120
output.voltage: 138.0
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
This fix is great! But it won't survive a reboot. I would also like to point out that you need to make sure the usbhid-ups driver actually started. You should get similar results to what I have listed below. I had the driver fail to start once, so i started it manually to debug it but it worked that time. I then started the nut service again and everything started successfully. FYI to start driver manually run '/usr/local/libexec/nut/usbhid-ups -a ups -DDD'

Code:
[root@FreeNAS ~]# service nut start
Network UPS Tools - UPS driver controller 2.7.1
Network UPS Tools - Generic HID driver 0.38 (2.7.1)
USB communication driver 0.32
Using subdriver: CyberPower HID 0.3
libusb_get_interrupt: Unknown error
Starting nut.
Network UPS Tools upsd 2.7.1
fopen /var/db/nut/upsd.pid: No such file or directory
listening on 0.0.0.0 port 3493
Connected to UPS [ups]: usbhid-ups-ups
 
[root@FreeNAS ~]# ps auxw | grep ups
root 7763 0.0 0.0 20340 3820 ?? Is 7:31PM 0:00.00 /usr/local/sbin/upsmon localhost
uucp 7764 0.0 0.0 20340 3932 ?? S 7:31PM 0:00.01 /usr/local/sbin/upsmon localhost
uucp 7788 0.0 0.0 20340 3928 ?? Is 7:31PM 0:00.00 /usr/local/bin/upslog -s ups -l /var/log/ups.log -i 300
uucp 8099 0.0 0.0 14232 2148 ?? Ds 7:38PM 0:00.00 /usr/local/libexec/nut/usbhid-ups -a ups
uucp 8101 0.0 0.0 20356 3856 ?? Ss 7:38PM 0:00.00 /usr/local/sbin/upsd
 
Top