1 / 34

Creating and Printing Ad-Hoc Queries from the Tivoli Desktop

Creating and Printing Ad-Hoc Queries from the Tivoli Desktop. Martin Jones DFAS-ISO/Infrastructure Engineering. Our Environment. Hub TMR: 1 (Solaris). Spoke TMRs: 6 (Solaris). Gateways: 40 (NT). Inventory Databases: 1 (Oracle) Total workstations: 18,989 Tivoli Desktops: ~100. DFAS.

Télécharger la présentation

Creating and Printing Ad-Hoc Queries from the Tivoli Desktop

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Creating and Printing Ad-Hoc Queries from the Tivoli Desktop Martin Jones DFAS-ISO/Infrastructure Engineering

  2. Our Environment • Hub TMR: 1 (Solaris). • Spoke TMRs: 6 (Solaris). • Gateways: 40 (NT). • Inventory Databases: 1 (Oracle) • Total workstations: 18,989 • Tivoli Desktops: ~100

  3. DFAS TMRs DFAS Infrastructure Database FSO CL CO DE IN KC ISO CL(3) CO(3) DE(3) IN(4) KC(1) OMD DCH DDY DGK EPET DJP DLI DLW HQ DNF DOM DLX Gateways FPE DOK DSA DOR SPR DPC DSB DRI DPE DRO DSD DSL DSS

  4. How We Started • Focus on Inventory. • Periodic scans collect hardware and software (.exe only). • Standard queries created based on user requests. • Users access Inventory data via Tivoli desktop. • Users are not allowed to edit queries.

  5. In the Beginning... • Users were given Tivoli desktops with standard queries already defined. • Users wanted to use the Inventory query output in reports. • The Tivoli desktop does NOT provide a way to view Inventory query output.

  6. The Tivoli Query

  7. Output from the Tivoli Query?

  8. The First Solution • Allow the standard queries to be run as jobs. • Let the users run these jobs. • Produce output in a semicolon delimited format that can be copied to a spreadsheet.

  9. Run a Query from a Perl Script #!/etc/Tivoli/bin/perl # This script takes a query name as input and runs it. # Read input $query=@ARGV[0]; chop($query); # Source the Tivoli Environment grep(do{chop;s/(.*)=(.*)/$ENV{$1}=$2/e;},`. /etc/Tivoli/setup_env.sh;env`); @Results=`wrunquery -d ";" "$query"`; print @Results;

  10. Wrap the Perl Script into a Task TaskLibrary "FSO_Inventory_Tasks" { Distribute = "ALI"; Version = "1.0"; Requires = ">2.5"; Context = "*"; HelpMessage = "Inventory queries delimited with semicolons."; ArgLayout Query { Choice Program { Implementation ("default") .#/bin/sh .wlookup -Lar Query | grep fso-qry .exit 0 ; }; }; Task FSO_Inventory_Query { Description = "Displays inventory queries in semicolon delimited format."; HelpMessage = "Cut and paste output into Excel spreadsheet."; Roles = "user"; Uid = "$root_user"; Gid = "tivoli"; Argument ("_!_", "Query to run", 1) { Layout = "Query"; }; Implementation ("default") Binary "/var/spool/Tivoli/tasks/INVENTORY/db-query.pl"; }; }

  11. Create Task Library, Task, and Job #!/bin/sh # the user will need the following rights to run this job # global user,Query_execute,RIM_view # fso-tmr-inventory-region Query_edit ALI_OID=`wlookup ServerManagedNode` eval SERVER=`idlcall $ALI_OID _get_label` POLICYREGION="fso-library-region" TL="FSO_Inventory_Tasks" wlookup -r PolicyRegion "$POLICYREGION" > /dev/null 2>&1 if [ $? != 0 ] then echo "The policy region $POLICYREGION does not exist" exit 1 fi echo "Creating TaskLibrary..." wtll -rp "$POLICYREGION" -P /usr/ccs/lib/cpp $TL.tll echo "Creating FSO_Inventory_Query_Job..." wcrtjob -j FSO_Inventory_Query_Job -l $TL -t FSO_Inventory_Query -M serial -m 600 -o 15 -D -h @ManagedNode:$SERVER exit 0

  12. Results

  13. Running the FSO_Inventory_Query

  14. Output of the FSO_Inventory_Query

  15. Place Results into a Spreadsheet

  16. Format the Spreadsheet

  17. User Rights Required $ wgetadmin lmtduser@fso-ms-w-tmn1 Administrator: Limited User on fso-ms-w-tmn1 logins: lmtduser@fso-ms-w-tmn1 roles: security_group_any_admin user Limited User on fso-ms-w-tmn1 admin, user, rconnect global user, Query_execute, RIM_view notice groups:

  18. The Next Opportunity... • Our security community requested scans for .jpg, .gif, .mov, and .mpg files.

  19. Next Opportunity Issues • They do not have standard files to search for (ie. anna.jpg or winproj.exe), so no standard queries.

  20. Run the Query from the Perl Script #!/etc/Tivoli/bin/perl if ($#ARGV == -1) { print "Search string required for processing.\n"; exit 1; } ($Name) = @ARGV; $Site = "FSC"; $Name =~ tr/a-z/A-Z/; $output1 = `wsetquery -w \"(TME_OBJECT_LABEL like '%"$Site"%' and FULL_FILE_NAME like '%$Name%')\" qry-fso-adhoc 2>&1`; if (!$?) { $output2 = `wrunquery -d \";\" qry-fso-adhoc 2>&1`; if (!$?) { print "$output2\n"; }else{ print "Error with query output : $?\n"; } }else{ print "Error with set query : $?\n"; }

  21. TaskLibrary "FSO_Inventory_Tasks" { Distribute = "ALI"; Version = "1.0"; Requires = ">2.5"; Context = "*"; HelpMessage = "Inventory queries delimited with semicolons."; ArgLayout Query { Choice Program { Implementation ("default") .#/bin/sh .wlookup -Lar Query | grep fso-qry .exit 0 ; }; }; ArgLayout TextField { Text; }; Task FSO_Inventory_Query { Description = "Displays inventory queries in semicolon delimited format."; HelpMessage = "Cut and paste output into Excel spreadsheet."; Roles = "user"; Uid = "$root_user"; Gid = "tivoli"; Argument ("_!_", "Query to run", 1) { Layout = "Query"; }; Implementation ("default") Binary "/var/spool/Tivoli/tasks/INVENTORY/db-query.pl"; }; Task FSO_AdHoc_Query { Description = "Queries all software for FSO workstations."; HelpMessage = "Cut and paste output into Excel spreadsheet. Semicolon delimited."; Roles = "user"; Uid = "$root_user"; Gid = "tivoli"; Argument ("_!_", "String to search for:", 1) { Layout = "TextField"; }; Implementation ("default") Binary "/var/spool/Tivoli/tasks/INVENTORY/fso-qry-adhoc.pl"; }; } Wrap the Perl Script into a Task

  22. Running the FSO_AdHoc_Query

  23. Output of the FSO_AdHoc_Query

  24. User Rights Required $ wgetadmin lmtduser@fso-ms-w-tmn1 Administrator: Limited User on fso-ms-w-tmn1 logins: lmtduser@fso-ms-w-tmn1 roles: security_group_any_admin user Limited User on fso-ms-w-tmn1 admin, user, rconnect global user, Query_execute, RIM_view fso-tmr-inventory-region Query_edit notice groups:

  25. Where Did We Hide the Queries

  26. What Does the Query Look Like

  27. What About the DB View INSTALLED_FILE_VIEW select C.TME_OBJECT_ID, C.TME_OBJECT_LABEL, I.* from INSTALLED_UNKNOWN_FILE I, COMPUTER_SYSTEM C where I.HARDWARE_SYSTEM_ID = (select HARDWARE_SYSTEM_ID from COMPUTER_SYSTEM where TME_OBJECT_LABEL = C.TME_OBJECT_LABEL)

  28. Creating the Jobs from CLI #!/bin/sh # the user will need the following rights to run this job # global user,Query_execute,RIM_view # fso-tmr-inventory-region Query_edit ALI_OID=`wlookup ServerManagedNode` eval SERVER=`idlcall $ALI_OID _get_label` POLICYREGION="fso-library-region" TL="FSO_Inventory_Tasks" wlookup -r PolicyRegion "$POLICYREGION" > /dev/null 2>&1 if [ $? != 0 ] then echo "The policy region $POLICYREGION does not exist" exit 1 fi echo "Creating TaskLibrary..." wtll -rp "$POLICYREGION" -P /usr/ccs/lib/cpp $TL.tll echo "Creating FSO_Inventory_Query_Job..." wcrtjob -j FSO_Inventory_Query_Job -l $TL -t FSO_Inventory_Query -M serial -m 600 -o 15 -D -h @ManagedNode:$SERVER echo "Creating FSO_AdHoc_Query_Job..." wcrtjob -j FSO_AdHoc_Query_Job -l $TL -t FSO_AdHoc_Query -M serial -m 1200 -o 15 -D -h @ManagedNode:$SERVER exit 0

  29. What Does the Task Look Like?

  30. What Does the Job Look Like?

  31. Issues and Concerns • This solution does not address all reporting needs. • Spreadsheet row limit ~ 65,500. • We have 13,524,855 .exe files (710 per workstation). • We have 3,657,066 .jpg files (191 per workstation). • We have 17,047,029 .gif files (894 per workstation ). • All queries flow through 1 RIM per TMR. • WAN affects query time. • Jobs may time-out before query returns.

  32. Next Steps • Eliminate the RIM interface by using SQL*Plus. • Target specific directories during the software scans. • Reduce the query output by filtering on the endpoint’s label.

  33. Summary • Small investment in time results in big user benefits. • Perl scripts and the Tivoli Task Library Language can be used to make standard queries printable. • Further Perl scripting can be used to modify a ‘where’ clause and give the illusion of an Ad-Hoc query that is printable.

  34. References • Tivoli Task Library Language Developer’s Guide - Version 3.6.1, https://www.tivoli.com/secure/support/Prodman/html/framework.html • Advanced Task Management by Simon Barnes, OrbData, http://www.orb-data.co.uk/technical-layout.html

More Related