UPDATE! The community will be go into read-only on April 19, 8am Pacific in preparation for migration on April 21. Read more.
UPDATE! The community will be go into read-only on April 19, 8am Pacific in preparation for migration on April 21.Read more.
Absent Member.
Absent Member.
2553 views

How to upload policies in OML9.x in command line

Hi,

 

I want to download and upload policies as text files using a command line tool.

It's working pretty nice with a policies, which are new to a target management server.

The problem comes, when I try to upload the policy, which already exists on management server (but it has older version).

So, my questions are:

- How can I uplaod a policy in a text file using a command line, so I would tell management server overwrite an existing policy.

- Is there any way to set a new version number for an uploaded policy?

 

Thanks in advance for you help.

Labels (1)
Tags (2)
0 Likes
4 Replies
Absent Member.
Absent Member.

(From OML9.01_Linux_Concepts PDF)

Policies can have multiple versions on the HPOM 9.0x management
server. For detailed information, see “Policy Versions” on page 258 and
“Policy Groups” on page 264. 

 

The policy version can be replaced according to your preferences by using
the opcpolicy command-line tool. The policy version numbers can also
be changed without the need to modify the policy content.
This is especially useful when aligning the policy versions that are
released together. For usage details, see the opcpolicy (1M) manpage. For
more information about the available APIs, see the HPOM Developer’s
Reference.

0 Likes
Absent Member.
Absent Member.

- How can I uplaod a policy in a text file using a command line, so I would tell management server overwrite an existing policy.

I think if you are upgrading a policy which has the same name of an existing policy, then the old policy will get overwritten.

 

- Is there any way to set a new version number for an uploaded policy?

Changing the Policy Version
All policies have version numbers. To replace a particular policy version,
use the opcpolicy command with the -update parameter as follows:
# opcpolicy -update version=<policy_version>
You can also upload and download specific versions of a policy and
instruct HPOM what to do if a version already exists. For more
information about the opcpolicy command and the -update parameter,
refer to the opcpolicy(1m) reference page.

0 Likes
Absent Member.
Absent Member.

OK, I'm still confused.

-downlaod option doesn't work for me since it's downloading xml files where policy id is changing.

I can't test -get option, since can't find proper syntax. I.e. if I type

opctempl -get "swap_util" monitor /tmp/swap_util.txt

and I get a command syntax output, like I made a mistake typing a command. And if I type

opctempl -get "swap_util" MON /tmp/swap_util.txt

i get an error

opctemplfile-get: not implemented!!!

Error: 'Invalid input parameter'

0 Likes
Absent Member.
Absent Member.

sudo /opt/OV/bin/OpC/utils/opctempl -get <template_name> OPCMSG_TEMPLATE </tmp/template_download>

sudo /opt/OV/bin/OpC/utils/opctempl -get OpsWare_Manual OPCMSG_TEMPLATE /tmp/opsware_template_download

 

opctempl { -get <templ_name> <templ_type> <file> }

<templ_type> ----The type of the template. Possible template types are:

CONSOLE_TEMPLATE

OPCMSG_TEMPLATE

LOGFILE_TEMPLATE

MONITOR_TEMPLATE

SNMP_TEMPLATE

EC_TEMPLATE

SCHEDULE_TEMPLATE

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.