Email notification for start of an SA Action

Hello, I am fairly new to the automation side of Bigfix. Have been tasked with creating multiple automation scripts for patching The end user is asking for an email notification at the start of the action, and another that shows the completed action status. The start email just has to say something like “Automated Patching process started for XXX environment”.

I have created working scripts so far that handle the service management, patching and restart processes, but having issues with the email notification at the start of the action.

Simple test script:
Step #1 - Fixlet ID#152 - Configure Email Notification Settings for Server Automation (Target: root server, global: yes, email: myself, Include global: yes, Message: Starting patching, Include summary: no)

Step #2 - ID#126 - Restart endpoint and wait for restart to complete (Target: test server)

Step #3 - ID#152 - Configure Email Notification Settings for Server Automation (Target: root server, global: yes, email: myself, Include global: yes, Message: Starting patching, Include summary: yes)

When I run this, all actions complete with 100%, but I do not get the Step 1 email. I do get the Step 3 completion email stating “Automation Plan completed successfully”

How can I create an “Automation Plan Starting” email?

Note, we thought about using ID#2244 - Send Email notification, but we are getting dinged by PCI because that seems to drop the senders Username/Password into a config file in plaintext into the BF folder on the installed drive. We use elevated logins for Bigfix via ldap so that is unacceptable.
Thanks

I use a 3rd party utility called BLAT.exe to send emails. It’s not part of BigFix, but it allows us to send almost any email we need. Download it to the clients and save it as a utility.

1 Like

Hi Michael,

So out of the box, without adding any extra email sending steps into the plan itself (like fixlet #2244 as you’ve mentioned), the SA plan engine will only send out a single email when the plan is done to let you know how the execution of the plan in question went. This emailing option is controlled on a per-plan basis, and the setting to do this is available in the Settings tab when editing a plan.

So fixlet #152 is really just a configuration fixlet for setting the various global settings for use by Server Automation. The values you input here are/can be used by the plan engine when it sends the email at the end of plan execution, but fixlet #152 itself does not send any emails when executed, just to make that point (I would not expect to see any emails sent by running Step #1 in your plan in other words).

I will raise the issue internally so that the file you’ve mentioned gets tidied up properly after use in fixlet #2244, but in the meantime, it is still possible to send an email without having to use that fixlet. Take a look at #2245 - Sample Task: Send an Email Notification. You can create a copy of this fixlet, and include that copy in your plan at the desired locations in the plan where you would like an email to be sent. The entire contents of the actionscript for that fixlet might look like this, and you could place this fixlet in your plan as Step #1:

// NOTIFICATION_START
// to: "michael@acme.com,john@acme.com"
// from: "noreply@sa.acme.com"
// subject: "Server Automation plan 'Foo' has started ..."
// body: "Just letting you know, the plan 'Foo' has started executing"
// NOTIFICATION_END

There’s a secondary component in the Notification Service that detects fixlets with this kind of content and sends an email when it’s completed (you can target this at any computer… it does not need to have a direct line-of-sight to the server).

The only down side to this is that the messages are hard-coded, not parameterized like fixlet #2244, though you could opt to have a small number of generic email fixlets (which would be especially useful if you don’t have a large number of plans running concurrently), e.g.

Generic “Start” fixlet (placed at the start of plans):

// NOTIFICATION_START
// to: "michael@acme.com,john@acme.com"
// from: "noreply@sa.acme.com"
// subject: "Server Automation plan has now started."
// body: "Just letting you know, a Server Automation plan has just started executing"
// NOTIFICATION_END

Generic “Half-way” fixlet (placed in the middle of plans):

// NOTIFICATION_START
// to: "michael@acme.com,john@acme.com"
// from: "noreply@sa.acme.com"
// subject: "Server Automation plan is 50% complete"
// body: "Just letting you know, a Server Automation plan has completed half of it's steps"
// NOTIFICATION_END

Hope this helps!
Paul.

Thanks. #2245 seems to be what I am looking for. I will work with my Bigfix admin to verify that the notification service is installed and configured correctly on the root server.

Paul, after verifying that Email Notification is setup and configured correctly, I created an action that used a modified Send Email notification task to test. The action completed fine, but no email.
Verified in the pe_console log that the action had no errors.

Is there a log for email notification that might give a clue where the notification went?

// NOTIFICATION_START
// to: "xxx@xxx.com, xxx@xxx.com"
// from: "xxx@xxx.com"
// subject: “Something happened that you should know about … Test”
// body: “Here are the details of that test. It worked. Yay”
// NOTIFICATION_END

Hey Michael,

Yes check out the log files here:
C:\Program Files (x86)\BigFix Enterprise\BES Server\Applications\Logs

In there you’ll see two notification service log files:

  1. `ns-monitor-app.log` (this is the component that should detect the special comment notation in your action)
    
  2. `ns-notifier-app.log` (this is the component that actually sends the email)
    

So what you should see is the action being detected in the monitor log, and when it’s completed, you should see the monitor make a request to the notifier to send the email.

The log level for the log files is defined in:
C:\Program Files (x86)\BigFix Enterprise\BES Server\Applications\NotificationService\resources\config\nsLogConfig.json

Nice. It is working now.

Thank you very much for the assistance.

Mike

That’s great Michael, glad we could work around that problem.

- Paul.