Searching the Help
To search for information in the Help, type a word or phrase in the Search box. When you enter a group of words, OR is inferred. You can use Boolean operators to refine your search.
Results returned are case insensitive. However, results ranking takes case into account and assigns higher scores to case matches. Therefore, a search for "cats" followed by a search for "Cats" would return the same number of Help topics, but the order in which the topics are listed would be different.
Search for | Example | Results |
---|---|---|
A single word | cat
|
Topics that contain the word "cat". You will also find its grammatical variations, such as "cats". |
A phrase. You can specify that the search results contain a specific phrase. |
"cat food" (quotation marks) |
Topics that contain the literal phrase "cat food" and all its grammatical variations. Without the quotation marks, the query is equivalent to specifying an OR operator, which finds topics with one of the individual words instead of the phrase. |
Search for | Operator | Example |
---|---|---|
Two or more words in the same topic |
|
|
Either word in a topic |
|
|
Topics that do not contain a specific word or phrase |
|
|
Topics that contain one string and do not contain another | ^ (caret) |
cat ^ mouse
|
A combination of search types | ( ) parentheses |
|
Search filters and SA CLI methods
Many methods in the SA API accept object references as parameters. To retrieve object references based on search criteria, you invoke methods such as findServerRefs
and findJobRefs
. For example, you can invoke findServerRefs
to search for all servers that have example.com
in the hostname
attribute.
Search syntax
Methods such as findServerRefs
have the following syntax:
findobjectRefs filter=’[object-type:]expression’
The filter
parameter includes an expression, which specifies the search criteria. You enclose an expression in either parentheses or curly brackets. A simple expression has the following syntax:
value-object.attribute operator value
This syntax is simplified. For the full definition, see Filter grammar.
Search examples
Most of the SA object types have associated finder methods. This section shows how to use just a few of them. To see how searches are used with other SA CLI methods, see Sample scripts.
Finding servers
Find servers with host names containing example.com
:
cd /opsw/api/com/opsware/server/ServerService/method
./.findServerRefs:i \
filter=’device:{ ServerVO.hostname CONTAINS example.com }’
Find servers with a use attribute value of either UNKNOWN
or PRODUCTION
:
cd /opsw/api/com/opsware/server/ServerService/method
./.findServerRefs:i \
filter=’{ ServerVO.use IN “UNKNOWN” “PRODUCTION” }’
The following bash
script shows how to search for servers, save their IDs in a temporary file, and then specify each ID as the parameter of another method invocation. This script displays the public groups that each Linux server belongs to.
#!/bin/bash
TMPFILE=/tmp/server-list.txt
rm -f $TMPFILE
cd /opsw/api/com/opsware/server/ServerService/method
./.findServerRefs:i \
filter='{ ServerVO.osVersion CONTAINS Linux }' > $TMPFILE
for ID in `cat "$TMPFILE"`
do
echo Server ID: $ID
./getDeviceGroups self:i=$ID
echo
done
Finding jobs
The examples in this section return the IDs of jobs such as server audits or policy remediations.
Find the jobs that have completed successfully:
cd /opsw/api/com/opsware/job/JobService/method
./.findJobRefs:i filter='job:{ job_status = "SUCCESS" }'
(For a list of allowed values of job_status
, see “Job Approval Integration” in the SA
Find the jobs that have completed successfully or with warning:
cd /opsw/api/com/opsware/job/JobService/method
./.findJobRefs:i \
filter='job:{ job_status IN "SUCCESS" "WARNING" }'
Find the jobs that have been started today:
cd /opsw/api/com/opsware/job/JobService/method
./.findJobRefs:i \
filter='job:{ JobInfoVO.startDate IS_TODAY "" }'
Find all server audit jobs:
cd /opsw/api/com/opsware/job/JobService/method
./findJobRefs \
filter='job:{ JobInfoVO.description = "Server Audit" }'
Find the jobs that have run on the server with the ID 280039
:
cd /opsw/api/com/opsware/job/JobService/method
./.findJobRefs:i filter='job:{ job_device_id = "280039" }'
Find today’s jobs that have failed:
cd /opsw/api/com/opsware/job/JobService/method
./.findJobRefs:i \
filter='job:{ (( JobInfoVO.startDate IS_TODAY "" ) \
& ( job_status = "FAILURE" )) }'
Finding other objects
This section has examples that search for software policies and packages.
Find the software policies created by the SA user jdoe
:
cd /opsw/api/com/opsware/swmgmt/SoftwarePolicyService/method
./.findSoftwarePolicyRefs:i \
filter=’{ SoftwarePolicyVO.createdBy CONTAINS jdoe }’
Find the MSIs with ismtool
for the Windows 2003 platforms:
cd /opsw/api/com/opsware/pkg/UnitService/method
./.findUnitRefs:i \
filter='software_unit:{ ((UnitVO.unitType = "MSI") \
& ( UnitVO.name contains "ismtool" ) \
& ( software_platform_name = "Windows 2003" )) }'
Find the Solaris patches named 117170-01
:
cd /opsw/api/com/opsware/pkg/solaris/SolPatchService/method
./.findSolPatchRefs:i filter='{name = 117170-01}'
Find the folder with the name that includes the string Test
and with a parent folder named My Stuff
.
cd /opsw/api/com/opsware/folder/FolderService/method
./.findFolders:s \
filter='( ( FolderVO.name CONTAINS "Test" ) \
& (folder_parent_name = "My Stuff" ) )'
Searchable attributes and valid operators
Not every attribute of a value object can be specified in a search filter. For example, you can search on ServerVO.use
but not on ServerVO.OsFlavor
.
To find out which attributes are searchable for a given object type, invoke thegetSearchableAttributes
method. The following example lists the attributes ofServerVO
that can be specified in a search expression:
cd /opsw/api/com/opsware/search/SearchService/method
./getSearchableAttributes searchableType=device
The searchableType
parameter indicates the object type. To determine the allowed values for searchableType
, enter the following commands:
cd /opsw/api/com/opsware/search/SearchService/method
./getSearchableTypes
To find out which operators are valid for an attribute, invoke the getSearchableAttributeOperators
method. The following example lists valid operators (such as CONTAINS
and IN
) for the attribute ServerVO.hostname
:
cd /opsw/api/com/opsware/search/SearchService/method
./getSearchableAttributeOperators searchableType=device \
searchableAttribute=ServerVO.hostname
We welcome your comments!
To open the configured email client on this computer, open an email window.
Otherwise, copy the information below to a web mail client, and send this email to hpe_sa_docs@hpe.com.
Help Topic ID:
Product:
Topic Title:
Feedback: