Welcome to Pandora FMS Community!

Find answers, ask questions, and connect with our community around the world.

  • Create Email Alert

    Posted by neverland on November 15, 2007 at 07:27

    #!/usr/bin/expect -f

    set arg1 [lindex $argv 0]
    set arg2 [lindex $argv 1]
    set arg3 [lindex $argv 2]
    set timeout 1
    spawn telnet myserver.com 25
    expect “220”
    send “ehlo mymachine.mydomain.comr”
    expect “250”
    send “AUTH loginr”
    expect “334”
    send “2342348werhkwjernsdf78sdf3w4rwe32wer=r”
    expect “334”
    send “YRejewrhneruT==r”
    expect “235”
    send “MAIL FROM: [email protected]
    expect “Sender OK”
    send “RCPT TO: $arg1r”
    expect “250”
    send “datar”
    expect “354”
    send “Subject: $arg2r”
    send “$arg3 rr”
    send “.r”
    expect “delivery”
    send “quit”
    quit

    according to above file , i have saved it into /root/SNMP-Trapinfo-1.0/blib/script and set permissions for /root/SNMP-Trapinfo-1.0 with chmod 700
    Anyway i already have created the mail alert on pandora agent
    and i am not sure where do i should put Pandora FMS alert definition command: /root/smtp _field1_ _field2_ _field3_==>i am quite clear what to do in this step

    ps. i never do exchange server but pls confirm me if i am doing it right
    thank

    neverland replied 17 years, 3 months ago 2 Members · 6 Replies
  • 6 Replies
  • manu

    Member
    November 15, 2007 at 12:32
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    Hi neverland,

    You have to set up the right path in the alert definition (manage alerts, email alerts)

    Bear in mind that that script code the user and the pass in Base-64 (which is needed by exchange servers), so you might want to try, firstly, by hand from the CLI and see whether you need base64 coded name/password.

  • neverland

    Member
    November 15, 2007 at 12:47
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    hi this is what i have done
    1. i set alert Conntrack New eMail 5 minutes 0 0 N/A to my bridge and it fire alert but anyway it did not send an email.
    2.i am not sure if i set the right destination.
    Alert configuration > Modify alert
    /root/SNMP-Trapinfo-1.0/blib_field1_ _field2_ _field3_
    ps. the script expect i have saved it into /root/SNMP-Trapinfo-1.0/blib

  • manu

    Member
    November 15, 2007 at 12:55
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    Check out what I wrote about the CLI and all that.

    On the other hand, do you actually need authenthication to send the email? Is not the “mail” command enough?

  • neverland

    Member
    November 16, 2007 at 07:27
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    hi now i have tried this
    #!/usr/bin/expect -f

    set arg1 [lindex $argv 0]
    set arg2 [lindex $argv 1]
    set arg3 [lindex $argv 2]
    set timeout 1
    spawn telnet xx.xx.xx.xx 25
    expect “220”
    send “ehlo xx.xx.xx.xxr”
    expect “250”
    #send “AUTH loginr”
    #expect “334”
    #send “r”
    #expect “334”
    #send “r”
    #expect “235”
    send “MAIL FROM: [email protected] r”
    expect “Sender OK”
    send “RCPT TO: [email protected]
    expect “250”
    send “datar”
    expect “354”
    send “Subject:Bridge.$arg2r”
    send “$arg3 rr”

    According to the script above i execute the file as a result
    sending an email to [email protected] but when i switch back to
    the pandora FMS page again it when the agent alert something but the alert did not fire…maybe the mistake is “Alert configuration > Modify alert >email command: /root/SNMP-Trapinfo-1.0/blib/lib/SNMP ./expect.sh” do i type it in the right format …quite not sure i just want it to execute the expect.sh <>

  • manu

    Member
    November 16, 2007 at 12:20
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    Yes, you’re doing it wrong

    You only have to put the path to the expect.sh
    That’s to say:
    /root/SNMP-Trapinfo-1.0/blib/lib/SNMP/expect.sh

    Cheers
    Manuel

  • neverland

    Member
    November 16, 2007 at 13:59
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    thanks it works