OMi Archives - ISbyR https://isbyr.com/tag/omi/ Infrequent Smarts by Reshetnikov Wed, 23 Feb 2022 01:14:53 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.2 HP BSM Connector fails to load policies list into UI with “Error parsing XML” exception https://isbyr.com/hp-bsm-connector-fails-load-policies-list-ui-error-parsing-xml-exception/ https://isbyr.com/hp-bsm-connector-fails-load-policies-list-ui-error-parsing-xml-exception/#respond Sat, 01 Nov 2014 10:57:48 +0000 http://isbyr.com/?p=105  The issue On a bright sunny day, without any prior warning (as it usually happens in DEV environment) our HP BSM Connector decided that it doesn’t want to show any policies in the UI and instead to present me with “An unexpected error occurred” kind of message: After asking for more details this message box was … Continue reading HP BSM Connector fails to load policies list into UI with “Error parsing XML” exception

The post HP BSM Connector fails to load policies list into UI with “Error parsing XML” exception appeared first on ISbyR.

]]>
 The issue

On a bright sunny day, without any prior warning (as it usually happens in DEV environment) our HP BSM Connector decided that it doesn’t want to show any policies in the UI and instead to present me with “An unexpected error occurred” kind of message:

Unexpected error
BSM Connector Unexpected error.

After asking for more details this message box was kind enough to reveal some more information:

BSM Connector Unexpected error.- with details
BSM Connector Unexpected error.- with details

Here is the exception in a more readable form:

faultCode=Server.Processing
faultString=com.hp.opr.policymanagement.exception.PolicyManagementException : Error parsing XML [JDOMParseException]: Error on line 1: Premature end of file.
faultDetail=null
message=(mx.messaging.messages::ErrorMessage)#0
  body = (null)
  clientId = "5350AC36-3C0F-81F1-8467-BF33183EE63A"
  correlationId = "E601AE91-C1FD-E6E5-4635-39106774BBC1"
  destination = "policyManagementService"
  extendedData = (null)
  faultCode = "Server.Processing"
  faultDetail = (null)
  faultString = "com.hp.opr.policymanagement.exception.PolicyManagementException : Error parsing XML [JDOMParseException]: Error on line 1: Premature end of file."
  headers = (Object)#1
  messageId = "53510DD2-070E-D6D9-870F-3307D13C1DAA"
  rootCause = (Object)#2
    cause = (Object)#3
      cause = (Object)#4
        cause = (null)
        columnNumber = 1
        exception = (null)
        lineNumber = 1
        localizedMessage = "Premature end of file."
        message = "Premature end of file."
        publicId = (null)
        suppressed = (Array)#5
        systemId = (null)
      columnNumber = 1
      lineNumber = 1
      localizedMessage = "Error on line 1: Premature end of file."
      message = "Error on line 1: Premature end of file."
      partialDocument = (null)
      publicId = (null)
      suppressed = (Array)#5
      systemId = (null)
    exceptionCode = "XML_PARSING_ERROR"
    localizedMessage = "Error parsing XML [JDOMParseException]: Error on line 1: Premature end of file."
    message = "Error parsing XML [JDOMParseException]: Error on line 1: Premature end of file."
    suppressed = (Array)#5
  timestamp = 1409706649591
  timeToLive = 0



Cause

When HP BSM Connector policies and XML are mentioned in one sentence the 2 locations that come in mind are

  • %OVDataDir%\datafiles\policies – that’s where all the policies that appear in the HP BSM Connector UI exist
  • %OVDataDir%\datafiles\policymanagement\store – that’s the “main’ store location of the policies.

After having a quick look at the XML files in the first location and not seeing anything interesting I switched  my focus on the second location and here I’ve noticed one “anomaly”. One of the _header.xml files’ size was 0 bytes.

Apparently someone (not excluding myself from the list of suspects) was working on a policy when the machine, BSM Connector is installed on, ran out of space. It is very possible that some warning message was displayed back then or the UI just hang, but since it’s DEV environment no one really cared and just restarted the HP BSM Connector service. The space issue was solved but the _header.xml file, of the policy that has been edited at the time of the crash, became “corrupted”.

Solution

