Bonjour je n?arrive pas ? configurer convenablement NUT pour qu?il m?adresse des SMS en cas de coupure de courant. C?est important pour moi car dans ma maison les coupures sont tr?s fr?quentes. Voici ma configuration : ****************************************************************** 1/ dans /etc/nut/upsmon.conf MONITOR eaton at localhost 1 admin motdepasse master MINSUPPLIES 1 SHUTDOWNCMD "/sbin/shutdown -h now" HOSTSYNC 15 POWERDOWNFLAG /etc/nut/killpower FINALDELAY 5 NOTIFYCMD /sbin/upssched NOTIFYMSG ONBATT "%s is on battery" NOTIFYMSG ONLINE "%s is back online" NOTIFYMSG SHUTDOWN "System is being shutdown!" NOTIFYFLAG ONLINE SYSLOG+EXEC NOTIFYFLAG ONBATT SYSLOG+EXEC NOTIFYFLAG SHUTDOWN SYSLOG+EXEC 2/ dans /etc/nut/upssched.conf CMDSCRIPT /usr/bin/upssched-cmd PIPEFN /var/run/nut/upssched/upssched.pipe LOCKFN /var/run/nut/upssched/upssched.lock AT ONBATT * START-TIMER upssms 30 AT ONLINE * CANCEL-TIMER upssms AT ONBATT * START-TIMER upsgone 150 AT ONLINE * CANCEL-TIMER upsgone AT ONBATT * EXECUTE upssms AT ONLINE * EXECUTE ups-back-on-power 3/ le script /usr/bin/upssched-cmd #!/bin/bash case $1 in upssms) logger -t upssched-cmd "The UPS has been gone for 30 secs. Warn by sms..." /bin/echo "Power failed. System will hibernate soon..." | curl "command" ;; upsgone) logger -t upssched-cmd "The UPS has been gone for 2 and a half minutes. Hibernating..." /usr/sbin/upsmon -c fsd # call a shutdown in NUT instead ;; ups-back-on-power) logger -t upssched-cmd "The UPS power has been restored." /bin/echo "Power restored." | curl "command" ;; *) logger -t upssched-cmd "Unrecognized command: $1" esac ****************************************************************** Le probl?me que je rencontre est le suivant : quand je coupe l??lectricit? se coupe je ne re?ois pas la notification par SMS (via CURL) alors que je re?ois la notification quand l??lectricit? est r?tablie. Et je ne trouve pas la raison. O? se trouverait mon erreur ? Merci de m?aider. Philippe
On Tue, 14 Jun 2016, Philippe Le Mesle wrote:> Voici ma configuration : > ****************************************************************** > 3/ le script /usr/bin/upssched-cmd > #!/bin/bash > case $1 in > upssms) > logger -t upssched-cmd "The UPS has been gone for 30 secs. Warn by sms..." > /bin/echo "Power failed. System will hibernate soon..." | curl "command" > ;;...> ups-back-on-power) > logger -t upssched-cmd "The UPS power has been restored." > /bin/echo "Power restored." | curl "command" > ;;...> esac > > ****************************************************************** > Le probl?me que je rencontre est le suivant : > > quand je coupe l??lectricit? se coupe je ne re?ois pas la notification > par SMS (via CURL) alors que je re?ois la notification quand > l??lectricit? est r?tablie.Si je comprends bien, dans le cas ups-back-on-power, curl envoie un SMS, mais dans le cas upssms curl n'envoie rien. Si ups-back-on-power marche, c'est que NUT marche correctement. Alors il faut regarder de plus pres l'operation de curl. Je suggere dans le cas upssms, ajouter -v ? curl, et essayer la commande /usr/bin/upssched-cmd upssms manuellement sans passer par NUT. (Try adding the -v option to curl in the case where it doesn't send an SMS, and run the command /usr/bin/upssched-cmd upssms manually) Roger
Bonjour, Juste pour en ?tre s?r : l'ensemble de la cha?ne de transmission est bien aliment?e par l'onduleur en cas de coupure de courant ? Les switch, routeur, modem/box, etc...(tout ce que curl doit traverser pour envoyer le sms) ? Slts, Ren? Le 14/06/2016 11:30, Philippe Le Mesle a ?crit?:> Bonjour > je n?arrive pas ? configurer convenablement NUT pour qu?il m?adresse > des SMS en cas de coupure de courant. > C?est important pour moi car dans ma maison les coupures sont tr?s > fr?quentes. > > Voici ma configuration : > ****************************************************************** > 1/ dans /etc/nut/upsmon.conf > MONITOR eaton at localhost 1 admin motdepasse master > MINSUPPLIES 1 > SHUTDOWNCMD "/sbin/shutdown -h now" > HOSTSYNC 15 > POWERDOWNFLAG /etc/nut/killpower > FINALDELAY 5 > NOTIFYCMD /sbin/upssched > NOTIFYMSG ONBATT "%s is on battery" > NOTIFYMSG ONLINE "%s is back online" > NOTIFYMSG SHUTDOWN "System is being shutdown!" > > NOTIFYFLAG ONLINE SYSLOG+EXEC > NOTIFYFLAG ONBATT SYSLOG+EXEC > NOTIFYFLAG SHUTDOWN SYSLOG+EXEC > > 2/ dans /etc/nut/upssched.conf > CMDSCRIPT /usr/bin/upssched-cmd > > PIPEFN /var/run/nut/upssched/upssched.pipe > LOCKFN /var/run/nut/upssched/upssched.lock > > AT ONBATT * START-TIMER upssms 30 > AT ONLINE * CANCEL-TIMER upssms > > AT ONBATT * START-TIMER upsgone 150 > AT ONLINE * CANCEL-TIMER upsgone > > AT ONBATT * EXECUTE upssms > AT ONLINE * EXECUTE ups-back-on-power > > 3/ le script /usr/bin/upssched-cmd > #!/bin/bash > case $1 in > upssms) > logger -t upssched-cmd "The UPS has been gone for 30 secs. Warn by > sms..." > /bin/echo "Power failed. System will hibernate soon..." | curl > "command" > ;; > upsgone) > logger -t upssched-cmd "The UPS has been gone for 2 and a half > minutes. Hibernating..." > /usr/sbin/upsmon -c fsd # call a shutdown in NUT instead > ;; > ups-back-on-power) > logger -t upssched-cmd "The UPS power has been restored." > /bin/echo "Power restored." | curl "command" > ;; > *) > logger -t upssched-cmd "Unrecognized command: $1" > esac > > ****************************************************************** > Le probl?me que je rencontre est le suivant : > > quand je coupe l??lectricit? se coupe je ne re?ois pas la notification > par SMS (via CURL) > alors que je re?ois la notification quand l??lectricit? est r?tablie. > > Et je ne trouve pas la raison. > O? se trouverait mon erreur ? > > Merci de m?aider. > Philippe > > _______________________________________________ > Nut-upsuser mailing list > Nut-upsuser at lists.alioth.debian.org > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser
On Tue, 14 Jun 2016, Philippe Le Mesle wrote:> "essayer la commande /usr/bin/upssched-cmd upssms manuellement sans > passer par NUT." L? je ne comprends pas (je d?bute en Linux). Comment > puis-je ex?cuter cette commande ,> PS: pr?f?rez-vous que cet ?change soit en anglais ?It is better to write in english on this list. Also, please reply to the list, not to the writer. In the same way that you can execute directly commands such as "date", "w" and "pwd", you can also execute "/usr/bin/upssched-cmd upssms" from the command line. Try it! Perhaps an introductory book to Linux would help you. Roger
Roger? Can your read me? The command from the command line works fine. "Perhaps an introductory book to Linux would help you." You?re right. I bought this great book "A la d?couverte du Raspberry Pi" by Matt Richardson (NUT monitoring is done on the RPI2 I recently bought). But I?m still a beginner (and an old one). 2016-06-14 15:51 GMT+02:00 Roger Price <roger at rogerprice.org>:> On Tue, 14 Jun 2016, Philippe Le Mesle wrote: > >> "essayer la commande /usr/bin/upssched-cmd upssms manuellement sans passer >> par NUT." L? je ne comprends pas (je d?bute en Linux). Comment puis-je >> ex?cuter cette commande , > > >> PS: pr?f?rez-vous que cet ?change soit en anglais ? > > > It is better to write in english on this list. Also, please reply to the > list, not to the writer. > > In the same way that you can execute directly commands such as "date", "w" > and "pwd", you can also execute "/usr/bin/upssched-cmd upssms" from the > command line. Try it! > > Perhaps an introductory book to Linux would help you. > > Roger > _______________________________________________ > Nut-upsuser mailing list > Nut-upsuser at lists.alioth.debian.org > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser
Sorry, but when reply I to the list its been moderated and there?s no answer. My last message doesnt even appear ?on http://lists.alioth.debian.org/pipermail/nut-upsuser/2016-June/010182.html The command line works fine and it gave: * Hostname was NOT found in DNS cache * Trying 212.27.40.200... * Connected to smsapi.free-mobile.fr (212.27.40.200) port 443 (#0) * successfully set certificate verify locations: * CAfile: none CApath: /etc/ssl/certs * SSLv3, TLS handshake, Client hello (1): * SSLv3, TLS handshake, Server hello (2): * SSLv3, TLS handshake, CERT (11): * SSLv3, TLS handshake, Server key exchange (12): * SSLv3, TLS handshake, Server finished (14): * SSLv3, TLS handshake, Client key exchange (16): * SSLv3, TLS change cipher, Client hello (1): * SSLv3, TLS handshake, Finished (20): * SSLv3, TLS change cipher, Client hello (1): * SSLv3, TLS handshake, Finished (20): * SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256 * Server certificate: * subject: CN=*.free-mobile.fr * start date: 2016-05-24 00:00:00 GMT * expire date: 2018-06-23 23:59:59 GMT * subjectAltName: smsapi.free-mobile.fr matched * issuer: C=US; O=GeoTrust Inc.; CN=RapidSSL SHA256 CA * SSL certificate verify ok.> GET /sendmsg?user=195xxxxxx&pass=jeXXUxxxxxxxxx&msg=Coupure%20electrique HTTP/1.1 > User-Agent: curl/7.38.0 > Host: smsapi.free-mobile.fr > Accept: */* >< HTTP/1.1 200 OK * Server nginx is not blacklisted < Server: nginx < Date: Tue, 14 Jun 2016 15:25:00 GMT < Transfer-Encoding: chunked < Connection: keep-alive < 2016-06-14 15:51 GMT+02:00 Roger Price <roger at rogerprice.org>:> On Tue, 14 Jun 2016, Philippe Le Mesle wrote: > >> "essayer la commande /usr/bin/upssched-cmd upssms manuellement sans passer >> par NUT." L? je ne comprends pas (je d?bute en Linux). Comment puis-je >> ex?cuter cette commande , > > >> PS: pr?f?rez-vous que cet ?change soit en anglais ? > > > It is better to write in english on this list. Also, please reply to the > list, not to the writer. > > In the same way that you can execute directly commands such as "date", "w" > and "pwd", you can also execute "/usr/bin/upssched-cmd upssms" from the > command line. Try it! > > Perhaps an introductory book to Linux would help you. > > Roger > _______________________________________________ > Nut-upsuser mailing list > Nut-upsuser at lists.alioth.debian.org > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser