Get email alerts for your Citrix PS 4.5 Farm with Project S-Bend

Project S-Bend fills the gap in Citrix Presentation Server 4.5 Configuration Logging by alerting you via email when changes happen in your farm.

Citrix introduced a new feature in Citrix Presentation Server 4.5 called Configuration Logging. Configuration Logging keeps track of every change to every object in your Citrix Presentation Server Farm. This information is kept in a back end database and you have the ability to run reports on these changes via the Report Center in the Access Management Console. For more details on setting up Configuration Logging and running reports, check out this article by Al Solorzano.

I think this is a really cool feature that lets you know who did what and when they did it. But, in order to get this information, you have to run a report from the Report Center in the AMC. Granted, you can automate reports, but it would be nice if there was some mechanism to alert you when a change was made. This is where Project S-Bend Phase I comes in to play. Project S-Bend was originally created as an exercise for my session titled “Digging into Citrix Presentation Server 4.5 Configuration Logging” at BriForum Europe 2007.

Project S-Bend Phase I consists of 3 main parts; an “Alerts” table added to the Configuration Logging database, a SQL trigger, and a Windows Service. Project S-Bend uses these parts to send email alerts whenever a change is written to the Configuration Logging back end database.

download JasonConger.com_SBend.zip

Alerts Table
This is a very simple table that is populated by the SQL trigger.

SQL Trigger
The SQL trigger is added to you Citrix Configuration Logging database and fires any time a change is written to the database. The trigger writes the ID of the change to the Alerts table.

Windows Service
The Windows Service reads the Alerts table populated by the SQL trigger. For each row in the table, the Windows Service sends an email to the specified email address with details concerning the object changed.

How it all works
The process is actually quite simple.

  1. When a change is made in your Citrix Presentation Server 4.5 farm, a log entry is created in the Configuration Logging database.
  2. When the log entry is created, the SQL Trigger fires and writes an entry to the Alerts table.
  3. The Windows Services reads the Alerts table on a configurable timed interval. When the Windows Service encounters unprocessed alerts in the Alerts table, it sends and email with details of what was changed.

Project S-Bend flow

What about Phase II?
I guess it is quite obvious that there is a Phase II in the works since I named this thing Phase I. Actually, Phase II is a provider. “A provider for what?” you may ask. Phase II is a provider for reports. Web Interface for Resource Manager will consume this provider as mentioned in the Web Interface for Resource Manager Roadmap.

Author: Jason Conger

Hey there. Hope you like the site.

22 thoughts on “Get email alerts for your Citrix PS 4.5 Farm with Project S-Bend”

  1. the SQL for creating the table appears to have an issue… Also, the “IGNORE_DUP_KEY” is not a valid parameter in SQL 2000 for “CREATE TABLE..

  2. Server: Msg 208, Level 16, State 4, Procedure trig_ChangeAlert, Line 1
    Invalid object name ‘dbo.CtxLog_AdminTask_LogEntry’.
    Server: Msg 170, Level 15, State 1, Line 7
    Line 7: Incorrect syntax near ‘(‘.

  3. Thank you all for trying out S-Bend. In my haste, I neglected to set the export functionality of SQL 2005 to be compatible with SQL 2000. IGNORE_DUP_KEY is not valid for SQL 2000 with a constraint. So, I updated the setup instructions to not use IGNORE_DUP_KEY.

  4. So now we need 3 different db’s. could have been done smarter by citrix I believe – just a check mark and put it in the datastore

  5. Kudos on such a simple, yet elegant, solution! While you can run (and even schedule) reports with Configuration Logging, up until now it was only passive, and could not proactively notify an administrator that a change was made. You’ve now added that much-needed feature.

    I’ve taken the liberty of adding yet another feature. There may be times where an admin would like to temporarily stop the alerts (e.g. to make many changes to the farm, setting up a whole new server, etc.). While one could stop the service, the trigger is still sending records to the alerts table which will then be processed when the service is re-started.

    One way to accomplish the desired functionality is by creating a table which contains a single field, ProcessAlerts, which is interrogated during the trigger – before adding the record to the alerts table. The updated trigger would look as follows:

    CREATE TRIGGER [trig_ChangeAlert]
    ON [dbo].[CtxLog_AdminTask_LogEntry]
    AFTER INSERT
    AS
    BEGIN

    SET NOCOUNT ON;
    declare @AlertStatus int

    SELECT @AlertStatus = ProcessAlerts FROM [dbo].[AlertStatus]
    IF @AlertStatus = 1
    BEGIN
    declare @LogEntry_RecordID int
    SELECT @LogEntry_RecordID = LogEntry_RecordID FROM INSERTED
    INSERT INTO [dbo].[Alerts] (LogEntry_RecordID) VALUES (@LogEntry_RecordID)
    END

    END

  6. Good Day,

    does the Windows Service “Citrix Change Alerts (S-Bend)” have to be installed on the SQL server or can it be insatlled on any other box that can communicate with the sql server.

    Many Thanks

    Big John

  7. Good Day, I’m getting 100s of “Failure sending mail” errors immediately after a “Found 6 rows” in the App log. I’ve done and re-done my CtxConfigAlert.exe.config but think I may have a syntax error somewhere. Does anyone have an example of a working config file

    Cheers john

  8. You may need to allow SMTP relay for the server running the S-Bend service. It sounds like you have your connection string set up properly since you are seeing changes added to the event log.

  9. Relay is open for any internal host including the machine running the “Citrix Change Alerts (S-Bend)” service. I have actually added the server to the relay to eliminate a relay issue, but all to no avail …. Hence why I asked if anyone had a working sample CtxConfigAlert.exe.config file

  10. I’m getting a login failure when starting the service? I’ve tried the SA and domain account without any luck, any ideas?

    connectionString=”Data Source=10.x.x.x;Initial Catalog=ctx45log;Persist Security Info=True;User ID=userID;Password=Password”

  11. I am also getting a login failure when starting the service… i get the following two events in the application log:

    Object reference not set to an instance of an object

    and

    Login failed for user ‘Domain_XYZ\User_XYZ’

    I keep thinking that this is something to do with the connection string but i really have tried everything! Here is my connection string:

    connectionString=”Data Source=SQL_Server.FQDN.uk;Initial Catalog=MetaFrame_Config;Persist Security Info=True;User ID=Domain_XYZ\User_XYZ;Password=Password_XYZ”

    I can view the database and everything with the account via SQL Management Studio. I have been having this problem now for about a month and i have searched google for everything that i can think of.

    Can anyone help please as this is driving me around the S-Bend!! 😉

    Thank,
    David

  12. YAY!! after an hour or two on http://www.connectionstrings.com i finally got it to work. I changed the S-Bend service to run under a domain account which has rights to the table on the database, I then replaced the User ID and Password in the connection string with Integrated Security=True. Working very well thanks. I think though i may have a go at writing something myself for this which will show a bit more detail in the email… im thinkin either a script (as i am pretty good at scripting) or just do it all with SQL. If anyone is interested just let me know and i will pass on what i have so far. Regards. David Orchard.
    PS – Hope this helps Guest post on October 11th 2008

  13. Jason-

    It what tables can I tweak it so I dont get alerts for every farm change ? For example…I needed to be alerted if logons are disabled, but dont need to be alerted that I have moved a server from one folder to another.

    Thank you,

    Kyle

Leave a Reply

Your email address will not be published. Required fields are marked *