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.

Project S-Bend Setup Instructions

Project S-Bend sends alerts when changes happen on your Citrix Presentation Server 4.5 farm.

Note: The setup instructions and screenshots shown below are for use with Microsoft SQL Server 2005. However, the steps are similar for Microsoft SQL Server 2000.

 download Download Project S-Bend Phase I

Step 1 – Set up the Database

Open SQL Server Management Studio (or SQL Enterprise Manager for SQL 2000).
Right click on your Citrix Configuration Logging database and select “New Query”.

New Query

In the Query window paste the following SQL Script:

Press F5 to execute the query.  This will create the Alerts table and the SQL Trigger.

Step 2 – Set up the Windows Service

Copy the following files to your preferred destination directory (something like C:\Program Files\CitrixConfigAlert\):

  • CtxConfigAlert.exe
  • CtxConfigAlert.exe.config

Edit CtxConfigAlert.exe.config with the appropriate values for your environment. Set values for the following:

  • connectionString – Tip: visit www.connectionstrings.com for help with this value.
  • PollInterval – This is how often (in seconds) the Windows Service will poll the Alerts table.
  • MailToAddress – The destination email address to send the alerts.
  • SMTPServer – The name or IP address of your SMTP server.
  • SMTPPort – The port of your SMTP server (defaults to 25).
  • MailSubject – This will be the subject line of the email sent.
  • MailFromAddress – The email address used to send the alert.
Step 3 – Install the Windows Service

 

  • Open a command prompt and change the directory to C:\Windows\Microsoft.NET\Framework\v2.0.x
  • Perform the following command:
         InstallUtil /I path_to_CtxConfigAlert.exe
  • This will install a new Windows Service called “Citrix Change Alerts (S-Bend)”.
  • Start the service.

Any errors that occur while starting the service, or during the operation of the service, will be logged to the Windows Application event log.

Note: Changes made to CtxConfigAlert.exe.config require a service restart to take effect.

Script to Manipulate APPSRV.INI

What happens when you need to make mass changes to APPSRV.INI? Use this script to make changes to your user’s APPSRV.INI file via login script. The script adds or modifies .INI file key/value pairs and sections.

Use this script to make changes to your user’s APPSRV.INI file via login script. The script adds or modifies .INI file key/value pairs and sections.

  Download mod_appsrv script v1.1

The Scenario
So, you have been combing through the various support forums all day long trying to find a solution for an issue. You finally find the solution, but it involves modifying every user’s APPSRV.INI file located on their workstation. One common solution that matches the above scenario has to do with Single Sign On issues with Citrix Web Interface. One of the most recommended solutions is to add the following two lines to the [WFClient] section of APPSRV.INI:

SSOnUserSetting=On
EnableSSOnThruICAFile=On

Reference: http://support.citrix.com/article/ctx368624

The Dilemma
So, you try this and it fixes the issue for the user. What do you do now? Manually modify each user’s APPSRV.INI? Tell your users to perform the modification themselves? Script the change? Tell your boss there is no fix for the issue?

The Solution
Script the change sounds good to me, but how do you do that? That is where this article comes in. I mentioned I had a script to manipulate APPSRV.INI in the comments of this article. I have received many emails requesting the script. So, I decided to “spruce up” the script a little by adding more comments and logging and then share it. The script is written in such a way that you can add or modify any key/value pair to any section in APPSRV.INI (or any .INI file for that matter). Just modify the following section of the script to suit your needs:

'**********************************************************
' Add/modify key/value pairs
' modINISection takes 3 parameters:
'    Section name
'    Key
'    Value
'**********************************************************
modINISection "WFClient", "SSOnUserSetting", "On"
modINISection "WFClient", "EnableSSOnThruICAFile", "On"

The above example shows how to implement the solution to the delimma discussed earlier.

Here is another useful one to add that addresses clipboard issues:

modINISection "WFClient", "CbChainInterval", "2000"

From the Citrix Client 9.100 Readme http://support.citrix.com/article/CTX107650

“This fix introduces support for a mechanism to check at periodic intervals the client’s ability to receive clipboard change notifications. If the mechanism finds the client to be unable to receive such notifications, the client will attempt to register itself to receive future notifications. To enable this functionality, you must modify users’ appsrv.ini files as follows: 1. Open the appsrv.ini file located in the user profile directory using a text editor. 2. In the WFClient section, locate or add the entry: CbChainInterval=<value>, where value is the interval, in milliseconds, at which checks are to be performed. Supported values range from 0 to 2,000, inclusive.”

Think of it as an auto RepairCDBChain.exe

Some quick things to note about the script:

  • If you specify a section for modINISection that does not exist, the section will be created.
  • If you specify a key that does not exist, the key will be created at the end of the section.
  • Curretnly, there is no implementation to delete key/value pairs (I’m not sure that would even be useful for the intended usage)
  • A log file is created in the same directory as the APPSRV.INI file. The log file is named the same as the script name. If you change the script name to match you company’s naming convetion, the log file name will change automatically.

Good luck and have fun. But, as always, test test test. Make sure this script works in your environment before you throw it out there on your global login script.