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 |
|
- Create Jython Code
- Use External Java JAR Files within Jython
- Execution of the Code
- Modifying Out-of-the-Box Scripts
- Structure of the Jython File
- Results Generation by the Jython Script
- The Framework Instance
- Finding the Correct Credentials (for Connection Adapters)
- Handling Exceptions from Java
- Troubleshooting Migration from Jython Version 2.1 to 2.5.3
Finding the Correct Credentials (for Connection Adapters)
An adapter trying to connect to a remote system needs to try all possible credentials. One of the parameters needed when creating a client is the credentials ID. The connection script gains access to possible credential sets and tries them one by one using the Framework.getAvailableProtocols()
method. When one credential set succeeds, the adapter reports a CI connection object on the host of this trigger CI (with the credentials ID that matches the IP) to the
Note Access to sensitive data (passwords, private keys, and so on) is blocked for the following protocol types:
sshprotocol, ntadminprotocol, as400protocol, vmwareprotocol, wmiprotocol, vcloudprotocol, sapjmxprotocol, websphereprotocol, siebelgtwyprotocol, sapprotocol, ldapprotocol, udaprotocol, ntcmdprotocol, snmpprotocol, jbossprotocol, telnetprotocol, powershellprotocol, sqlprotocol, weblogicprotocol
Utilization of these protocol types should be done by using dedicated clients.
The following example shows how to obtain all entries of the SNMP protocol. Note that here the IP is obtained from the Trigger CI data (# Get the Trigger CI data values
).
The connection script requests all possible protocol credentials (# Go over all the protocol credentials
) and tries them in a loop until one succeeds (resultVector
). For details, see the two-phase connect paradigm entry in Separating Adapters.
Example
import logger import netutils import sys import errorcodes import errorobject
# Java imports from java.util import Properties from com.hp.ucmdb.discovery.common import CollectorsConstants from appilog.common.system.types.vectors import ObjectStateHolderVector from com.hp.ucmdb.discovery.library.clients import ClientsConsts from com.hp.ucmdb.discovery.library.scope import DomainScopeManager
TRUE = 1 FALSE = 0
def mainFunction(Framework, isClient, ip_address = None): _vector = ObjectStateHolderVector() errStr = '' ip_domain = Framework.getDestinationAttribute('ip_domain') # Get the Trigger CI data values ip_address = Framework.getDestinationAttribute('ip_address')
if (ip_domain == None): ip_domain = DomainScopeManager.getDomainByIp(ip_address, None)
protocols = netutils.getAvailableProtocols(Framework, ClientsConsts.SNMP_PROTOCOL_NAME, ip_address, ip_domain) if len(protocols) == 0: errStr = 'No credentials defined for the triggered ip' logger.debug(errStr) errObj = errorobject.createError(errorcodes.NO_CREDENTIALS_FOR_TRIGGERED_IP, [ClientsConsts.SNMP_PROTOCOL_NAME], errStr) return (_vector, errObj)
connected = 0 # Go over all the protocol credentials for protocol in protocols: client = None try: try: logger.debug('try to get snmp agent for: %s:%s' % (ip_address, ip_domain)) if (isClient == TRUE): properties = Properties() properties.setProperty(CollectorsConstants.DESTINATION_DATA_IP_ADDRESS, ip_address) properties.setProperty(CollectorsConstants.DESTINATION_DATA_IP_DOMAIN, ip_domain) client = Framework.createClient(protocol, properties) else: properties = Properties() properties.setProperty(CollectorsConstants.DESTINATION_DATA_IP_ADDRESS, ip_address) client = Framework.createClient(protocol, properties) logger.debug('Running test connection queries') testConnection(client) Framework.saveState(protocol) logger.debug('got snmp agent for: %s:%s' % (ip_address, ip_domain)) isMultiOid = client.supportMultiOid() logger.debug('snmp server isMultiOid state=%s' %isMultiOid)
client.close() client = None
except: if client != None: client.close() client = None logger.debugException('Unexpected SNMP_AGENT Exception:') lastExceptionStr = str(sys.exc_info()[1]).strip() finally: if client != None: client.close() client = None
return (_vector, error)
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 ovdoc-asm@hpe.com.
Help Topic ID:
Product:
Topic Title:
Feedback: