SA CLI Scripting Question - creating a new Audit (110 Views)
Reply
Valued Contributor
RiverRat_1
Posts: 50
Registered: ‎03-30-2010
Message 1 of 5 (110 Views)

SA CLI Scripting Question - creating a new Audit

I'm having an issue getting a simple CLI script to work creating a bogus test Audit. When I run this script I get the following error:

Struct parse error: Attribute name expected

I finally got through the API specification doc to at least understand where the fields are coming from class wise. I can't figure out what the error above means though.

Is there is way of running commands and the output tells where and what you're missing in relation to a VO argument ?

The following is the script:

#!/bin/bash
cd /opsw/api/com/opsware/compliance/sco/AuditTaskService/method

./create vo='{
description="Test Audit - API Created"
name="debug_test_api"
targets="server.onmynetwork.com"
platformPolicyType="UNIX"
policy={
lastSource=
type="UNIX"
scObjectPolicy={
rules={
policyType="POLICY"
description="tmp contents"
displayName="tmp contents"
policyComparisonDefinition={
notModifier=true
argsType="STRING"
values={
value=
source=0
resolvedValue=
}
caseIgnore=false
operator="CONT"
}
disabled=false
remediteArgs=

scriptType="SH"
script="ls /tmp; exit 0"
ignoreNonZeroExitCode=false
}
}
}
}'

exit 0
Please use plain text.
Occasional Contributor
Vidness
Posts: 4
Registered: ‎06-23-2010
Message 2 of 5 (110 Views)

Re: SA CLI Scripting Question - creating a new Audit

Hey RiverRat, did you ever figure this one out? I am trying to do the same thing.
Please use plain text.
Valued Contributor
RiverRat_1
Posts: 50
Registered: ‎03-30-2010
Message 3 of 5 (110 Views)

Re: SA CLI Scripting Question - creating a new Audit

Hey,

No not yet. Apparently the scObjectPolicy object is read-only and you can't update it ... go figure.

I haven't touched this topic in a a bit but an idea I have is looking at how Audit Policies with CMDOUTPUT scripts applied to them could possibly be used here. Maybe defined the Audit Policy via the GUI and then use a script to "link" the Audit Policy into a new Audit.

Or even look at how to create an Audit Policy via the CLI and then link it.

Granted this isn't created an audit from scratch with a rule defined within the audit itself via the CLI but it's better than nothing. I haven't tried this yet but plan to once I get a few things off my plate.

Please use plain text.
Occasional Contributor
Vidness
Posts: 4
Registered: ‎06-23-2010
Message 4 of 5 (110 Views)

Re: SA CLI Scripting Question - creating a new Audit

The thing I *really* want to do is to automatically set rule associations in app configs. Going in manually to assign rules is killing me. I hope to do this either through the create method or the update method, but I am having problems with each.
Please use plain text.
Valued Contributor
RiverRat_1
Posts: 50
Registered: ‎03-30-2010
Message 5 of 5 (110 Views)

Re: SA CLI Scripting Question - creating a new Audit

Yeah, app config rules is another area I share you're pain in and another area I would love to be able to script.
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation