Skip navigation
1 2 3 Previous Next

TrueSight Server Automation

122 posts
Share:|

I am super excited to share that TrueSight Server Automation 8.9.04 release is GA!! Following are the salient features of this release.

 

Job qualification check

You can now set the maximum number of servers targeted by a job. Every time you perform the following actions, a message with the number of target servers is displayed. This option is available through GUI only.

  • Create Job
  • Create Execution Task
  • Modify Job
  • Execute Against
  • Execute a job

Powershell integration

  • Execute PowerShell scripts through Type 3 NSH Scripts and scriptutil.
  • Extended Objects can support PowerShell script natively.
  • Option to generate script logs for Network Shell script job for ease of parsing.
  • Ability to easily pass custom arguments while launching PowerShell scripts as well as simple configuration to set the launch command for PowerShell.

 

 

Added platform support

  • Windows Server 2019 operating system
  • Ubuntu 18.04 operating system
  • POWER9 architecture

Compliance Content

  • CIS for SUSE 12 and Windows 2016
  • PCI for Windows 2016
  • DISA,PCI,CIS templates of old OS versions have been upgraded to the latest template versions.

 

For more details please visit Service Pack 4: version 8.9.04 - Documentation for TrueSight Server Automation 8.9.00 - BMC Documentation

Share:|

Coming up on October 18, 2018 is BMC’s annual user event, the BMC Exchange in New York City!

 

Exchange-NY-CityImage-Linkedin.jpg

 

During this free event, there will be thought-provoking keynotes including global trends and best practices.  Also, you will hear from BMC experts and your peers in the Digital Service Operations (DSO) track.  Lastly, you get to mingle with everyone including BMC experts, our business partners, and your peers.  Pretty cool event to attend, right? 

 

In the DSO track, we are so excited to have 3 customers tell their stories. 

  • Cerner will speak about TrueSight Capacity Optimization and their story around automation and advanced analytics for capacity and planning future demand.   Check out Cerner’s BizOps 101 ebook
  • Park Place Technologies’ presentation will focus on how they leverage AI technology to transform organizations.
  • Freddie Mac will join us in the session about vulnerability management.  Learn how your organization can protect itself from security threats.  Hear how Freddie Mac is using BMC solutions. 

 

BMC product experts will also be present in the track and throughout the entire event.

  • Hear from the VP of Product Management on how to optimize multi-cloud performance, cost and security
  • Also, hear from experts on cloud adoption.  This session will review how TrueSight Cloud Operations provides you visibility and control needed to govern, secure, and manage costs for AWS, Azure, and Google Cloud services.

 

At the end of the day, there will be a networking reception with a raffle (or 2 or 3).  Stick around and talk to us and your peers.  See the products live in the solutions showcase. Chat with our partners.  Stay around and relax before heading home. 

 

Event Info:

Date: October 18th 2018

When: 8:30am – 7:00pm

  • Keynote begins at 9:30am
  • Track Sessions begin at 1:30pm
  • Networking Reception begins at 5:00pm

Where: 415 5th Ave, NY, NY 10016

 

For more information and to register, click here

 

Look forward to seeing you in NYC!  Oh, and comment below if you are planning to attend!  We are excited to meet you.

Share:|

Happy to announce that TrueSight Server Automation 8.9.03 went GA on 12th June 2018 & BMC Server Automation has been renamed to TrueSight Server Automation

Highlights of the release:

  • HIPAA Compliance for AIX 7.1
  • Ivanti 9.3 SDK based patching
    • Windows patching will now be supported using Ivanti(Shavlik) SDK 9.3
  • SMB2 support
    • Add Node which is SMB2 enabled - Agent Installer Job through RCP to a SMB2 enabled targets.
    • Unified Agent Installer to a SMB2 enabled targets.
  • SHA256 support

We are upgrading the secured certificates to support “Signature Algorithm” with SHA2 key. Those will be available at following places for this release.

      • Self-Signed certificate used by Application Server
      • Agent certificate

 

  • Security Enhancements

There are JRE and Magnicomp vulnerabilities which have got fixed. There are other vulnerability fixes also along with these which are discovered from application security team.

Questions or feedback? Comment below to let us know

For more details please take a look at the documentation here - Service Pack 3: version 8.9.03 - Documentation for TrueSight Server Automation 8.9.00 - BMC Documentation

Share:|

It can be useful to manually run yum or blyum with the repodata and includes from the command line to get a better picture of what might be happening during analysis or inspect the repodata or perform any other troubleshooting steps.  The following steps can be taken to accomplish this:

 

For 8.9.01 and below

Run the Patching Job with the DEBUG_MODE_ENABLED set to true. 

Gather the per-host generated data from the application server - for example if the Job Name is 'RedHat Analysis' and it was run against the target 'red6-88.example.com' on Jun 11 you should see a directory:

<install dir>/NSH/tmp/debug/application_server/RedHat Analysis/Sat Jun 11 09-26-57 EDT 2016/red6-88.example.com

that contains:

analysis_err.log analysis_log.log analysis_res.log installed_rpms.log repo repodata.tar.gz yum_analysis.res yum.conf yum.err.log yum.lst

 

Copy the entire red6-88.example.com directory back to the target system (or any system you want to test these files on) into /tmp or some other location.

 

For 8.9.01 and later

The files mentioned above are kept in <rscd install>/Transactions/analysis_archive on the target system.  The three most recent runs should be present.

 

 

 

Once you've located the files used for analysis and located them on the target system

Edit the yum.conf and the cachedir and reposdir to match the current directory path.  Following the pre-8.9.01 example where we copied the directory into /tmp:

cachedir=//var/tmp/stage/LinuxCatalog_2002054_red6-88.example.com
reposdir=//var/tmp/stage/LinuxCatalog_2002054_red6-88.example.com

are changed to match the new path - if you copied the red6-88.example.com to /tmp then:

cachedir=//tmp/red6-88.example.com
reposdir=//tmp/red6-88.example.com

then from within that directory you can run:

/opt/bmc/bladelogic/NSH/bin/blyum -c yum.conf -C update

if an include list was used you can do:

/opt/bmc/bladelogic/NSH/bin/blyum -c yum.conf -C update `cat rpm-includes.lst.old`

or

/opt/bmc/bladelogic/NSH/bin/blyum -c yum.conf -C update `cat parsed-include.lst.old`

if the parsed list exists.  The parsed include list will not contain any rpms that are installed on the target and in the include list.  The parsed-include.lst was added in recent BSA versions to handle the situation where yum decides to update the rpm to the latest one in the catalog instead of leaving it alone when the include list contains the exact version of an rpm already installed on the system.

 

If it's a RedHat 7 target, the native yum is used, so use yum instead of blyum.

yum -c yum.conf -C update

 

You can also use the above process to copy the metadata from the target system to another system and run queries against the metadata or run analysis with the same metadata and options against a test system.  for example you could run:

/opt/bmc/bladelogic/NSH/bin/blyum -c yum.conf -C search <rpmname>

or

/opt/bmc/bladelogic/NSH/bin/blyum -c yum.conf -C info <rpmname>

 

to see if some rpm is in the metadata or not.

Share:|

BMC Software is alerting customers who use BMC Server Automation (BSA) for managing Unix/Linux Targets to this Knowledge Article which highlights vulnerability CVE-2018-9310 in the Magnicomp Sysinfo solution used by BSA RSCD Agent to capture Hardware Information. The Knowledge Article contains the details of the issue and also how to obtain and deploy the fix.

Share:|

September 25, 2018 - Important update to below alert:

BMC Software has negotiated an extension of support for Shavlik version 9.1 to provide BMC Server Automation users additional time to upgrade. With this extension, users now have until September 30, 2019 to upgrade the BMC Server Automation infrastructure and the BMC Server Automation RSCD agents running on Microsoft Windows target servers.

Users who cannot upgrade their BMC Server Automation environment and Windows targets to one of the patches/releases listed in this topic by December 31, 2018, must instead reconfigure their environment by December 31, 2018, in order for Windows patching to continue to function.

This flash and prior notification (below) are now modified to reflect this update.

_______________________________________________________________________________________________________________________________________________________

 

Updated original notification from May 2018::

 

BMC Software is alerting users of BMC Server Automation for Windows Patching, that action must be taken before December 31, 2018 to ensure continued functioning of Windows Patching within the BMC Server Automation product beyond that date.

 

One of the following actions must be taken:

 

a) Upgrade the BSA Environment, including the RSCD agents on all Windows Targets used for BSA Patch Analysis, by December 31, 2018

or

b) A minor configuration change must be made to the BSA Environment by December 31, 2018 followed by an upgrade before the extended EOL date of September 30, 2019

 

Please see this updated Flash Bulletin in the BSA Documentation for full details.

Share:|

If you want to increase or decrease the logging level for the appserver there's a pretty easy way to accomplish this - edit the appserver's log4j.properties file. There are already a number of logging class entries in there and you may want to increase or decrease logging on some classes not listed.  There's a fairly simple way to figure out what classes are associated with what log entries:  add the class to the logger.  In the log4j.properties near the top look for these two lines:

log4j.appender.C.layout.ConversionPattern=[%d{DATE}] [%t] [%p] [%X{user}:%X{role}:%X{ip}] [%X{action}] %m%n
log4j.appender.R.layout.ConversionPattern=[%d{DATE}] [%t] [%p] [%X{user}:%X{role}:%X{ip}] [%X{action}] %m%n

 

we can add the class (category) by adding a %c and we'll put that in brackets so it looks like the rest of the log:

log4j.appender.C.layout.ConversionPattern=[%d{DATE}] [%t] [%p] [%c] [%X{user}:%X{role}:%X{ip}] [%X{action}] %m%n
log4j.appender.R.layout.ConversionPattern=[%d{DATE}] [%t] [%p] [%c] [%X{user}:%X{role}:%X{ip}] [%X{action}] %m%n

 

after about a minute, without restarting the appserver service, you will see the new log entries like:

[19 Mar 2018 08:57:35,073] [Scheduled-System-Tasks-Thread-10] [INFO] [com.bladelogic.om.infra.app.service.appserver.AppserverMemoryMonitorTask] [System:System:] [Memory Monitor] Total JVM (B): 625135616,Free JVM (B): 453789168,Used JVM (B): 171346448,VSize (B): 8967577600,RSS (B): 1027321856,Used File Descriptors: 300,Used Work Item Threads: 0/100,Used NSH Proxy Threads: 0/15,Used Client Connections: 3/200,DB Client-Connection-Pool: 2/2/0/200/150/50,DB Job-Connection-Pool: 2/2/0/200/150/50,DB General-Connection-Pool: 1/1/0/200/150/50

 

generally we should then be able to add entries like:

log4j.logger.<class>=<level>

to the log4j.properties file.

 

For example, if I don't want to see info messages from compliance job runs, I would turn on the class logging and then run a compliance job.  I'd see some entries like

[19 Mar 2018 08:57:36,903] [Job-Execution-2] [INFO] [com.bladelogic.om.infra.compliance.job.ComplianceJobExecutor] [BLAdmin:BLAdmins:] [Compliance] --JobRun-2000915,3-2052417-- Started running the job 'CisWin2012R2ComplianceJob' with priority 'NORMAL' on application server 'blapp89.example.com'(2,000,000)

I then add:

log4j.logger.com.bladelogic.om.infra.compliance.job.ComplianceJobExecutor=ERROR

to my log4j.properties file and wait a couple minutes and then re-run the job.  You should no longer see the INFO message.  Conversely, I may be able to get more information  out of this class by setting it to DEBUG, but that will depend if there is any debug logging already built into the class or not, which is not guaranteed. 

 

One thing to note - if you want to change the logging from DEBUG back to INFO or ERROR back to INFO you must alter the logger line, you can't simply delete the line from the log4j.properties file. 

 

If you elect do the above to reduce logging, make sure that when you interact with BMC Support you make it clear you have altered the logging levels because during troubleshooting we may be looking for log messages you have excluded and we will spend a lot of time figuring that out.

 

Using the above to enable debug logging can be useful while troubleshooting issues with the application server.  The nuclear option of course is to change the root logging level:

log4j.rootLogger=INFO, R, C

and if that is done you will likely need to increase the size of and number of rolled logs to handle the additional information being dumped into the files:

# Set the max size of the file

log4j.appender.R.MaxFileSize=20000KB

#Set the number of backup files to keep when rolling over the main file

log4j.appender.R.MaxBackupIndex=5

It's much better if you can use the above method to figure out what class you want more (or less) logging on or in the case of needing debug using the DEBUG_MODE_ENABLED property on the job to get job run debug information for a particular job.

 

Generally you should not have to alter the logger settings during normal operation.

Share:|

We are excited to introduce you to our new YouTube channel “BladeLogic Automation” for "How-to" videos, intended to help with a specific task or feature of products in the BladeLogic Automation suite (BSA, BDSSA, BDA and BNA).

 

 

Highlights:

 

Focused contents:  The contents of this channel will only focus on providing technical videos for the Server Automation, Decision Support for Server Automation,Database Automation and Network Automation products.   This content is developed by the BMC Support technical teams.

 

Featured Playlists: The channel will focus on technical contents, such as how-to, troubleshooting guides and functional demonstrations. Similar features/functions and categories will have their own Playlists to reduce the time to search the contents.

 

Snippet of our Playlists:

Click  to receive notifications when the new technical content is posted on the channel and to get the most out of the products – BSA, BDSSA, BNA and BDA.

Refer to our "Playlists" to play all the videos organized by topic or a product.

Here are the current Playlists:

 

We welcome feedback from the community.

Share:|

We are excited to introduce you to our new YouTube channel “BladeLogic Automation” for "How-to" videos, intended to help with a specific task or feature of products in the BladeLogic Automation suite (BSA, BDSSA, BDA and BNA).

 

 

Highlights:

 

Focused contents:  The contents of this channel will only focus on providing technical videos for the Server Automation, Decision Support for Server Automation, Database Automation and Network Automation products.   This content is developed by the BMC Support technical teams.

 

Featured Playlists: The channel will focus on technical contents, such as how-to, troubleshooting guides and functional demonstrations. Similar features/functions and categories will have their own Playlists to reduce the time to search the contents.

 

Snippet of our Playlists:

Click  to receive notifications when the new technical content is posted on the channel and to get the most out of the products – BSA, BDSSA, BNA and BDA.

Refer to our "Playlists" to play all the videos organized by topic or a product.

Here are the current Playlists:

 

We welcome feedback from the community.

Share:|

I am very pleased to announce that BSA 8.9 Service Pack 2 is now available.

 

Here are some highlights of the release:

1>     Compliance Support:

    1. DISA STIG content update for Windows 2016
    2. DISA STIG content update for RH 7

2>     Patch Analysis support for AIX Multibos

Users can now perform patch analysis on the standby instance of the Base Operating System (BOS) which is maintained in the same root volume group as the active BOS object.

3>     Patching support for AIX on an Alternate Disk or Multiple Boot Operating System

Some versions of AIX have the capability of maintaining multiple instances of Base Operating Systems (BOS). The additional instance of the BOS can be maintained in the same root volume group (multibos) or on a separate disk on a separate root volume group (alternate disk). The user can boot any one instance of the BOS which is called the active instance. The instance that has not been booted remains as a stand by instance. BMC Server Automation supports installation, maintenance, and technology-level updates on the stand by BOS instance without affecting system files on the active BOS.

4>     Export Health Dashboard

Users can now export the entire Health Dashboard in HTML format.

5>     Deprecation on Red Hat Network download option

Red Hat transitioned from its Red Hat Network hosted interface to a new Red Hat Subscription Management interface. To enable customer to seamlessly continue patching on Red Enterprise Linux, we have deprecated RHN download option. All patching on RHEL targets must be performed using the CDN download option (its selected by default when creating patch catalog).

6>     Message to review he number of target servers

To prevent any unplanned outages in your data centre, BSA now allows you to review the number of servers targeted by a job.

7>     Database cleanup and BLCLI enhancements

Share:|

This is a pretty easy one so I thought I'd do a little more with scripting to make it more fun.  I have a Batch Job and I want to get all the member job keys/names/paths/etc.  I don't see any released blcli commands that will do it so I'll look in the ...Unreleased blcli commands and documentation ...  Digging around in the BatchJob namespace (of course) I don't see any list* or get* commands that would do it, though the getMemberJobCountByJobKey looks interesting for later.  I did find a findAllSubJobHeadersByBatchJobKey which looks promising.  I know about headers from past posts in this series.    That gives me something like this:

BATCH_JOB="/Workspace/BatchJobs/MyBatchJob"
blcli_execute BatchJob getDBKeyByGroupAndName "${BATCH_JOB%/*}" "${BATCH_JOB##*/}"
blcli_storeenv batchJobKey
blcli_execute BatchJob findAllSubJobHeadersByBatchJobKey ${batchJobKey}
blcli_execute SJobHeader getDBKey
blcli_execute Utility setTargetObject
blcli_execute Utility listPrint
blcli_storelocal memberJobKeys

Easy-peasy.  What if one of those members is a Batch Job and I want the member jobs in there ? I can probably script together something like that, but first I should create a test batch job to work this out.  I want something like:

Batch Job1

    -> Member Job1a

    -> Member Job1b

    -> Member Job Batch2

                 -> Member Job2a

                 -> Member Job2b

     -> Member Job1c

I could just see what jobs I already have in my test environment and use the gui to create the above but that's no fun.  Why not script out the creation and then script reading it all back ?  Then I'll have a couple scripts I can take between environments to make sure it works the same across BSA versions and such.

 

I'll make some Update Server Properties Jobs as the members since they don't need a Depot Object just to make this a little shorter.  For that I have UpdateServerPropertyJob.createUpdateServerPropertyJobWithTargetServer that should do nicely.  I need to:

Create my USP jobs

Create the member batch jobs

Add some of the USPs to the member batch jobs

create the parent batch job

add the usp and member batches to that job

 

Then another script based on my snippet above will recurse through what I created and spit out the list of jobs in each batch.

 

Below is the script to create the nested Batch Job I'm going to test my dump script against.  This part is really just an exercise to show how you can quickly mock up up some test data to do actual work on with the blcli instead of doing it by hand in the BSA GUI.  Since this required running the same commands a few times I broke out some of the actions into functions in the script.

#!/bin/nsh
blcli_setjvmoption -Dcom.bladelogic.cli.execute.quietmode.enabled=true
blcli_setoption serviceProfileName defaultProfile
blcli_setoption roleName BLAdmins
jobGroup="/Workspace/BatchJobTest"
jobGroupExists="false"
batchJob="TestBatch"
targetServer="blapp891.local"
# Check if the group is there and make it if not
blcli_execute JobGroup groupExists "${jobGroup}"
blcli_storelocal jobGroupExists
if [[ "${jobGroupExists}" = "false" ]]
        then
        blcli_execute JobGroup createGroupWithParentName "${jobGroup##*/}" "${jobGroup%/*}"
fi
blcli_execute JobGroup groupNameToDBKey "${jobGroup}"
blcli_storelocal jobGroupKey
blcli_execute Utility convertModelType UPDATE_SERVER_PROPERTY_JOB
blcli_storelocal uspJobTypeId
blcli_execute Utility convertModelType BATCH_JOB
blcli_storelocal batchJobTypeId
# Make some USP Jobs
for i in {1..3}
        do
        for j in a b c
                do
                blcli_execute Job jobExistsByTypeGroupAndName ${uspJobTypeId} ${jobGroupKey} "USP-${i}${j}"
                blcli_storelocal jobExists
                if [[ "${jobExists}" = "false" ]]
                        then
                        blcli_execute UpdateServerPropertyJob createUpdateServerPropertyJobWithTargetServer "USP-${i}${j}" "${jobGroup}" "${targetServer}"
                fi
        done
done
createBatchJobWithUSP()
{
   local batchJob="${1}"
   local uspJob="${2}"
   local jobGroupId="${3}"

   blcli_execute UpdateServerPropertyJob getDBKeyByGroupAndName "${uspJob%/*}" "${uspJob##*/}"
   blcli_storelocal uspKey
   blcli_execute Job jobExistsByTypeGroupAndName ${batchJobTypeId} ${jobGroupKey} "${batchJob}"
   blcli_storelocal jobExists
   # delete the batch job if it already exists, then re-create it
   if [[ "${jobExists}" = "true" ]]
        then
        blcli_execute BatchJob deleteJobByGroupAndName "${jobGroup}" "${batchJob}"
   fi
   blcli_execute BatchJob createBatchJob "${batchJob}" ${jobGroupId} ${uspKey} true false false
   blcli_storeenv batchJobKey
}
addMemberJob()
{
   local type="${1}"
   local memberJob="${2}"
   local batchJob="${3}"

   blcli_execute ${type} getDBKeyByGroupAndName "${memberJob%/*}" "${memberJob##*/}"
   blcli_storelocal memberJobKey
   blcli_execute BatchJob getDBKeyByGroupAndName "${batchJob%/*}" "${batchJob##*/}"
   blcli_storelocal batchJobKey
   blcli_execute BatchJob addMemberJobByJobKey ${batchJobKey} ${memberJobKey}
}
blcli_execute JobGroup groupNameToId "${jobGroup}"
blcli_storelocal jobGroupId
# put the 2 and 3 jobs in batch jobs
for i in {2..3}
        do
        createBatchJobWithUSP "${batchJob}-${i}" "${jobGroup}/USP-${i}a" ${jobGroupId}
        for j in b c
                do
                addMemberJob UpdateServerPropertyJob "${jobGroup}/USP-${i}${j}" "${jobGroup}/${batchJob}-${i}"
        done
done
createBatchJobWithUSP "${batchJob}-1" "${jobGroup}/USP-1a" ${jobGroupId}
addMemberJob BatchJob "${jobGroup}/${batchJob}-2" "${jobGroup}/${batchJob}-1"
addMemberJob UpdateServerPropertyJob "${jobGroup}/USP-1b" "${jobGroup}/${batchJob}-1"
addMemberJob BatchJob "${jobGroup}/${batchJob}-2" "${jobGroup}/${batchJob}-1"
addMemberJob UpdateServerPropertyJob "${jobGroup}/USP-1c" "${jobGroup}/${batchJob}-1"

That gives me a Batch Job that looks like:

That seems like a lot of work just to make a job for me to test with.  In this case, yeah, it probably was.  Is the script perfect ? Could I add more error handling ? Could it be more elegant ?  It took me about 15 minutes to write and test it out.  It works.  I could have made the jobs there from scratch in about five minutes by hand in the BSA GUI.  But let's say I need to do this again in another environment, and then another.  Or what I'm testing requires me to have a lot of jobs and then delete them.  That's when doing some automation to setup your test data pays off.

 

Now let's start the real work - listing out the Batch Job and its members.  I'm going to forget I wrote this script and pretend I only know the Batch Job that I care about /Workspace/BatchJobTest/TestBatch-1.

Now I need to:

Get my Batch Job

List all the Jobs in it

See if any of those are in turn batch jobs and if so loop back to the first step

 

That loop part probably means another function.  I already have the bit to list all the member jobs from the snippet at the very beginning. I just need to handle the recursion:

