430 likes | 457 Views
Development of Scripts in Sysgem Enterprise Manager (SEM) & Sysgem Account Manager (SAcM). Goals To give an understanding of the structure of SEM and the scripts within SAcM To help you know where to look for information in SEM Non-Goals To teach everything there is to know about SEM
E N D
Development of Scripts in Sysgem Enterprise Manager (SEM) &Sysgem Account Manager (SAcM)
Goals • To give an understanding of the structure of SEM and the scripts within SAcM • To help you know where to look for information in SEM Non-Goals • To teach everything there is to know about SEM • To teach Perl
By the end of the course you should be able to: • Produce customisations in SAcM. • Enable those customisations to survive an upgrade of SEM. • Diagnose problems encountered by customised scripts. • Introduce and support the customised scripts in a production environment.
Contents • SEM Components • Authorization Server • Authorization Server File Structure • SEM ‘Layers’ of Routines • SEM Options Cache • Database Access in SEM • Development Interface
1.0 Overview: SEM Components Management Console Authorization Server Managed Agents on Target Systems
2.0 SEM Authorization Server • SEM User Profiles (for SEM permissions) are held at the SEM AuthServer. • SEM Scripts are held at the AuthServer and loaded into the GUI when a SEM user logs in. • Libraries at the AuthServer are updated as scripts are developed.
3.0 AuthServer Folder Structure Contains: SAcM Audit Database Home Directories for Users and Script Libraries SAcM Application Databases Cache of Contents of Drop Down Lists Perl Libraries used by SEM SEM Agent & Working Directory SAcM Subscriber Database SEM GUI
4.0 SEM ‘Layers’ of Routines Perl Scripts. ‘Include File’ sub-routines, included at run-time. (Listed in Appendix C & D) Compiled routines available to scripts.(Listed in Appendix E)
5.0 SEM Options CacheLocal cache synch’d with central cache Management Console Authorization Server Local cache Central cache SEM OptionsCache SEM OptionsCache Checksum file Checksum file cached files cached files
5.1 SEM Options Cache Routines • Options_SaveToFile() Options_SaveToFile(“ORACLE”, “Permissions", \@permissionList); • Options_LoadFromFile() @PermissionList = Options_LoadFromFile (“ORACLE”, “Permissions "); • Options_FileExists() if (!Options_FileExists(“ORACLE", “Permissions"))
6.0 Database Access in SAcM Authorization Server Management Console ODBC Agent SAcM Databases
6.1 DB Access: Example.SEM Routines to read / write via ODBC • Compiled SEM routines held in Sysgem Perl Librarye.g. Sysgem::ODBCAddRecord() • Perl Subroutine, e.g.: “UMLogAddAccount()”calls: Sysgem::ODBCAddRecord() • UMLogAddAccount()” is held in the SAcM Include file:“SAcM_Logfile” • SEM Include Files are held in a SEM Module Library
6.2 Example DB Access.(SAcM Audit record) Code within a standard SAcM Script: use Sysgem; #include SAcM_Logfile my $AudSeq = AuditSeqNumber(); UMLogAddAccount($SysgemComputer, $SysgemUsername, $ENTRY_UN, "Exchange2000 mailbox modified", $SERVER_TYPE, $SERVER_NAME, "Audit Seq. No..: $AudSeq", @mods);
6.3 Example DB Access.(SAcM Audit record) Call to the (compiled) Sysgem library routine from within the ‘included’ routine: UMLogAddAccount() use Sysgem; $status = Sysgem::ODBCAddRecord($db_umlog_dsn, "", $db_umlog_table_actions, \@fields, \@values, $error);
7.0 Script Logfile Window Set verbose on for debugging (Send, Rcv)
8.0 SEM Development: Starting to Edit a Display Script With the correct permissions, the “Edit” option appears With the correct SEM permissions applied, the “Edit” options appear
8.1 Select a Display (e.g. “Enterprise Accounts”) Double click a display to start the SEM editor
8.2 Use the Navigation Bar to Navigate between Pages Navigation Bar... Select the “Columns” page
8.3 The Columns page defines the characteristics of the text shown on a SEM Display Window Note, particularly, the Column Title and Column Code
8.4 Navigate to the Scripts Page Select “Scripts”
8.5 Main Display Scripts Target (platform-specific) Scripts Pre- & Post- Processing
Exercise 1 See separate PowerPoint Presentation for details of “Exercise 1” (Simple Display)
8.7 Post-Processing Script Intercept (& filter) Agent Output # # Replace the output. # print "{{REPLACE_VALUES=YES\n“; # # Load Agent output into input array. # LoadInputArray(); # Agent output now in @input_array foreach $input (@input_array) { …
Exercise 2 See separate PowerPoint Presentation for details of “Exercise 2” (Post-processing - filter/modify agent output)
8.8 Pre-processing Script # @{{AUTOSTART_DISPLAY_TITLE <Display name here> # # Status Bar # print "\@{{STATUS_BAR_TEXT <status text here>\ \n"; # # Header Banner # print "\@{{ADD_WINDOW_TITLE <banner text here>\n";
Exercise 3 See separate PowerPoint Presentation for details of “Exercise 3” (Pre-processing - banner & status bar)
8.9 Customer Include Files Most Enterprise Accounts scripts have two lines at the top and bottom similar to these.
8.11 Editing Custom Include Files (find: “Main-Script-Post”) #++ # # Main Script Post # # Added .....: 14-Jul-2000 06:35:39 # Platform ..: Windows # #-- @{{CUSTOM_CODE_START(Main-Script-Post) @}}CUSTOM_CODE_START(Main-Script-Post) @{{CUSTOM_CODE_FINISH(Main-Script-Post) @}}CUSTOM_CODE_FINISH(Main-Script-Post)
8.12 Editing Custom Include Files (insert custom script) #++ # # Main Script Post # # Added .....: 14-Jul-2000 06:35:39 # Platform ..: Windows # #-- @{{CUSTOM_CODE_START(Main-Script-Post) print “Hello World \n”; @}}CUSTOM_CODE_START(Main-Script-Post)
8.13 VariablesDefinedAutomatically in SEM Scripts • Before a script is run, SEM places variables into the script that describe the environment in which the script runs. • Appendix A to the associated course notes describes these variables.
Exercise 4 See separate PowerPoint Presentation for details of “Exercise 4” (Interface with Options Cache)
Menu Options 2. 3. 4. 5. 1.
Exercise 5 See separate PowerPoint Presentation for details of “Exercise 5” (Write Audit Log)
Passing Variables to Agent Scripts # # Insert a line into the agent script from a “Menu Pre-Process” script # print "\@{{ADD_SVR<string to insert>\n"; # # For example… # if ($SERVER_TYPE =~ m/UNIX/) { print "\@{{ADD_SVR echo \"$CC\" \n"; } elsif ($SERVER_TYPE =~ m/VMS/) { print "\@{{ADD_SVR \$ write sys$output \"$CC\" \n"; } elsif ($SERVER_TYPE =~ m/Windows/) { print "\@{{ADD_SVR print \"$SubCC\\n\";\n"; }
Current Subscriber # # Do not refresh the display. # # @{{REFRESH_DISPLAY=NO # # Modify this entry on the display. # print "\@{{DSP_MOD 99 $ENTRY_99\n"; # Index of entry to modify foreach $line (@script_output) { if (substr($line, 2, 3) eq " : ") { $line =~ s/ : / /; print "\@{{DSP_MOD " . $line . "\n"; } }
Suppress a Refresh & Modify an Entry in Situ # # Do not refresh the display. # # @{{REFRESH_DISPLAY=NO # # Modify this entry on the display. # print "\@{{DSP_MOD 99 $ENTRY_99\n"; # Index of entry to modify print "\@{{DSP_MOD XX new value\n"; # # Do not refresh the display. # # @{{REFRESH_DISPLAY=NO # # Modify this entry on the display. # print "\@{{DSP_MOD 99 $ENTRY_99\n"; # Index of entry to modify foreach $line (@script_output) { if (substr($line, 2, 3) eq " : ") { $line =~ s/ : / /; print "\@{{DSP_MOD " . $line . "\n"; } }
Exercise 6 See separate PowerPoint Presentation for details of “Exercise 6” (Work with Subscriber)
Exercise 7 See separate PowerPoint Presentation for details of “Exercise 7” (Menu Option: Modify)