Subscribe
Accepted Solution

how to configure correctly the config file to send an email using mailx

[ Edited ]

Hi,

i tried to configure scapcreator to send an email to my address. im not succesfull on that :

this is the output:

[Mon May 23 17:29:48 2011] ERROR: Sending Success msg to external system [TRAP=/bin/mailx -s "SNAPCREATOR SUCCESS" INFO: NetApp Snap Creator Framework Backup for orareplica03 ACTION: snap POLICY: daily finished successfully email@domain.com </dev/null]failed with return code [32512] and message [sh: -s: command not found]

this is how i configured the .conf file:

NTAP_ASUP_ERROR_ENABLE=Y

SENDTRAP=SENDTRAP=/bin/mailx -s %MSG email@domain.com </dev/null

SUCCESS_TRAP=TRAP=/bin/mailx -s %SUCCESS_MSG email@domain.com </dev/null

SUCCESS_MSG=INFO: NetApp Snap Creator Framework Backup for %SNAME ACTION: %ACTION POLICY: %SNAP_TYPE finished successfully

any idea ? usually on my scripts i do the following: /bin/echo %MSG | /bin/mailx -s "subject" email@domain.com (this works)

best regards,

Luca

how to configure correctly the config file to send an email using mailx

SC provides a mechanism for sending alerts via SENTRAP parameter and success messages vis SUCCESS_TRAP parameter

You can use anything you want, %MSG will be either the success or error message

Your issue it looks like is you didnt specify email address (email@domain.com) and SENDTRAP is there twice (SENDTRAP=SENDTRAP=). If I was configuring this I would do following (please try this, with your email address instead of mine):

SENDTRAP=/bin/mailx -s %MSG keith.tenzer@netapp.com </dev/null

SUCCESS_TRAP=/bin/mailx -s %SUCCESS_MSG keith.tenzer@netapp.com </dev/null

All SC does is call the command and translate %MSG which is happening correctly

Regards,

Keith

how to configure correctly the config file to send an email using mailx

this is exactly what i did

how to configure correctly the config file to send an email using mailx

Ok then it is a mailx problem, remember all SC does is run what you have there from CLI, so maybe try running mailx command by hand

Keith

how to configure correctly the config file to send an email using mailx

Hi Luca,

I had problems in the past when using SUCCESS_TRAP with SUCCESS_MSG settings.

It seems that for some reason snapcreator don't put right quotes and the command will have errors sending emails.

This is my actual config at this moment and it sends the success message also with SUCCESS_TRAP commented out....

SENDTRAP=/bin/mailx  -s %MSG emailATdomain.com </dev/null

#SUCCESS_TRAP=/bin/mailx  -s %SUCCESS_MSG emailATdomain.com  </dev/null

SUCCESS_MSG=INFO: SnapCreator Backup completed successfully.

The other test I've done is to put a SUCCESS_MSG without spaces so that it will get it for -s subject.

this is the output:

[Mon May 23 17:29:48 2011] ERROR: Sending Success msg to external system [TRAP=/bin/mailx -s "SNAPCREATOR SUCCESS" INFO: NetApp Snap Creator Framework Backup for orareplica03 ACTION: snap POLICY: daily finished successfully email@domain.com </dev/null]failed with return code [32512] and message [sh: -s: command not found]

this is how i configured the .conf file:

NTAP_ASUP_ERROR_ENABLE=Y

SENDTRAP=SENDTRAP=/bin/mailx -s %MSG email@domain.com </dev/null

SUCCESS_TRAP=TRAP=/bin/mailx -s %SUCCESS_MSG email@domain.com </dev/null

SUCCESS_MSG=INFO: NetApp Snap Creator Framework Backup for %SNAME ACTION: %ACTION POLICY: %SNAP_TYPE finished successfully


From your error the quotes are only around "SNAPCREATOR SUCCESS" and not on all the rest of the words so probably the email with go bad trying to send it to various unexisting recipient ....

It seems that it's also trying to run a "-s" commands instead of /bin/mailx.

Check well on the config file because it seems from the logs that the SUCCESS_TRAP and SENDTRAP line are wrong as Keith was saying.

It seems that snapcreator run TRAP=/bin/mailx -s "test" email@domain.com

If I try to run the command it seems that I have the same error:

[root@SRV Backup]# TRAP=/bin/mailx -s "test" email@domain.com

bash: -s: command not found

So check that the line are:

SENDTRAP=/bin/mailx -s %MSG email@domain.com </dev/null

SUCCESS_TRAP=/bin/mailx -s %SUCCESS_MSG email@domain.com </dev/null

I think you can also go with something like your command example to put %MSG in the email body instead that having it in the subject and passing the ERROR or SUCCESS in the Subject as your example with /bin/echo, probably it should work and it can be more readable.