Monday, September 30, 2013

Recreating your customized components the easy way

About 2 years ago, I received the task to migrate Siebel Enterprises to a new data center. That would require checking all necessary steps to reinstall the Siebel Enterprise since the new hosts would be using different names due a network policy.

One of the tasks were migrating the customized components, most of them workflow monitors. Creating customized components can be a lot of typing, a boring and repetitive task prone to errors. Wouldn't be cool if one could just do something like a CRTL+C and CRTL+V to all parameters from an Enterprise to another?

That is possible. Well, at least with two operations.

About that time the API of Siebel::Srvrmgr was already usable, so I took a shot to build such automation.

The result is a Perl script named Siebel Srvrmgr Exporter. This little command line tool connects to a Siebel Server and exports components information in the form of multiple CREATE COMPONENT commands to standard output. With that, it is just a matter to connect to the new Siebel Enterprise and execute the same commands for the new servers with srvrmgr program.

Here is the command line help:



The program also includes a simple ASCII animation for the user to avoid the feeling that the application stopped working because it's expending some seconds retrieving data from the Siebel Server.




Siebel Srvrmgr Exporter started as a tool to solve a real problem, and later I had included it as an POC (proof of concept) of Siebel::Srvrmgr API. In release 0.9 of Siebel::Srvrmgr, I had included more features to it:
  • Exports only components attributes that have a defined value;
  • Exports all components which name that matches a given regular expression;
  • Some internal improvements;
Siebel Srvrmgr Exporter is now an standalone download available at http://siebel-monitoring-tools.googlecode.com/files/Siebel-Srvrmgr-Exporter-0.01.tar.gz. Be sure also to checkout the wiki page of the project with instructions to setup the necessary Perl modules for running Siebel Srvrmgr Exporter.
Here are some examples of the output generated:
Components with "Work" string in their names, with all parameters




Components with "Work" string in their names, with only the parameters that have defined values
In those two examples, all components with "Work" in their respective names are exported, the difference is that the first one exports all parameters of the component, the second only the parameters that actually have a defined value.

How does this thing work?


Recently I was showing the tool to a colleague at work and he asked how so I had the patience to type all that information. I found it funny because in fact I had typed quite a few lines of Perl code to do that. By using the classes available at the Siebel::Srvrmgr API, the program:
  1. Connects to a Siebel Server in a Enterprise;
  2. Recover each component (that is available in the server) information;
  3. Recover their parameters;
  4. Enter in a loop print all the information as a "create component" command of srvrmgr.
Since the program prints this information to the standard output, if they are many commands to just copy and paste you probably will want to redirect the output to a text file and use srvrmgr in batch mode. Maybe I'll include a new command line parameter for that in the future.

Later, by using srvrmgr, you can submit those commands to the new Siebel Server, recreating those components with the same parameters defined before.

And that's it! Two commands:
  1. export_comps.pl
  2. srvrmgr
And you have "copied" your components from one Siebel Server to another.

Caveat

There is always one: the parameters that includes passwords are recovered from the Siebel Server as a "****", so you probably will want to change those (a search/replace with your favorite text editor will do) between steps 1 and 2. Maybe I'll implement some feature to ask for a real value before printing the CREATE COMPONENT commands in the future (probably after Christmas lunch, just don't know from which year).

If anything fails and you don't know why, make to sure to check the Troubleshoot wiki on the project main page. 

2 comments:

  1. Hi, I little bit newbie on Perl, and the readme not clarify much for me. Can I to contact you by email to make any questions about this tool?

    ReplyDelete