Menu

#5228 monitor.pl NUT UPS stderr messages in mail from cron

1.900
closed-fixed
nobody
5
2019-01-17
2019-01-16
No

I have the "System and Server Status" configured to monitor my UPS for power outage and such, using NUT UPS. It mostly works fine. The problem is that every time the monitor.pl runs and checks the UPS, the NUT client is outputing stuff to stderr, which then gets passed via e-mail to me. So I'm getting an email every minute that looks like this:

From: Cron Daemon
Subject: Cron <root@server> /etc/webmin/status/monitor.pl
Init SSL without certificate database

I decided I should set up SSL for the NUT server so it might shut this up. That actually made it worse. Now the emails contain all this:

Init SSL without certificate database
Connecting in SSL to 'localhost' (no certificate name specified)
Do not intend to authenticate server localhost
SSL handshake done successfully with server localhost
Connected to localhost in SSL
Certificate verification is disabled

This is because the NUT UPS client is outputting these messages to stderr. Ideally I think you would pipe stderr to /dev/null when running it so this doesn't happen. There are several posts on Stack Overflow and such about this.

Discussion

  • Tyrel Haveman

    Tyrel Haveman - 2019-01-16

    I was able to make it quiet on my system by changing this line in nut-monitor.pl:

    open(SENS, "upsc ".quotemeta($_[0])."  |");
    

    To this:

    open(SENS, "upsc ".quotemeta($_[0])." 2>/dev/null |");
    
     
  • Jamie Cameron

    Jamie Cameron - 2019-01-17
    • status: open --> closed-fixed
     
  • Jamie Cameron

    Jamie Cameron - 2019-01-17

    Thanks, I'll include that fix in the next release.

     

Log in to post a comment.