After deleting the .lock and .active files and replacing the _data and _header.xml files of the problematic policy in the %OVDataDir%\datafiles\policymanagement\store with the ones from %OVDataDir%\datafiles\policies , saying a short prayer to the Lords of policies and hitting the refresh button in the HP BSM Connector UI I was pleased to see the UI showing all of my lovely policies and not the annoying error message.


The post HP BSM Connector fails to load policies list into UI with “Error parsing XML” exception appeared first on ISbyR.

]]>
https://isbyr.com/hp-bsm-connector-fails-load-policies-list-ui-error-parsing-xml-exception/feed/ 0
How to backup CA certificates in HP BSM/OMi when you have more than one Data Processing server https://isbyr.com/backup-ca-certificates-hp-bsmomi-two-data-processing-servers/ https://isbyr.com/backup-ca-certificates-hp-bsmomi-two-data-processing-servers/#comments Mon, 25 Aug 2014 10:56:48 +0000 http://isbyr.com/?p=99 For someone who didn’t have to deal with HP Operation Manager Agent’s and Server’s certificates, working with them might be overwhelming initially. As promised in the “How to test pattern matching expressions in HP BSM Connector policies” article I am starting a series of articles for HP BSM people that are new to the HP Operation Manager … Continue reading How to backup CA certificates in HP BSM/OMi when you have more than one Data Processing server

The post How to backup CA certificates in HP BSM/OMi when you have more than one Data Processing server appeared first on ISbyR.

]]>
For someone who didn’t have to deal with HP Operation Manager Agent’s and Server’s certificates, working with them might be overwhelming initially. As promised in the “How to test pattern matching expressions in HP BSM Connector policies” article I am starting a series of articles for HP BSM people that are new to the HP Operation Manager component of the application and this one is one of them.

When you install HP BSM in a multi server deployment the Data Processing (DP) server(s) becomes a Certificate Authority (CA) for the deployment. CA is used to issue certificates for all the other components of the deployment – BSM Gateways and the different data collectors (SiteScope(s), Diagnostics Commander, etc). It’s very important to backup your CA certificate since if for any reason your server is lost and a new CA certificate is created you will lose all the communication between the OMi components and the, sometimes long and painful, process of requesting certificates from the new CA authority will need to be repeated.

The problem

If you have a single DPS environment the ovcm -exportcacert will do the job properly.
The problem raises when you have a primary and a backup DPSes  set-up and the trusted certificates exchange procedure was already completed. If you will try to export the CA certificate at that stage the process will fail due to a CA certificate that was imported from the second DPS. Let’s call it an ‘alien’ certificate for future reference.

ovcm -exportcacert -file c:\temp1\server_ca -pass mypwd
ERROR:   (sec.core-27) No private key for alias
         'CA_0c04c0f2-9b82-7572-06d2-acf72549d6d3_2048' is installed.

So next time you deploy a high availability BSM environment with a primary and a backup DPSes perform the CA certificates backup procedure (separately on each DPS) before you exchange the trusted certificates.
If it’s too late for that – no worries. Here is how you can backup CA certificates in HP BSM/OMi, after the trusted certificates exchange procedure has already been completed.


Step 1 – list the installed certificates

ovcert -list
+---------------------------------------------------------+
| Keystore Content                                        |
+---------------------------------------------------------+
| Certificates:                                           |
|     5f599352-9689-7572-0b5e-887ad1cbc688 (*)            |
+---------------------------------------------------------+
| Trusted Certificates:                                   |
|     CA_0c04c0f2-9b82-7572-06d2-acf72549d6d3_2048        |
|     CA_a641bb72-9de7-7572-1a5a-946e84079aa6_2048        |
+---------------------------------------------------------+
 
+---------------------------------------------------------+
| Keystore Content (OVRG: server)                         |
+---------------------------------------------------------+
| Certificates:                                           |
|     a641bb72-9de7-7572-1a5a-946e84079aa6 (*)            |
+---------------------------------------------------------+
| Trusted Certificates:                                   |
|     CA_0c04c0f2-9b82-7572-06d2-acf72549d6d3_2048        |
|     CA_a641bb72-9de7-7572-1a5a-946e84079aa6_2048 (*)    |
+---------------------------------------------------------+

