Probe Rules Utility

You can use the Probe Rules Utility command-line tool (nco_rules_util) to help manage probe rules files that are stored in a central repository or file system.

You can configure Probe Rules Utility by using a properties file that is read when the tool is run. Command-line options that are specified at runtime override values in the properties file. Sample properties files (nco_rules_util.props) are provided in the NCHOME/omnibus/etc/ and NCHOME/omnibus/etc/defaults directories.

Note: The Probe Rules Utility runs directly against the repository file system and must have access to the repository file system.

Usage

The tool has the following usage:

nco_rules_util [action] [option] [path]

Where action is one of the available actions and option is one of the options for an action or one of the command-line options. The path parameter is the path to a rules file or directory. Only files with a .rules extension are listed.

The following actions are available:
  • list: Lists the rules files in a specified directory.
  • lstree: Lists the lookups and include files that are referenced by a specified rules file. If you specify a directory, details for all rules files in the directory are listed.

    This action gives you increased visibility into the dependencies in a rules file and is useful for debugging problems.

The following table lists the available options for the list and lstree actions.

Table 1. Probe Rules Utility action options
Option Description
-checksum Displays the SHA1 checksum of each listed rules file.

The -checksum option generates a checksum value for a rules file that can be matched to the RulesChecksum value in the registry.probes table. If a rules file contains includes or lookups, the checksum that is generated is an aggregation of the checksums of all the files that are referenced.

The checksum uniquely identifies the rules file and any referenced include and lookup files. A custom algorithm is used to generate the checksum based on the SHA1 digest of each individual file.

-details Displays the date and time at which a file was last modified and the size of the file in Bytes.
-short Displays rules file details in the following format:
file_name
Checksum            : checksum
Last Modified       : time date
Size                : n Bytes
For example:
syslog.rules
Checksum            : b66759ddc35e4b6503791ba5603548bd38179502
Last Modified       : 8:54:06 AM Oct 15, 2012
Size                : 7,758 Bytes

The -short option reduces the width of the screen output and is suitable for small terminal windows. It works best when displaying details of a small number of files. The lstree action can output a lot of text that might be difficult to read when you use the -short option.

If you do not specify the -details option or the -checksum option, the -short option is ignored.

Note: To display localized output, use the -short option.

The following table lists the available Probe Rules Utility properties and command-line options.

Table 2. Probe Rules Utility properties and command-line options
Property Command-line option Description
N/A -dumpprops Lists all the properties that are configured for the tool, including properties that have default values.
N/A -help Displays help information about the utility.
log.filename -messagelog Specifies the name of the log file. If a log file is not specified, messages are written to standard error (stderr).
log.maxcount N/A Specifies the maximum number of log files that are written.

When this property is enabled, the log file is rotated when it reaches the size specified by the log.maxsize property.

A suffix is appended to the log file. Each new log file is incrementally suffixed when it reaches the maximum size.

For example, if the value of log.maxcount is 2 and the log file name is test.log, the following log files are created:
  • test.log0
  • test.log1

The value of this property is ignored if the log.filename property is not enabled.

The default is '2'.

log.maxsize N/A Specifies the maximum size of the log file in KB.

When the file reaches the maximum size, it is rotated or overwritten.

The value of this property is ignored if the log.filename property is not enabled.

The default is '100' KB.

log.level -messagelevel Specifies one of the following message levels:
  • ERROR
  • WARN
  • INFO
  • DEBUG

DEBUG is the most verbose and outputs all message levels.

The default is 'WARN'.

N/A -propsfile Specifies a properties file.

If you do not specify a properties file, the following default file is used: 'NCHOME/omnibus/etc/nco_rules_util.props'

repository.root N/A Specifies the top level of the rules file repository.

Relative file or directory path references are relative to this value. The repository root must be an absolute path.

If you do not specify a value for this property, it defaults to the value of the NC_RULES_HOME environment variable. If the NC_RULES_HOME environment variable not set, it defaults to the current directory.

targetpath N/A Specifies the path of the file or directory parameter for the list action.

The value of this property is always overridden by the path command-line parameter.

The default is '.'.

N/A -version Displays version information about the tool.