Notifications not working [was: Re: '$' symbol being appended to command_line?]

Alexis Hazell alexis.hazell at gmail.com
Fri Jan 9 02:02:02 CET 2009


On 11:27:09 Thu 08-Jan-09, Alexis Hazell wrote:
> Doing this showed that you are correct about it being a permissions
> issue: nagios is running as user 'nagios' and group 'nagios', but
> the /bin/mail and /usr/bin/freetalk commands are being run in an
> environment where it seems that HOME=/root/ - the commands attempt to
> access /root/.esmtprc and /root/.freetalk/, respectively, rather than
> attempting to access /var/log/nagios/.esmtprc and
> /var/log/nagios/.freetalk/ (where /var/log/nagios is HOME for user
> nagios).
> 
> Obvious kludges are:
> 
> * copy the respective dot files to /root/ and either chmod them o+r
> or chown them root.nagios;
> 
> * modify the command_line to use sudo to ensure /bin/mail and
> /usr/bin/freetalk are run as user 'nagios'.
> 
> But surely there's a better alternative? What am i missing?

Okay, for future reference for anyone else who might face the same
problem, i couldn't get either of the above kludges to work. Instead,
what worked was setting the HOME var:

    command_line    echo 'Nagios notification --- Type: $NOTIFICATIONTYPE$, Service: $SERVICEDESC$, Host: $HOSTALIAS$, Address: $HOSTADDRESS$, State: $SERVICESTATE$, Date/Time: $LONGDATETIME$, Additional Info: $SERVICEOUTPUT$' | HOME=/var/log/nagios /usr/bin/freetalk -s /var/log/nagios/notify.scm

where the contents of /var/log/nagios/notify.scm are:

    (use-modules (ice-9 rdelim))

    (define msg (read-line))

    (ft-set-jid! "[sender-JID]")
    (ft-set-server! "talk.google.com")
    (ft-set-password! "[sender-password]")
    (ft-set-sslconn! #t)
    (ft-set-port! 5223)

    (if (ft-login-blocking)
        (begin
            (ft-send-message "[recipient-JID]" msg)
            (ft-disconnect))
        (display "Could not connect\n"))


Alexis.

------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list