Ad Widget

Collapse

Ruby SMTP Authentication

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • davidr
    Junior Member
    • Aug 2011
    • 4

    #1

    Ruby SMTP Authentication

    So I have a ruby script that is doing my smtp authentication using postmarkapp.com . The issue is that I can't seem to get Zabbix to execute the script in order to send the email. I have checked all of the docs but they aren't very clear. I have defined it as a script in Zabbix at least I think I did. I put it in the directory that the server config says to put it in also. If I run the script via the command line it works. I am not seeing any errors in any logs. When I check the events tab in the Monitoring section I can see that the trigger is activated but the action failed. I am not sure how to find out why the action failed. Any help would be appreciated.


    Thanks,

    David Rodriguez
  • nelsonab
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2006
    • 1233

    #2
    You are likely running into an environment issue. Zabbix does not execute scripts with the usual environment variables. Thus if your script is using any Gems or other requires it is possible Ruby does not know where to find them due to the lack of path and other environment variables. Try starting with full path names and see if that get's you somewhere.
    RHCE, author of zbxapi
    Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
    Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

    Comment

    • davidr
      Junior Member
      • Aug 2011
      • 4

      #3
      Alright I will look into that. I think that might be my issue. When I su'd to the zabbix user I get errors when I run the script.


      David

      Comment

      • davidr
        Junior Member
        • Aug 2011
        • 4

        #4
        So how can I figure out what environment the zabbix user is using. I log into the server as the zabbix account and I am able to ruby the script. If I do the following it dies

        sudo su - zabbix /home/zabbix/bin/sendAlerts [email protected] test test

        It complains that the require command doesn't exist.

        David

        Comment

        • davidr
          Junior Member
          • Aug 2011
          • 4

          #5
          well if I do this
          sudo -u zabbix /home/zabbix/bin/sendAlerts [email protected] test testfromzabbixuser

          the script works. I am still not getting the action to process correctly though.


          David

          Comment

          Working...