SSIS Mail Triggered wrongly - ssis

i have a SSIS Package which schedule to check in every 10 min for the file,
and Once the file placed in the path, it execute and triggered mail.
The issue is even when file not placed it start sending mail in every 10 min.
How to handle it.

You should handle this by correcting the code that checks for the file and sends the mail.

Related

SSIS event handler script task

i have a package that has several event handlers that execute a script task on failure when the package fails.. Problem is its generating a email that i have NO IDEA how.. When the package fails it executes a stored procedure that grabs the email distribution list from a SQL table and sends an email. However one email is being sent out to ppl who are not with the company and ive been told twice to change the DL list.. I checked the SQL table and the people that are getting the email are not listed any where in the distribution list.. Is there any way to search anywhere in the package to find out how the email is being generated. Ive spent hours and hours going through the scrip tasks and the code is no where to be found
You can use the package explorer (to the right of the event handler tab) to navigate through the entire package and look at the event handlers for every executable. It's possible that there are multiple event handlers, one at the package level and maybe one defined on a particular task, which is hardcoded with email addresses.
You can also, right click on the package in the solution explorer and select View Code. This will open the package in xml, which you can then use ctrl+F to find a certain string.
Advice Section
While you didn't ask for it, please let me add a few words of guidance. Event handlers are evil for this very reason. They are a hidden GOTO that you are lucky to notice at all, even if you've developed the package in the first place.
If event handling is required, use the precedence constraints in the control flow. Throw everything in a container, connect it to the script task and define the constraint to trigger on failure.
To go one step further, keep your emails out of your ssis packages. Use SQL agent or whatever scheduler you are using to post messages about failures.

SSIS package with multiple constraints

Shown below is part of an SSIS package that runs daily. My objective is to execute the task 'Get Greaterthan500 Count on Mondays' only on Mondays. However, I want the 'Send Mail Task' to be executed on all days.
This is not working. How can I achieve this?
Put the fist 2 in a sequence container.
Then have the send mail outside the sequence container and the send email will always be hit

SSIS- SQL AGENT Sending Mail for Each hour

i have designed a SSIS Package which will load some data to table
from the file available in a folder.
once data got loaded file move to archieve.
Client requested to have mail trigger at the end of process, so i implement
it through send mail task.
The pooling mechanism was done via agent job which run after evry 1 hour
to check existence of file.
The problem starts here.
it start sending mail every 1 hr to user
will it be possible to do some modification.
Thanks You All...... i think my question was not clear. The Problem i am facing is my package is start trigger mail every 1 hour, even when there is no file in source folder. i want to trigger mail when there is a file in Source folder, and after processing the file mail should get triggered, so user can come to know that file which they placed in the folder is got processed. But in present scenario, because i used agent job, which is checking for the file every 1 hour, even if file is not there mail is getting triggered to user. Please help me on this.
Can any one please suggest how can i rectify it.
Thanks
Yes, there are numerous ways to handle this depending on what you want to do.
They all involve only sending the email if some condition is true. You will have to decide what that condition is, and then that will suggest the best way to handle it.
You can set a variable and use an expression in the precedence constraint to only go to the Send Mail Task if the variable is true, for example.
If you want to look at a more complicated set of conditions, you can use a script task.
I would have sent mail only if the package fails. Not sure, your purpose of sending mail to the Client.
If the issue is sending mail every 1 hour is too much for the client.
Send mail if package fails and keep the status of every hour in a file (Using Script task, use variable to get the current Hour and write the Hour and Status to file) and send a consolidated mail at the end like.
Date: 09/23/2016
Hr - STATUS
-------------
00 - SUCCESS
01 - FAILED
.
.
.
23 - SUCCESS
If you want to send the consolidated mail at particular time, use the Variable used in precedence constraint before the send mail task.
Edit:
As per your update on clarification. Create a boolean variable to get the existence of the file using script task. Use that variable in precedence constraint before the Send Mail task.
http://sql-articles.com/articles/bi/file-exists-check-in-ssis/
Also, Refer

SSIS Execute Package task notification if path does not exist

I have created a master control package that calls several packages using the execute package task control. I have set all the package file locations to use a sql config table which contains the file location and then used an expression to include the package name. Everything works as expected however I want to include some handlers to notify me if the package location does not exist (just in case somebody changes the path in the config table). To test I set an incorrect file name in one of the expressions which turned the execute package task control red as expected however I can't figure out how to add the notification task. I have tried all the error handler events assocaited with it but no joy plus I added a mail task to the task in question for failure and this did not execute!
Any advice greatly appreciated.
Thanks.
That's why you have OnError event handler, just configure it properly. Are you sure, you're checking Event Handlers for the package and not for one of the blocks inside?
There's a plenty of system variables with OnError scope. Check grey x in Variable window to see them. You might want to use:
- ErrorDescription
- ErrorCode
- SourceName
but choose them according to the report format.
Now in event handler create a script which will put a message into a new variable, and finally send it with send mail task.

How to get a response from a script back to Hudson and to fail/success emails?

I'm starting a Python script from a Hudson job. The script is started though 'Execute Windows batch command' in build section as 'python my_script.py'
Now I'd need to get some data created by the script back to Hudson and add it to the fail/success emails. My current approach is that the Python script writes data to stderr which is read to a temp file by the batch and then taken into an environment variable. I can see the environment variable correctly right after the script execution (using set command), but in the post-build actions it's not visible any more. The email sending is probably done in different process, so the variables are not visible anymore. I'm accessing the env vars in the email as ${ENV, varname} (or actually in debug mode as $ENV to print them all)
Is there a way to make the environment variable global inside Hudson?
Or can someone provide a better solution for getting data back from Python script to Hudson.
All the related parts (Hudson, batch and Python script) are under my control and can be modified as needed.
Thanks.
Every build step get's is own shell. This implies, that your environment variables are only valid within the build step.
You can just write the data in a nice format to the std output (use a header that is easy to identify) and if the job fails, the data output gets attached in the email.
If you insist on only putting in the data, you can use the following token for the Editable Email Notification post build action (Email-ext plugin).
${BUILD_LOG_REGEX, regex, linesBefore, linesAfter, maxMatches, showTruncatedLines, substText}