#!/bin/nsh
blcli_setjvmoption -Dcom.bladelogic.cli.execute.quietmode.enabled=true
blcli_setoption serviceProfileName defaultProfile
blcli_setoption roleName BLAdmins
if [[ ${#@} -ne 1 ]]
        then
        echo "You must pass the Batch Job"
        exit 1
fi
batchJob="${1}"
getBatchJobMembers()
{
   local batchJob="${1}"
   local batchJobKey=
   local memberKeys=
   local hasParent="${2}"
   blcli_execute BatchJob getDBKeyByGroupAndName "${batchJob%/*}" "${batchJob##*/}"
   blcli_storelocal batchJobKey
   blcli_execute BatchJob findAllSubJobHeadersByBatchJobKey ${batchJobKey}
   blcli_execute SJobHeader getDBKey
   blcli_execute Utility setTargetObject
   blcli_execute Utility listPrint
   blcli_storelocal memberKeys
   while read memberKey
     do
     blcli_execute Job findByDBKey ${memberKey}
     blcli_execute Job getType
     blcli_storelocal jobTypeId
     blcli_execute Job getName
     blcli_storelocal jobName
     blcli_execute Job getGroupId
     blcli_storelocal jobGroupId
     blcli_execute Group getQualifiedGroupName 5005 ${jobGroupId}
     blcli_storeenv jobGroupPath
     if [[ "${hasParent}" = "true" ]]
         then
         echo "--${jobGroupPath},${jobName},${jobTypeId}"
     else
         echo "${jobGroupPath},${jobName},${jobTypeId}"
     fi
     if [[ ${jobTypeId} = 200 ]]
        then
        getBatchJobMembers "${jobGroupPath}/${jobName}" true
     fi
   done <<< "$(awk 'NF' <<< "${memberKeys}")"
}
getBatchJobMembers "${batchJob}" false

That gives me output like:

/Workspace/BatchJobTest,USP-1a,1017

/Workspace/BatchJobTest,TestBatch-2,200

--/Workspace/BatchJobTest,USP-2a,1017

--/Workspace/BatchJobTest,USP-2b,1017

--/Workspace/BatchJobTest,USP-2c,1017

/Workspace/BatchJobTest,USP-1b,1017

/Workspace/BatchJobTest,TestBatch-2,200

--/Workspace/BatchJobTest,USP-2a,1017

--/Workspace/BatchJobTest,USP-2b,1017

--/Workspace/BatchJobTest,USP-2c,1017

/Workspace/BatchJobTest,USP-1c,1017

Of course, once you have the DBKey of the member job you can do whatever you want there, not just list the group path and name. 

 

That's it - we have all the member jobs along with some information about them from the Batch Job.

Share:|

The listallthethings post you've all been waiting for right ?  This is the one I see come up most frequently on communities - I need to list out catalogs and all the stuff in them and do something to those objects or make some groups in the catalog.  The questions come up probably because there is not a released blcli namespace for Patch Smart Groups and no one is sure if a Catalog is a DepotObject or Group or turtle.  I mean it has a Job associated with it and Jobs are normally associated with DepotObjects.  But the Job is not in the Jobs workspace, it's in the catalog itself and a Catalog also has a bunch of DepotObjects and Groups in it.  So I'm going with turtle.

 

But a catalog is really a group.  If you want to be sure look for CATALOG and GROUP in the Object Type Ids list. Like RED_HAT_CATALOG_GROUP.  The requests I've seen are typically something like: find all my catalogs, find all the <os type> catalogs, find and run the CUJ, list the patch smart groups in a catalog, list the conditions of a patch smart group in a catalog, create a patch catalog smart group, list all the patches/errata/bulletins/etc in a catalog, set a property on the objects in the catalog if they meet some condition and delete all the stuff in my catalog.  So let's just dig right in.  Of course we have our trusty Unreleased blcli commands and documentation at the ready.

 

List all the catalogs of a specific OS type and do something to the CUJ

I'll combined these two asks together since it makes sense as you will see.  Since a catalog is a group, it made sense to me to start in the Group namespace.  I can lookup the object type id number or use a blcli command to convert the model type name to the number and then there's a command called Group.findAllByGroupType.  That looks like this:

blcli_execute Utility convertModelType RED_HAT_CATALOG_GROUP
blcli_storeenv groupType
blcli_execute Group findAllBytype ${groupType}

That gets me output like this:

[/Workspace/Patch Catalogs/RedHat Linux Patch Catalog, Id = 2001137;Name = RedHat Linux Patch Catalog;Desc = This is an example Patching Catalog for Redhat Linux Patching., /Workspace/Patch Catalogs/Test1, Id = 2210400;Name = Eagle;Desc = , /Workspace/Patch Catalogs/RedHat 6 and 7 x86_64, Id = 2208200;Name = RedHat 6 and 7 x86_64;Desc = , /Workspace/Patch Catalogs/RedHat 7 Newest, Id = 2208000;Name = RedHat 7 Newest;Desc = ]

That looks promising.  Group.findAllByGroupType says it outputs a list so I can then I could run a Utility.listPrint and then do some text processing on each line.  I'm a big fan of text processing but let's see what else we can do.  I tried to run some of the Group.get* commands on the list and they all threw errors.  Maybe I can iterate through the list like in the other examples.  That doesn't work so well because each item in the list is a different element of the catalog - one is the path, the other is the Id = xxx and so on.  Maybe there's a command in Group that will act on the list.  I'm back to text processing.  That's ok - I can just dump the list and look for the lines that have the Id = or the path.

 

That's not very elegant but it works.  I look around a little more in my Unreleased blcli commands and documentation and I find there's a PatchCatalog namespace.   And some os-specific namespaces like RedhatPatchCatalog are there and I don't see much in there that's useful for now.  PatchCatalog has a set of list*Catalogs commands that look good.  After a listPrint it looks good:

blcli_execute PatchCatalog listRedhatPatchCatalogs
blcli_execute Utility setTargetObject
blcli_execute Utility listPrint

/Workspace/Patch Catalogs/RedHat Linux Patch Catalog

/Workspace/Patch Catalogs/Test1

/Workspace/Patch Catalogs/RedHat 6 and 7 x86_64

/Workspace/Patch Catalogs/RedHat 7 Newest

Now I know the path to the group and the group type.  I can get the DBKey with PatchCatalog.getCatalogDBKeyByFullyQualifiedCatalogName or the id with PatchCatalog.getCatalogIdByFullyQualifiedCatalogName.  I can also get the Catalog Update Job DBKey with the PatchCatalog.getCUJDBKeyByFullyQualifiedCatalogName

blcli_execute Utility convertModelType RED_HAT_CATALOG_GROUP
blcli_storeenv groupType
blcli_execute PatchCatalog listRedhatPatchCatalogs
blcli_execute Utility setTargetObject
blcli_execute Utility listPrint
blcli_storelocal catalogs
while read catalog
     do
     blcli_execute PatchCatalog getCatalogDBKeyByFullyQualifiedCatalogName "${catalog}" ${groupType}
     blcli_storelocal catalogKey
     echo "DBKey: ${catalogKey}"
     blcli_execute PatchCatalog getCUJDBKeyByFullyQualifiedCatalogName REDHAT "${catalog}"
     blcli_storelocal cujKey
     echo "CUJKey: ${cujKey}"
done <<< "$(awk 'NF' <<< "${catalogs}")"

The while handles the spaces in the catalog paths (where a for would not).    There's some other commands that could do the same thing: PatchCatalog.getRedhatCatalogUpdateJobDBKey (and Windows, etc).  Often times that's the case.  Use whatever gets you the output you need.  There's no right answer.  If it works, it works.  Cool, now I can go off and run the CUJs, or update/remove/add a schedule and I have the Catalog key and path if I need that.  For example to feed into isCatalogLastUpdateSuccessful:

blcli_execute Utility convertModelType RED_HAT_CATALOG_GROUP
blcli_storeenv groupType
blcli_execute PatchCatalog listRedhatPatchCatalogs
blcli_execute Utility setTargetObject
blcli_execute Utility listPrint
blcli_storelocal catalogs
while read catalog
     do
     blcli_execute PatchCatalog getCatalogIdByFullyQualifiedCatalogName "${catalog}" ${groupType}
     blcli_storelocal catalogGroupId
     blcli_execute PatchCatalog isCatalogLastUpdateSuccessful ${catalogGroupId}
     blcli_storelocal isCatalogLastUpdateSuccessful
     echo "${catalog}:${isCatalogLastUpdateSuccessful}"
done  <<< "$(awk 'NF' <<< "${catalogs}")"

That's a quick and easy way to populate a dashboard or otherwise get a quick view of your catalog states.  If the run failed you could then get the CUJ Key, and dump the last job run log information and email it off. I know that's jumping from 0 to 60 wrt using the blcli but I learn by example so I'll teach by example.  Suffice to say at some point in my blcli usage I figured out how to do each of those things - find the latest run key, use that to get job run information, send an email - by poking around in the released/unreleased command docs, trying various commands in my test env and seeing what happened.  Here we go:

blcli_execute Utility convertModelType RED_HAT_CATALOG_GROUP
blcli_storeenv groupType
blcli_execute PatchCatalog listRedhatPatchCatalogs
blcli_execute Utility setTargetObject
blcli_execute Utility listPrint
blcli_storelocal catalogs

while read catalog
     do
     blcli_execute PatchCatalog getCatalogIdByFullyQualifiedCatalogName "${catalog}" ${groupType}
     blcli_storelocal catalogGroupId
     blcli_execute PatchCatalog isCatalogLastUpdateSuccessful ${catalogGroupId}
     blcli_storelocal isCatalogLastUpdateSuccessful
     if [[ "${isCatalogLastUpdateSuccessful}" = "true" ]]
        then
        blcli_execute PatchCatalog getCUJDBKeyByFullyQualifiedCatalogName REDHAT "${catalog}"
        blcli_storelocal cujKey
        # false is also returned if there are no runs
        blcli_execute JobRun findRunCountByJobKey ${cujKey}
        blcli_storelocal jobRunCount
        if [[ ${jobRunCount} -gt 0 ]]
                then
                blcli_execute JobRun findLastRunKeyByJobKeyIgnoreVersion ${cujKey}
                blcli_storelocal cujRunKey
                # get the start time of the cuj run and the job name for our log/email
                blcli_execute JobRun findByJobRunKey ${cujRunKey}
                blcli_execute JobRun getStartTime
                blcli_storelocal startTime
                blcli_execute JobRun getJobName
                blcli_storelocal jobName
                blcli_execute JobRun jobRunKeyToJobRunId ${cujRunKey}
                blcli_storelocal cujRunId
                blcli_execute JobRun getLogItemsByJobRunId ${cujRunId}
                blcli_storelocal cujLogItems
                echo "${cujLogItems}" > "/tmp/${catalog##*/}-${cujRunId}.log"
                blcli_execute Email sendMailWithAttachment appserver@example.com user@example.com "Log for failed CUJ: ${jobName} at: ${startTime}" "Please review attached log for errors" "/tmp" "${catalog##*/}-${cujRunId}.log"
        else
                echo "Catalog ${catalog} has had ${jobRunCount} runs..."
        fi
     fi
done  <<< "$(awk 'NF' <<< "${catalogs}")"

 

As a bonus, let's do all of that, but for all the catalog types.  And we'll use an associative array to help loop.  I'm just showing the looping logic and what needs to be parameterized, you can fill in the rest of the script.

typeset -A catalogTypeList
catalogTypeList=(listAixPatchCatalogs AIX_CATALOG_GROUP listDebianPatchCatalogs UBUNTU_CATALOG_GROUP listRedhatPatchCatalogs RED_HAT_CATALOG_GROUP listSolarisPatchCatalogs SOLARIS_CATALOG_GROUP listWindowsPatchCatalogs WINDOWS_CATALOG_GROUP)
for key in ${(k)catalogTypeList}
        do
        cliCall="${key}"
        modelType="${catalogTypeList[${key}]}"
        blcli_execute Utility convertModelType ${modelType}
        blcli_storeenv groupType
        blcli_execute PatchCatalog ${cliCall}
       [ ...... Rest of script above .....]       
 done 

 

 

That was more than I expected to cover.  The reset of the cases will move to subsequent posts.

Share:|

Here's how to remediate Meltdown/Spectre with BSA.

 

(how to do with SecOps Response Service / Threat Director, is here:Remediate Meltdown and Spectre with SecOps Response):

 

First, you'll need a current Windows or Linux Patch Catalog.  For the purposes of this discussion, I'll focus on Windows, but doing this under Linux is just as easy: swap out the catalog type, and the Analysis job is just the same.

 

My catalogs update at least every week, and this week, I've been updating every day, as there have been a number of changes to these patches.  I also get automated notifications from Ivanti/Shavlik to let me know when there are updated patches and vulnerabilities, and I'll sometimes update the catalogs right after I get one of those, in a week when we've got a new high-profile vulnerability.

 

As you can see, we got 9 new MS Bulletins in the last 3 days, and 133 new hotfixes, with updates to many more of each.  Great, we can spot check, but this should cover the latest fixes we've been reading about everywhere.

Now, let's go build a targeted policy, or patch smart group, that will let us focus our efforts on just these fixes.  Regular patching is being executed on a periodic basis, and we're all following best practices there already, right? 

 

Let's find our favorite production Windows Patch Catalog, right click New->Patch Catalog Smart Group

Let's give it a name (I called mine "Meltdown - Spectre Checks", and create it as a filter of Hotfix objects, where CVE_ID "is one of" a list of the three key CVE-IDs: CVE-2017-5751, -5753, and -5715.

 

The "is one of" operator makes it really easy to have a focused list in a single line in a Patch Smart Group.

 

Note that this Patch Smart Group now lists a range of useful patches for addressing this vulnerability:

 

Now we create a Patch Analysis Job like we would for any other task, and go find out what our exposure is:

 

 

Building a Patch Analysis Job (PAJ) is like any other, it needs a name, somewhere to live, and a set of servers to act on:

 

Note that the job automatically includes the Meltdown - Spectre Checks Patch Smart Group, since we created via right-click:

Since we're highly motivated to close these as soon as possible, I'm going to ask BSA to create remediation objects (packages and a job to deploy them) from the start.

Note that I can use any existing Server Groups, including Smart Groups based on CMDB or other server properties, including Environment, Location, related Business Services, etc.  I can also pick individual servers, or populate a group or job based on an external list of hosts, like you might get from an existing change management request.

There are options to notify the relevant team, but I'm going to click "Execute Job Now" so it can get rolling.

 

Once our Patching Analysis completes, it should show whether any hosts are missing the hotfixes:

 

 

Now, it's downloaded and packaged these hotfixes, and is ready to deploy at any time, including after an approved change control!

 

You can then either execute the deployment or schedule, and afterward you can re-run patch analysis, and observe that the patch is now applied, and the vulnerability closed!

 

Check status in the Live Dashboards in real time, and for reporting purposes.

 

Until next time!

Bill Robinson

List All The Components

Posted by Bill Robinson Employee Jan 11, 2018
Share:|

Unlike the other object types we've looked at in listallthethings so far, there does not seem to be a Component.listAllByGroup type of blcli command available.  But the pattern is going to be similar as we've found with the other workspace objects.  With the other object types the listAllByGroup command contained calls to convert a group path to id, use that id with one of the findAll commands in the namespace and then get the name or DBKey of the returned objects.  We look in the Component namespace and see a findAllByComponentGroup which takes the ComponentGroup id.  Let's check the ComponentGroup namespace (or SmartComponentGroup) for the groupNameToId command and we see it's there.  Great.  The namespaces usually contain the basics like getName, getDBKey, getId.  Putting together the series of blcli commands:

 

blcli_execute SmartComponentGroup groupNameToId "/Workspace/All Components"
# or ComponentGroup.groupNameToId
blcli_storelocal componentGroupId
blcli_execute Component findAllByComponentGroup ${componentGroup} false
blcli_execute Component getDBKey
blcli_execute Utility setTargetObject
blcli_execute Utility listPrint
blcli_storelocal componentKeys

 

That was pretty easy.  Components are like Servers in that they don't need to exist in a workspace folder (unlike Jobs, DepotObjects and Templates).  However they are associated with Templates and Servers and sometimes we want to list all the Components associated with a server, regardless of template or list all the components associated with a template.  We might also want to list if the Component is "valid" which means the discovery conditions are met.  A component becomes invalid if the Component was discovered on a server and then later something changed on the server or in the discovery conditions and that component (server) no longer meets the discovery conditions.  For example - you run discovery for one of the out-of-the-box compliance templates, like the DISA STIG, for your Windows 2008 servers.  A number of components are created, one for each of your 2008 servers.  Later, you upgrade a handful of the 2008 servers to 2012.  You re-run discovery for the 2008 Windows STIG template and the components of that template for the now 2012 servers should be flagged as invalid because the discovery condition is that the server is Windows 2008 and now it's Windows 2012.  We will also get the full name, and associated device (normally the component name includes the device).  Also remember that it's possible to have more than one component for a template on a single server - in the event you are using Components to model an application that has multiple instances on a single system, eg the BladeLogic Application Server or an Oracle Database.  The point of the training session here on components is to provide some examples of what information I might want to retrieve about a component in my script.  Let's get into the examples.

 

I'll look in my trust Unreleased blcli commands and documentation  reference in the Component namespace and see if there are some commands that look like they will do what I want.  I'm really just reading the name, looking at the inputs and trying it to see if I get what I want.

 

First I want to pass a server name and get all the components and the associated templates.  I need something in the Server space to convert the name to an id or DBKey - yes that exists.  Now in the Component namespace I need to see if there's something to list the components by server.  I see a couple: findAllLatestByDevice and findAllLatestDBKeysByDevice.  Those look pretty good.  The first one returns the component objects, I'd have to run a Component.getDBKey and then dump the list.  That's not too bad. The second one returns a message Command execution failed. java.lang.IllegalStateException: Must be on app server.  Well I am on an appserver so I'm not sure why that's happening.  Welcome to the unreleased commands.  So I'll use the first one.  I want to get the template; I see a Component.getTemplateKey and I can feed that into some of the commands I used in  List All The Component Templates to get the group path to the template, and I see a Component.getName, and I see Component.isValid.  I'll script all that up:

blcli_execute Server getServerIdByName ${serverName}
blcli_storelocal serverId
blcli_execute Component findAllLatestByDevice ${serverId}
blcli_execute Utility storeTargetObject components
blcli_execute Utility listLength
blcli_storelocal listLength
for i in {0..$((${listLength}-1))}
        do
        blcli_execute Utility setTargetObject components
        blcli_execute Utility listItemSelect ${i}
        blcli_execute Utility setTargetObject
        blcli_execute Component getName
        blcli_storelocal componentName
        blcli_execute Component isValid
        blcli_storelocal isValid
        blcli_execute Component getTemplateKey
        blcli_storelocal templateKey
        blcli_execute Template findByDBKey ${templateKey}
        blcli_execute Template getName
        blcli_storelocal templateName
        blcli_execute Template getGroupId
        blcli_storelocal templateGroupId
        blcli_execute Group getQualifiedGroupName 5008 ${templateGroupId}
        blcli_storeenv templateGroupPath
        echo "${componentName},${isValid},${templateGroupPath}/${templateName}"
done

 

Now for the list of Components and their associated servers for a template.  I see a couple versions of Component.findAllByTemplate - one takes the template key, the other the template id.  Since I already know how to get the template key (Template.getDBKeyByGroupAndName).  Then I'll follow pretty much the same pattern as above with whatever blcli calls I need to get the component and associated server info.

template="/Workspace/MyTemplates/TestTemplate1"
blcli_execute Template getDBKeyByGroupAndName "${template%/*}" "${template##*/}"
blcli_storelocal templateKey
blcli_execute Component findAllByTemplate ${templateKey}
blcli_execute Utility storeTargetObject components
blcli_execute Utility listLength
blcli_storelocal listLength
for i in {0..$((${listLength}-1))}
        do
        blcli_execute Utility setTargetObject components
        blcli_execute Utility listItemSelect ${i}
        blcli_execute Utility setTargetObject
        blcli_execute Component getName
        blcli_storelocal componentName
        blcli_execute Component isValid
        blcli_storelocal isValid
        blcli_execute Component getDeviceId
        blcli_storelocal deviceId
        blcli_execute Server getServerNameById ${deviceId}
        blcli_storelocal serverName
        echo "${componentName},${isValid},${serverName}"
done

 

Since this is starting to get repetitive (which is good that we can follow the same patters between workspaces) I like to throw in something new here and there to keep it interesting.  At the top I have:

template="/Workspace/MyTemplates/TestTemplate1"

blcli_execute Template getDBKeyByGroupAndName "${template%/*}" "${template##*/}"

What's going on with that second line ?  The Template.getDBKeyByGroupAndName command takes the template group and name as inputs.  I have a variable named template and I passed in some gibberish to my blcli command.  If you recall NSH (what BSA uses for its command line shell) is based on ZSH, which is a Unix shell like bash, tcsh, csh, etc.  What's happening here is parameter expansion.   From the article:

${name#pattern}

${name##pattern}

If the pattern matches the beginning of the value of name, then substitute the value of name with the matched portion deleted; otherwise, just substitute the value of name. In the first form, the smallest matching pattern is preferred; in the second form, the largest matching pattern is preferred.

${name%pattern}

${name%%pattern}

If the pattern matches the end of the value of name, then substitute the value of name with the matched portion deleted; otherwise, just substitute the value of name. In the first form, the smallest matching pattern is preferred; in the second form, the largest matching pattern is preferred.

So the first one is matching the /* in the string /Workspace/MyTemplates/TestTemplate1 from the end so just '/TestTemplate1' and removing that substring from the overall string and returns just the folder path (/Workspace/MyTemplates).  The second one is matching */ out of the string from the beginning and because of the ## it's matching everything, so '/Workspace/MyTemplates' and deleting that from the string.  If there was just one # then it would return 'Workspace/MyTemplates/TestTemplate'.  This is the same thing as using the dirname and basename commands from the Unix shell.  The advantage of using the parameter substitution is you don't need to spawn off a child process to use it and it's cool.

 

Hopefully that was a quick and fun diversion into shell scripting since we are seeing a lot of the same kind of command sequences when we are listing out the various objects.

Share:|

Now listallthethings turns to DepotObjects.  If I want to list all the Depot Objects in a group, there's an existing command for that:

blcli_execute DepotObject listAllByGroup "/Workspace/MyDepotObjects"

And that lists all the Depot Objects in the (static) group.  Similar to the List All The Jobs post, we have the same issue with Depot Objects - we need to know the type in order to determine the DBKey, DepotObjectId, etc.

So again we go look at the DepotObject.listAllByGroup in the Unreleased blcli commands and documentation and find:

CommandInputReturn value stored name
DepotGroup.groupNameToId$qualifiedGroupName$groupId
DepotObject.findAllHeadersByGroupNAMED_OBJECT=groupId-
SDepotObjectHeader.getNameno input-
Utility.setTargetObjectno input-
Utility.listPrintno input-

And we look in the SDepotObjectHeader namespace to see what's there.  And we have the same set of examples from our other post:

blcli_execute SmartDepotGroup groupNameToId "/Workspace/All Depot Objects"  
# or DepotGroup.groupNameToId with a Static Depot Group  
blcli_storelocal depotGroupId  
blcli_execute DepotObject findAllHeadersByGroup ${jobGroupId}  
blcli_execute SDepotObjectHeader getDBKey  
blcli_execute Utility setTargetObject  
blcli_execute Utility listPrint  
blcli_storelocal depotObjectKeys  

And as in the Server post we can use SDepotObjectHeader.getDepotObjectId to get the Job Id instead of the DBKey. and then as before we could iterate through the list of Depot Object Keys and do something like update a property value:

while read depotObjectKey  
  do  
  blcli_execute DepotObject setPropertyValue ${jobKey} APPLICATION_NAME Payroll
done <<< "$(awk 'NF' <<< "${depotObjectKeys}")"  

 

 

Or maybe I want to update the description on the object.  Since I can't find a blcli command to do that directly, it looks like I need to use one of the primitives - DepotOjbect.setDescription to do it.  That will involve loading the DepotObject object and then acting on it, and we can still use same list of Depot Object keys we get above:

while read depotObjectKey  
   do  
    blcli_execute DepotObject findByDBKey ${depotObjectKey}  
    blcli_execute Utility storeTargetObject obj  
    blcli_execute DepotObject setDescription "Payroll Application"
    blcli_execute DepotObject update NAMED_OBJECT=obj
done <<< "$(awk 'NF' <<< "${depotObjectKeys}")" 

 

 

Sometimes though I might just want to list out the DepotObject, the group path where it exists, the DepotObject type, etc.  All of that information seems to be available in commands in SDepotObjectHeader.  In that case I want to load the SDepotObjectHeader object and run some commands against it.

 

blcli_execute SmartDepotGroup groupNameToId "/Workspace/All Depot Objects"
# or DepotGroup.groupNameToId with a Static Depot Group  
blcli_storelocal objGroupId  
blcli_execute DepotObject findAllHeadersByGroup ${objGroupId}  
blcli_execute Utility storeTargetObject objHeaders  
blcli_execute Utility listLength  
blcli_storelocal listLength  
for i in {0..$((${listLength}-1))}  
    do  
    blcli_execute Utility setTargetObject objHeaders  
    blcli_execute Utility listItemSelect ${i}  
    blcli_execute Utility setTargetObject  
    blcli_execute SDepotObjectHeader getName  
    blcli_storelocal objName  
    blcli_execute SDepotObjectHeader getObjectTypeId  
    blcli_storelocal objTypeId  
    blcli_execute SDepotObjectHeader getDescription  
    blcli_storelocal objDesc  
    blcli_execute SDepotObjectHeader getGroupId  
    blcli_storelocal objGrpId  
    blcli_execute Group getQualifiedGroupName 5001 ${objGrpId}  
    blcli_storelocal groupPath  
    echo "${groupPath}/${objName},${objDesc},${objTypeId}"  
done 

This will echo out the Depot Folder and Name, the description and the object type id for the Depot Object.

 

This one was not much different than Jobs; a similar set of commands but from a different namespace.  Generally that's the case: the commands are the same across namespaces for the same actions.  Not always as you'll find out but most of the time.  That can make it easy to parameterize your commands to build out script functions like:

getName()
{
   local ns="${1}"
   local dbKey="${2}"
   blcli_execute ${ns} findByDBKey ${dbKey}
   blcli_execute ${ns} getName
   blcli_storeenv objName
   blcli_execute ${ns} getType
   blcli_storeenv objTypeId
}

This is nice because it's a single function instead of maintaining separate functions for each object type.  Even if the command name varies you can always do some conditionals and parameterize the command name based on the namespace.

Filter Blog

By date:
By tag: