HI every one,
1) First of all, I didn't find the application installed in the : "Splunk>Apps".
2) I want to configure the file, to send email if the alert is triggred. this is the configuration that I made:
export mailDay="Daily"
export mailFrom="xxx.otmyyyan@gmail.com"
export mailTo="ggg.222@hotmail.fr"
export mailSubject="Splunk Email Alert"
export mailHost="smtp.company.com"
export Auth="0"
export smtpuser="xxxxx.yyyyy@gmail.com"
export smptpass="yyyyyy"
python $SPLUNK_HOME/bin/scripts/sendmailpython.py "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8"
But it doesn't work !!!! did i miss something?
this is the code predented in the script file: if you have same marks!!! thank you ( I'm on windows os)
SPLUNK_HOME="/Applications/splunk"
export mailDay="Daily"
export mailFrom="chiadmi.otman@gmail.com"
export mailTo="chiadmi.otman@gmail.com"
export mailSubject="Splunk Email Alert"
export mailHost="smtp.gmail.com:465"
export Auth="1"
export smtpuser="chiadmi.otman@gmail.com"
export smptpass="*******"
python "C:\Program Files\Splunk\bin\scriptssendmailpython.py" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8"
this is the code predented in the script file: if you have same marks!!! thank you ( I'm on windows os)
SPLUNK_HOME="/Applications/splunk"
export mailDay="Daily"
export mailFrom="chiadmi.otman@gmail.com"
export mailTo="chiadmi.otman@gmail.com"
export mailSubject="Splunk Email Alert"
export mailHost="smtp.gmail.com:465"
export Auth="1"
export smtpuser="chiadmi.otman@gmail.com"
export smptpass="*******"
python "C:\Program Files\Splunk\bin\scriptssendmailpython.py" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8"
The original code was designed to work on Linux. If you are on windows you'll have to rewrite the shell script as a .bat file to make it work. The Linux/Unix syntax of a Bash Shell script will not work that you have above. An example sendPythonmail.bat would be something like this:
@echo off
set Auth="1"
set smtpuser="chiadmi.otman@gmail.com"
set smptpass="****"
python "C:Program Files"\Splunk\bin\scriptssendmailpython.py" "%1%" "%2%" "%3%" "%4%" "%5%" "%65" "%7%" "%8%"
You'll have to write your own script. Make sure python is installed on your windows machine as well, if you plan on testing this script outside of Splunk.
Thank you for your answer I will try to rewrite the script 🙂
First, I apologize if Splunk classified this as an app. It's a TA (technology add-on) so it will not automatically install itself. Please follow the README.txt instructions. Edit both files in the bin directory and put them in the $SPLUNK_HOME/bin/scripts directory. I see you have not set your your mailHost. Is that for the example or you forgot. Set this to a proper mailHost that you have access to using.
Next in the shell script, if you need authentication, please change the first line above:
export Auth="1"
Finally, test this on the command line before your do it from a scripted alert. For example:
./sendmailpython.sh a b c d e f g h
If you get no errors and receive mail, you can now configure Splunk to use this alert script to send the results of an alert.