Note that in the OVRG server Trusted Certificates part you have 2 trusted certificates. The one marked with the (*) is the local CA certificate (which we want to backup). The other one is the alien CA certificate from the second DPS and we need to temporarily get rid of it in order for the ovcm -exportcacert to complete successfully.

Step 2 – export trusted certificates from the ovrg server

ovcert -exporttrusted -file c:\temp\certs\server_trusted -ovrg server
INFO:    Trusted certificates have been successfully exported to file 'c:\temp\certs\server_trusted'.

By running the above command you are backing up the trusted certificates

Step 3 – delete the alien trusted certificate from the OVRG server group

ovcert -remove -f -ovrg server CA_0c04c0f2-9b82-7572-06d2-acf72549d6d3_2048
INFO:    Certificate has been successfully removed.

Remember the “alien” CA certificate from step 2, the one without the (*). We, as promised, are getting rid of it.

 Step 4 – list the installed certificates

ovcert -list
+---------------------------------------------------------+
| Keystore Content                                        |
+---------------------------------------------------------+
| Certificates:                                           |
|     5f599352-9689-7572-0b5e-887ad1cbc688 (*)            |
+---------------------------------------------------------+
| Trusted Certificates:                                   |
|     CA_0c04c0f2-9b82-7572-06d2-acf72549d6d3_2048        |
|     CA_a641bb72-9de7-7572-1a5a-946e84079aa6_2048        |
+---------------------------------------------------------+
 
+---------------------------------------------------------+
| Keystore Content (OVRG: server)                         |
+---------------------------------------------------------+
| Certificates:                                           |
|     a641bb72-9de7-7572-1a5a-946e84079aa6 (*)            |
+---------------------------------------------------------+
| Trusted Certificates:                                   |
|     CA_a641bb72-9de7-7572-1a5a-946e84079aa6_2048 (*)    |
+---------------------------------------------------------+

Here we are just verifying that there are no “alien” CA certificates left


 Step 5 – export the CA certificate

Now we can run the  ovcm -exportcacert  without any problems.

ovcm -exportcacert -file c:\temp\certs\server_ca -pass mypwd
INFO:    CA certificate was successfully exported to file 'c:\temp\certs\server_ca'.

By the way don’t use mypwd as your password when you backup CA certificates in HP BSM/OMi (or any other application), think about something more complicated ;-).

Step 6 – import previously exported trusted certificates

Now let’s import back the trusted certificates from the export that was performed in step 2.

ovcert -importtrusted -ovrg server -file c:\temp\certs\server_trusted
WARNING: Certificate with alias 'CA_a641bb72-9de7-7572-1a5a-946e84079aa6_2048'
         is already installed.
INFO:    Import operation was successful.

You can disregard the WARNING. It appears since the export included the local CA cert and we are trying to import it again.

Step 7 – list the installed certificates

ovcert -list
+---------------------------------------------------------+
| Keystore Content                                        |
+---------------------------------------------------------+
| Certificates:                                           |
|     5f599352-9689-7572-0b5e-887ad1cbc688 (*)            |
+---------------------------------------------------------+
| Trusted Certificates:                                   |
|     CA_0c04c0f2-9b82-7572-06d2-acf72549d6d3_2048        |
|     CA_a641bb72-9de7-7572-1a5a-946e84079aa6_2048        |
+---------------------------------------------------------+
 
+---------------------------------------------------------+
| Keystore Content (OVRG: server)                         |
+---------------------------------------------------------+
| Certificates:                                           |
|     a641bb72-9de7-7572-1a5a-946e84079aa6 (*)            |
+---------------------------------------------------------+
| Trusted Certificates:                                   |
|     CA_0c04c0f2-9b82-7572-06d2-acf72549d6d3_2048        |
|     CA_a641bb72-9de7-7572-1a5a-946e84079aa6_2048 (*)    |
+---------------------------------------------------------+

Verify that you have both of the CA certificates back in the OVRG server section.


Step 8 – celebrate!

Wait,, wait, wait. Before going out to celebrate your achievement repeat the described procedure on the second DPS.

The post How to backup CA certificates in HP BSM/OMi when you have more than one Data Processing server appeared first on ISbyR.

]]>
https://isbyr.com/backup-ca-certificates-hp-bsmomi-two-data-processing-servers/feed/ 2
How to test pattern matching expressions in HP BSM Connector policies https://isbyr.com/test-pattern-matching-expressions-hp-bsm-connector-policies/ https://isbyr.com/test-pattern-matching-expressions-hp-bsm-connector-policies/#comments Thu, 14 Aug 2014 12:26:34 +0000 http://isbyr.com/?p=76 This post is one in a series of articles that are aimed for HP BSM guys (and rarely girls) that are new to the, let’s call it “legacy”, Operations Manager and its agents. One of the new doctrines is the pattern matching syntax that is used in OA policies and which now have become part of … Continue reading How to test pattern matching expressions in HP BSM Connector policies

The post How to test pattern matching expressions in HP BSM Connector policies appeared first on ISbyR.

]]>
This post is one in a series of articles that are aimed for HP BSM guys (and rarely girls) that are new to the, let’s call it “legacy”, Operations Manager and its agents. One of the new doctrines is the pattern matching syntax that is used in OA policies and which now have become part of BSM Connector policies.

Not sure about the reason’s, may be some OM veterans can shred some light on it, but the syntax of regular expressions (or patterns as they are known in the OM world) is very different to Perl style regexes that most of us were used to.
I won’t get into the depth of explanation about the syntax of pattern matching since there are many places you can find that information (offical  documentation and community articles) but rather present to you a command line utility (that comes as part of OA installation) that allows you to test the patterns that you’ve crafted (with sweat and blood I assume) against a test text.

opcpat – pattern matching expressions utility

The utility is located at the %ovinstalldir%\bin\win64\OpC\utils folder on a machine that has OA agent installed, for example BSM Connector.

Note: At the end of this article you will find the full help output of that utility (which you can get by running opcpat with -h option).

There 2 ways of using the pattern matching utility – opcpat:

  • Interactive; You will provide the pattens and the search text using command line prompts.
  • Non-interactive: You specify the location of pattern and search text files.



Interactive use of opcpat

The interactive way of using opcpat could be useful if you want quickly to test your pattern matching expression and don’t want to bother yourself with creating  pattern and values files.

Here is the flow of the pattern test:

  1. Specify the pattern you want to test
  2. Specify the separators
  3. Specify the text to you want to test your pattern against
  4. Verify the results
  5. Either repeat step 3 or hit RETURN to test a new pattern
opcpat
using singlebyte mode

Enter a pattern and the separator characters used for <@>, <S>
pattern (<RETURN> to exit): foo <@.txt> foo
separators:

******** next pattern ********
Pattern: "foo <@.txt> foo" using seps ""
value (<RETURN> for new pattern): foo bar foo
"" txt:"bar" ""

Pattern: "foo <@.txt> foo" using seps ""
value (<RETURN> for new pattern): fff bar fff
Pattern didn't match

Pattern: "foo <@.txt> foo" using seps ""
value (<RETURN> for new pattern):

Enter a pattern and the separator characters used for <@>, <S>
pattern (<RETURN> to exit):

Non-Interactive use of opcpat

I personally find the non-interactive way to be more convenient.

Let’s prepare the input files.

The patterns input file consists of pattern-separator pairs and has the following format:

# commentline (only allowed at the first lines of the file)
# comment ...
pattern1
separators1
pattern2
separators2 ...

In this example I will use a C:\temp\patternfile.txt with the following content:

JOB,NOTOK,<*.jobId>,<@.runDate>,<@.runTime>,<@.runId>,<*.runNode>,<*.errorCode>

JOB,LATE,<*.jobId>,<@.runDate>,<@.runTime>

JOB,OK,<*.jobId>,<@.runDate>,<@.runTime>,<@.runId>,<*.runNode>

Note the empty lines. I am using them to tell the utility to make use of the default separators (a blank and the tab character).




The values files will consists of lines of values we want to test our patterns against and it has the following format:

# commentline(s)
value_a
value_b
value_c

In this example I will use a C:\temp\valuefile.txt with the following content:

JOB,OK,JOB1,140521,080059,30883,D0
JOB,NOTOK,JOB1,140514,182035,01818,,JNRUN
JOB,LATE,JOB1,140520,030002

Now let’s run the utility and examine the output (which can  be seen in the CLI or redirected to a file using the -o option). You will notice that each pattern is matched against each of the lines in the values file. Each pattern – value matching attempt produces 4 lines of output:

  • pattern: the pattern that is currently been tried
  • using seps: which separators are been used in the current attempt ( displayed only if separators were specified for that pattern)
  • value: the value that the match attempt s been run against
  • result: result of the match attempt. Could have either “pattern didn’t match” sentence or the results of the matched pattern and it’s variables (if the pattern had any)
opcpat -fp c:\temp\patternfile.txt -fv c:\temp\valuefile.txt
using singlebyte mode
******** next pattern ********
Pattern: "JOB,NOTOK,<*.jobId>,<@.runDate>,<@.runTime>,<@.runId>,<*.runNode>,<*.errorCode>" using seps ""
Value: "JOB,OK,JOB1,140521,080059,30883,D0"
Pattern didn't match

Pattern: "JOB,NOTOK,<*.jobId>,<@.runDate>,<@.runTime>,<@.runId>,<*.runNode>,<*.errorCode>" using seps ""
Value: "JOB,NOTOK,JOB1,140514,182035,01818,,JNRUN"
"" jobId:"JOB1" runDate:"140514" runTime:"182035" runId:"01818" runNode:"" errorCode:"JNRUN"
Pattern: "JOB,NOTOK,<*.jobId>,<@.runDate>,<@.runTime>,<@.runId>,<*.runNode>,<*.errorCode>" using seps ""
Value: "JOB,LATE,JOB1,140520,030002"
Pattern didn't match

******** next pattern ********
Pattern: "JOB,LATE,<*.jobId>,<@.runDate>,<@.runTime>" using seps ""
Value: "JOB,OK,JOB1,140521,080059,30883,D0"
Pattern didn't match

Pattern: "JOB,LATE,<*.jobId>,<@.runDate>,<@.runTime>" using seps ""
Value: "JOB,NOTOK,JOB1,140514,182035,01818,,JNRUN"
Pattern didn't match

Pattern: "JOB,LATE,<*.jobId>,<@.runDate>,<@.runTime>" using seps ""
Value: "JOB,LATE,JOB1,140520,030002"
"" jobId:"JOB1" runDate:"140520" runTime:"030002" ""

******** next pattern ********
Pattern: "JOB,OK,<*.jobId>,<@.runDate>,<@.runTime>,<@.runId>,<*.runNode>" using seps ""
Value: "JOB,OK,JOB1,140521,080059,30883,D0"
"" jobId:"JOB1" runDate:"140521" runTime:"080059" runId:"30883" runNode:"D0"

Pattern: "JOB,OK,<*.jobId>,<@.runDate>,<@.runTime>,<@.runId>,<*.runNode>" using seps ""
Value: "JOB,NOTOK,JOB1,140514,182035,01818,,JNRUN"
Pattern didn't match

Pattern: "JOB,OK,<*.jobId>,<@.runDate>,<@.runTime>,<@.runId>,<*.runNode>" using seps ""
Value: "JOB,LATE,JOB1,140520,030002"
Pattern didn't match



opcpat -h output

C:\Program Files\HP\HP BTO Software\bin\win64\OpC\utils>opcpat -h
Usage:
opcpat [-h] [-i] [-q] [-fp patternfile] [-fv valuefile] [-o outfile][-l length
-h: display this text
-q: quiet mode
-i: use case insensitive pattern matching
-fp patternfile: input file for patterns and separators (see below)
-fv valuefile: input file for value lines matched against each pattern
-o outfile: use 'outfile' for output
-l length: use 'length' for specifying max line length of input file

'patternfile' consists of pattern-separator pairs. It has the format:
# commentline (only allowed at the first lines of the file)
# comment ...
pattern1
separators1
pattern2
separators2 ...

'valuefile' has the format:
# commentline(s)
value_a
value_b
value_c
value_d

 

The post How to test pattern matching expressions in HP BSM Connector policies appeared first on ISbyR.

]]>
https://isbyr.com/test-pattern-matching-expressions-hp-bsm-connector-policies/feed/ 4