Agent configuration update script use cases

You can change the agent configuration without making manual or scripted edits to the AgentConfig.xml file by using update scripts.

When you copy an update script to the WinCollect patch directory, the Agent performs the actions that are described in your script.

Update script actions

Update scripts can include the following actions:

<Addto> - Adds a child to the relevant node. You can include a type and certain defined key value pairs.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<WinCollectScript version="10.0">
     <AddTo objPath="LocalSources(Name=Local)" >
        <Source Channel="System" />
    </AddTo> 
</WinCollectScript>
<Update> - Updates the value of a key.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<WinCollectScript version="10.0">
     <Update objPath="LocalSources(Name=Local)/Source(Name=System)" setParam="PollingInterval" value="12000" /> 
</WinCollectScript>
<Delete> - Similar to <Addto>, except you add the name of the object to the object Path.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<WinCollectScript version="10.0">
     <Delete objPath="LocalSources(Name=Local)" /> 
</WinCollectScript>

The agent creates a new configuration in the patch folder and validates the new configuration. When the validation is successful, the old agent configuration is backed up. The agent moves the update script, the old AgentConfig.xml file, and the new AgentConfig.xml file into a backup folder (patch_xxxx) and puts the new agent configuration into operation.

Several sample update scripts are installed with WinCollect 10. They are stored in the \IBM\WinCollect\samples directory.

Examples

Important: These scripts are examples only. All agent configuration service modules are supported so that you can create your own scripts.
Note: Update script file names must begin with update_. All other file names are ignored.
update_addXPath.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<WinCollectScript version="10.0">
    <AddTo objPath="LocalSources(Name=Local)" >
        <Source Name="Security XPath" >
            <Parameter name="Query">
                <QueryList>
                  <Query Id="1" Path="Security">
                    <Select Path="Security">*[System[(Level=1  or Level=2 or Level=3) and (EventID=1 or EventID=3 or  (EventID >= 5 and EventID <= 100)  or  (EventID >= 200 and EventID <= 500) )]]</Select>
                  </Query>
                </QueryList>
            </Parameter>
        </Source>
    </AddTo>
</WinCollectScript>
update_delSecurity.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<WinCollectScript version="10.0">
    <Delete objPath="LocalSources(Name=Local)/Source(Name=Security)" />
</WinCollectScript>
update_updtConsPort.xml
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<WinCollectScript version="10.0">
    <Update objPath="SystemSettings" setParam="Console.Port" value="3333" descr="Changing the Config Console's port to 3333" />
</WinCollectScript>

The following use cases are examples of how you can use update scripts to change agent configurations: