Martin Ivanov
2006-Aug-16 11:58 UTC
[Nut-upsuser] Master privileges unavailable on UPS, no access :(
Hello! After I type "upsmon", in syslog the following message appears: Aug 16 14:11:09 marto upsmon[7731]: Master privileges unavailable on UPS [Inform@localhost] Aug 16 14:11:09 marto upsmon[7731]: Reason: Access denied Can you tell me where my error is, my configuration files are: ups.conf: [Inform] driver = powercom port = /dev/ttyS0 desc = "inform guard" linevoltage = 220 type = KIN1500AP upsd.conf: ACL all 0.0.0.0/0 ACL localhost 127.0.0.1/32 ACCEPT localhost REJECT all ups.users: root password = pwd allowfrom = localhost actions = SET instcmds = ALL marto password = pwd allowfrom = localhost upsmon master upsmon.conf: MONITOR Inform@localhost 1 marto pwd master Thank you very much in advance. Regards, Martin ----------------------------------------------------------------- http://ide.li/ - ?????? ?? ????????? ?? ?????. ??????, ??????, ??????, ??????, ??????????.
Jonathan Dion
2006-Aug-16 13:25 UTC
[Nut-upsuser] Master privileges unavailable on UPS, no access :(
Hi ! I see two problem in your configuration : On 8/16/06, Martin Ivanov <tramni@abv.bg> wrote:> Hello! > After I type "upsmon", in syslog the following message appears: > Aug 16 14:11:09 marto upsmon[7731]: Master privileges unavailable on UPS [Inform@localhost] > Aug 16 14:11:09 marto upsmon[7731]: Reason: Access denied > Can you tell me where my error is, my configuration files are: > ups.conf: > [Inform] > driver = powercom > port = /dev/ttyS0 > desc = "inform guard" > linevoltage = 220 > type = KIN1500AP > upsd.conf: > ACL all 0.0.0.0/0 > ACL localhost 127.0.0.1/32 > > ACCEPT localhost > REJECT all > ups.users:The file containing the users information should be nammed upsd.users don't forget the "d"> rootUser names declaration must be in bracket, like the ups declaration : [root]> password = pwd > allowfrom = localhost > actions = SET > instcmds = ALL > martoSame here : [marto]> password = pwd > allowfrom = localhost > upsmon master > upsmon.conf: > MONITOR Inform@localhost 1 marto pwd master > > Thank you very much in advance. > Regards, > Martin > > ----------------------------------------------------------------- > http://ide.li/ - ?????? ?? ????????? ?? ?????. ??????, ??????, ??????, ??????, ??????????. > > _______________________________________________ > Nut-upsuser mailing list > Nut-upsuser@lists.alioth.debian.org > http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser >Like this, the parser didn't recognize user declaration. It interprets all the lines as global settings, and as upsd don't support any global setting for users for the moment, it drops it (without any warning message). Then upsd don't know any user. Upsd don't verify if users have been declarated, so no warning message neither (For some tools like upsc for instance, users declaration aren't needed) So of course upsd rejects upsmon when it try to connect with user marto. Cheer, Jonathan Dion
Jonathan Dion
2006-Aug-16 14:36 UTC
[Nut-upsuser] Master privileges unavailable on UPS, no access :(
Hi Martin, please keep the discusion on the mailing list, it can be helpfull/of interrest for other persons ^_^ So I took the fredom to past here you previous mail : -- Begining the mail of Martin Thank you very much indeed, this worked. But in syslog there are no messages like: "May 29 01:11:27 mybox upsmon[102]: Startup successful May 29 01:11:28 mybox upsd[100]: Client monuser@192.168.50.1 logged into UPS [myupsname] " which the install file says thre should be. How can I be sure whether the configuration is correct? What shall I do so that after the UPS is disconnected from the mains, the command "shutdown -h now" or "telinit 0" is send to the computer? I have already checked that when the ups is connected to the main, the command "upsc Inform@localhost ups.status" gives "OL", and when it is disconnected from the mains, the same command gives "OB BOOST". MINSUPPLIES 1 SHUTDOWNCMD "/sbin/shutdown -h now" POLLFREQ 5 POLLFREQALERT 5 HOSTSYNC 0 DEADTIME 15 POWERDOWNFLAG /etc/killpower NOTIFYMSG ONLINE "UPS %s is getting line power" NOTIFYMSG ONBATT "Someone pulled the plug on %s" RBWARNTIME 43200 NOCOMMWARNTIME 300 FINALDELAY 0 What shall I do so that when I disconnect the UPS from the mains, I get the notify messages and the shutdown command is executed? I experimented with the current configuration, disconnecting the UPS from the mains, but I neither got any messages, nor the PC shutdown. I waited for about a minute and a half. -- End of the mail of Martin Did you started upsmon with a debug level ? If so, it don't become a daemon and don't write "Startup succesfull" in syslog. For mybox upsd[100]: Client monuser@192.168.50.1 logged into UPS [myupsname], I saw the function that print this message, but I didn't find any place where she is called. I'm quite new in the NUT developer team, so I don't know why this function is not used, or no longer used. Perhaps another function has been made and is used. So it is probably that the documentation is not up to date with the software, or that modification of the software didn't kept this behavior. Can someone the know upsd and upsmon functionment better than me confirm this point ? If there was a change, shouldn't we restore this behaviour ? For your others problems : Do you run upsmon as root ? To display the messages, upsmon use wall. Depending of the user used to send it, of the configuration of your system, it may not be displayed correctly. I remember there was discusion about this point but don't find the link again... Here are some others links that could interest you : http://www.webservertalk.com/archive245-2005-12-1328449.html http://www.networkupstools.org/doc/1.4.0/osd-notify.html For the shutdown, upsmon normally start the shutdwon command not if the UPS is OnBatt (OB), but when it reach critical state : OnBatt and LowBatt at the same time. And as I hope for you your UPS can be on battery for one minute and a half without being low battery, it is normal your system didn't shuted down Cheer, jonathan Dion
Jonathan Dion
2006-Aug-16 16:04 UTC
[Nut-upsuser] Master privileges unavailable on UPS, no access :(
Hi ^_^ Please "reply to all" when you reply Martin, so it stay in the list ^_^ thanks you. On 8/16/06, Martin Ivanov <tramni@abv.bg> wrote:> Thank you very much for your responsiveness. I followed your instructions and those of the site you gave to me, downloaded, compiled and installed the xosd package. I issued the command "xhost +local:marto. > Then I modified upsmon.conf like that: > RUN_AS_USER marto > MONITOR Inform@localhost 1 marto password master > MINSUPPLIES 1 > SHUTDOWNCMD "/sbin/shutdown -h now" > NOTIFYCMD /usr/local/ups/bin/notifyme > POLLFREQ 5 > POLLFREQALERT 5 > HOSTSYNC 0 > DEADTIME 15 > POWERDOWNFLAG /etc/killpower > NOTIFYMSG ONLINE "UPS %s is getting line power" > NOTIFYMSG ONBATT "Someone pulled the plug on %s" > NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC > RBWARNTIME 43200 > NOCOMMWARNTIME 300 > FINALDELAY 0 > The file notifyme is executable and contains: > echo "The system is shutting down" > > When I unplugged the UPS, nothing happened, no message,no shutdown. I do not care so much about the messages, my primary desire is to make the system issue the command "shutdown -h now" or "telinit 0" whenever the ups.status=OB BOOST, i.e whenever the mains electric supply fails. I want the system to go down when the mains power goes down, not when the UPS battery gets low or on the verge of exhaustion. Isn't there some way to achieve that? > > I am looking forward to your answer. > > Regards, > Martin > > ----------------------------------------------------------------- > http://ide.li/ - ?????? ?? ????????? ?? ?????. ??????, ??????, ??????, ??????, ??????????. >Regarding the message issue, I have the same problem, I only receive notify when I log into a xterm and not if I log into a Konsole. I never dug anymore into this problem, but I know that it was a subject of concern for Arnaud (NUT Leader). Regarding the shutdown command : Are you sure you want this behaviour ? It would say that even for micro power outage, your computer would shutdown. On some UPS, there is the possibility to set the low battery value, so the low battery flag triggers earlier, before the battery is "on the verge of exhaustion". In most case, the low battery is trigered when battery comes to 30% or 20% of capability. It usually let enough time to shutdown the computer. I think it would be better to do it like that if your UPS allow it. Even set it to 90% if you want, but I think shutting down each time there is a minor power outage is cutting down the interest to have an UPS. Anyway, I'll answer your question : there is a way to do it, of course ^_^ The NOTIFYCMD flag in upsmon.conf define the command to launch every time an event that have EXEC in its NOTIFYFLAG occures. you can make a shell script launched with this, that test if the event that triggered him was OnBatt (if you put EXEC not only on ONBATT, no use else to test) and if it was call "shutdown -h now" For more information about how NOTIFYCMD works and how to get the event in the called script, please look "man upsmon.conf" Cheer, Jonathan Dion
Jonathan Dion
2006-Aug-17 06:48 UTC
[Nut-upsuser] Master privileges unavailable on UPS, no access :(
Hello Martin, Sorry not to have answered before, but I was sleeping ^_^ To stay in the mailing list, either choose "answer to all" when you answer me (I think all mail software have this possibility), or add nut-upsuser@lists.alioth.debian.org as a recipient of your mail I copy your mails : --first mail I beg your pardon, mister, but I do not know how to reply to all. I just communicate with you from my private email, because I couldn't figure out how to communicate via tha mail list :(. If you explain to me what to do so that everyone else sees our communication, I will be glad to carry it out :) So long as I understand you, in order to achieve system shutdown at a power failure, I have to cahange the configuration like that: NOTIFYCMD /usr/local/ups/bin/notifyme NOTIFYMSG ONLINE "UPS %s is getting line power" NOTIFYMSG ONBATT "Someone pulled the plug on %s" NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC The file notifyme should contain: echo "The system is shutting down"; telinit 0; Will it work? What do you think? I want to set the power control like this, because I am not sure that the ups I am using fits this driver. That is why I wish to test it: I want to see if the system will go down whenever I unplug the UPS. Besides, because of the fact that I am not sure I am using the right driver, I do not know whether the real UPS state of low battery will be recognized as such by the software. And I do not feel like experimenting with the low battery status. So I will be content if my PC goes down whenever there is a power failure. Once I achieve that, I will see how to achieve better performance. Probably I will again need your help. If you suggest me some way to simulate the "on battery" and the " low battery" and test the system behaviour, would be best :) -- second mail So, let me now tell you what I achieved so far: I modified upsmon.conf like that: RUN_AS_USER root MONITOR Inform@localhost 1 root password master MINSUPPLIES 1 SHUTDOWNCMD "/sbin/shutdown -h now" NOTIFYCMD /usr/local/ups/bin/notifyme POLLFREQ 5 POLLFREQALERT 5 HOSTSYNC 0 DEADTIME 15 POWERDOWNFLAG /etc/killpower NOTIFYMSG ONLINE "UPS %s is getting line power" NOTIFYMSG ONBATT "Someone pulled the plug on %s" NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC RBWARNTIME 43200 NOCOMMWARNTIME 300 FINALDELAY 0 The file notifyme is executable and contains: echo "The system is shutting down" > /home/marto/opit /sbin/telinit 0 The upsd.users file is: [root] password = 98221026 allowfrom = localhost upsmon master actions = SET instcmds = ALL With this configuration, whenever I diconnect the UPS from the mains, the system shutsdown normally. I would be glad if there is some way of tellin g the ups itself to power off, after the PC shuts down, but only in case that ups.status has turned "OB BOOST", i.e. only in cas there has been power failure. What I have so far achieved suffices me for now, but things can always get better. Concisely, I have two questions: 1. How to make the UPS power off after the PC powers off in case of power failure. Of course when there is no power failure, but I issue shutdown command to the system, the UPS must not power off. 2. I would be glad if you suggest me how to improve my configuration files: ups.conf, upsd.conf, upsd.users and upsmon.conf. They work ok now, but I am sure something can be embettered :) Thank you very much indeed for your responsiveness. -- third mail On 8/16/06, Martin Ivanov <tramni@abv.bg> wrote:> Hello again! > Here is how I further modified the executable file notifyme, so that upsmon does almost everything that I wish for: > echo `date` >> /root/upsLog > echo " No power, shutting down the system!" >> /root/upsLog > sleep 30 > control=`/usr/local/ups/bin/upsc Inform@localhost ups.status` > if [ $control != OL ] > then > /sbin/telinit 0 > fi > > So if power returns within 30 sec, the system will not go to shutdown :). If power does not return, then the system goes to runlevel 0. The UPS goes on buzzing, but it can go on buzzing like that for quite a lot time before the battery gets damaged, because the PC is off and the power consumption from the UPS battery is minimal, am I not right? I am not quite sure whether I need to make the UPS itself go down in case of power failure, because if it does not go down, it has the chance to get charged when power returns. Do you think I am right? What would you recommend to me? > > ----------------------------------------------------------------- > http://ide.li/ - ?????? ?? ????????? ?? ?????. ??????, ??????, ??????, ??????, ??????????. >So... ok, I give you my pardon ;-) Nice, I see you achieve what you wanted. But you know, if the driver you use is able to see the change of state when your UPS is disconnected, I'm pretty sure it also is able to see the low battery flag. As I see, the driver already know when to display OL, OB and BOOSt status, so it probably know too when to display LB status Can you send us the result of the execution of "upsc Inform@localhost". If all the information is here and seem correct, the driver probably manage your UPS just fine. If you want to test it without any risk, connect your PC directly to the main, without using your UPS for power supply, but plug your UPS to the PC normally. Run the driver, upsd and upsmon normally. The problem is that you'll need to have something alimented by the UPS so its battery charge dicrease. An old PC could be good. Disconnect the UPs from main and wait. The PC should poweroff as soon as the UPS reach lowbattery. You should really not be confident on your UPS to only let it 30seconds on battery before shutting down the PC XD Your method work of course but has a little problem : the case where two very short power outage hapen the second 30 seconds after the first. For shutting down the UPS, I see that Peter already replied to you on this. It is always better to poweroff the UPS if it is lowbattery and no more needed because the computer is off. To improve your configuration files... nothing to add in ups.conf, nothing neither in upsd.users. your upsmon.conf file seem nice. Perhaps you should try not to run upsmon as root, but it could be a problem. I know upsmon start as root then duplicate itself to run with RUN_AS_USER user (if this user is not root). The root upsmon is then only here to launch the shutdown command in case it is needed. In this case, your NOTIFYCMD would'nt be launch as root and could not have the right to shutdown the system. But if you are not paranoiac about security, there is no need to do that. oh, and in the line : MONITOR Inform@localhost 1 root password master password must be changed to be the password of [root] NUT user (98221026 in your case) Cheer, Jonathan Dion
Jonathan Dion
2006-Aug-17 09:02 UTC
[Nut-upsuser] Master privileges unavailable on UPS, no access :(
Hi, On 8/17/06, Martin Ivanov <tramni@abv.bg> wrote:> So, this is the result of upsc Inform@localhost with the UPS connected to the mains: > battery.charge: 97.7 > driver.name: powercom > driver.parameter.linevoltage: 220 > driver.parameter.port: /dev/ttyS0 > driver.parameter.type: KIN1500AP > driver.version: 2.0.4 > driver.version.internal: $ Revision: 0.5 $ > input.frequency: 49.61 > input.voltage: 236.3 > input.voltage.nominal: 220 > output.frequency: 49.10 > output.voltage: 236.3 > ups.load: 38.9 > ups.mfr: PowerCom > ups.model: Unknown > ups.model.type: KIN1500AP > ups.serial: Unknown > ups.status: OL > > and this is the same, but with the UPS disconnected from the mains: > > battery.charge: 145.0 > driver.name: powercom > driver.parameter.linevoltage: 220 > driver.parameter.port: /dev/ttyS0 > driver.parameter.type: KIN1500AP > driver.version: 2.0.4 > driver.version.internal: $ Revision: 0.5 $ > input.frequency: 0.00 > input.voltage: -0.1 > input.voltage.nominal: 220 > output.frequency: 49.61 > output.voltage: 34.5 > ups.load: 153.0 > ups.mfr: PowerCom > ups.model: Unknown > ups.model.type: KIN1500AP > ups.serial: Unknown > ups.status: OBI'm afraid you may be right, your UPS may not be supported by the driver you use, because having a charge of 145% and a ups.load of 153% is... quite strange ^_^> > Mister, I am afraid I do not dare experiment with the UPS, forcing it into "LB" status. Once already I had to replace my UPS because of wreck battery, so I do not want to risk it once again. I really feel quite content with my system's power control now. The PC switches off 30 sec after the power failure and the UPS is far from "LB" status at that time. It goes on buzzing, but I think it is safe, for the power consumption from it is minimal. Am I not right? The same would happen if my PC is off, there is nobody at home and the power fails: the UPS will start buzzing until the power returns.Yes, without the load of the PC, your UPS can buzz longer than with a charge (obviously). But how many time... it depends on your UPS model. It can be hours, or days. Normally, UPS should have a protection and shutdown themselves if the battery is too low, but with some low price model, there could not be such a protection. I cannot help you on this point, try asking the manufacturer.> And if it happens that there are two short power falures one exactly 30 sec after the other, my PC will shutdown. Ok, having in mind the possibility for such a thing to happen, I do not find it quite annoying really :). Of course if you do not see some significant potential problem in all that. > And concerning the UPS shutdown, > I remind you my notifyme script: > > echo `date` >> /root/upsLog > echo " No power, shutting down the system!" >> /root/upsLog > sleep 30 > control=`/usr/local/ups/bin/upsc Inform@localhost ups.status` > if [ $control != OL ] > then > /sbin/telinit 0 > fi > > I tried adding the line: "touch /etc/powerdown" to the "notifyme" script and the lines: > > if (test -f /etc/powerdown) > then > echo "Killing the power, bye!" > /usr/local/ups/bin/upsdrvctl shutdown > > sleep 120 > > fi > > to the /etc/rc.d/rc.6 script, but when I simulated a power failure, the system shut down, but the UPS did not. I think I did not add the lines at the correct place in the rc.6 script, or probably there is poor communication between the UPS and the software, for I am not sure the software I am using is for my UPS. In Slackware, rc.6 is the script that is executed when the system goes to runlevel 0 or 6. > Besides, I am not quite sure whether I need to make the UPS itself go down in case of power failure, because if it does not go down, it has the chance to get charged when power returns. > So what would you recommend to me? Make the UPS itself power off after system shutdown in case of power failure, or leave it buzzing till power returns? Remember, ny system is configured to shutdown well before the ups.status becomes "LB". > In case you advise me to make the UPS go down itself after the system shutdown, I will be thankful to you if you tell me if the method I suggest to achieve that is working and where in the shutdown script I need to add it?I never worked on the shutdown of UPSs, so I cannot help on this point. As you said, it is either a mistake you made, that your UPS don't support shutdown command or that the driver you use don't know how to properly ask the UPS to shutdown (or maybe a mix of the three ^_^) Perhaps someone that better know the shutdown process can help you better than me.> > Thank you for your responsiveness. > Regards, > Martin > > ----------------------------------------------------------------- > http://ide.li/ - ?????? ?? ????????? ?? ?????. ??????, ??????, ??????, ??????, ??????????. >you're welcome Jonathan Dion