Using Statistics Store Metadata Files

By default, permission to create and modify files in the /usr/lib/sstore/metadata/ directory is restricted to root.

JSON files delivered as part of the Oracle Solaris OS are in /usr/lib/sstore/metadata/json/solaris. Your custom metadata files can go in either the /usr/lib/sstore/metadata/json/site directory or the /usr/lib/sstore/metadata/json/vendor directory.

JSON files in /usr/lib/sstore/metadata/json/ describe classes, resources, and statistics. These statistics are automatically added to the statistics store namespace on system start and any other time the statistics store service restarts.

To add statistics to the statistics store namespace, take the following steps:

  1. Create one or more files in /usr/lib/sstore/metadata/json/. Do not modify files that you did not create.

  2. Run the soljsonfmt tool on the .json file to check for JSON syntactic errors. See the soljsonfmt(1) man page for more information.

  3. Run the soljsonvalidate tool on the .json file to check for JSON semantic errors. The soljsonvalidate tool reports deviation from defined schemas, such as a missing id. See the soljsonvalidate(1) man page for more information.

    All matching .json files are opened and checked for JSON syntax errors. No validation is performed if syntax errors are found.

You can describe each class and statistic in a separate file, or you can describe multiple components in one file by creating a more complex object using JSON array syntax. Resource definitions are part of the class definition. A single statistic definition can be used by multiple classes and resources. For example, many devices might count how many times they are interrupted. The same stat.interrupt statistic could be used with each of the different device resources.

The first character of a class-name must be an alphanumeric character; other characters in a class-name must be alphanumeric characters or the hyphen character (-). For alphabetic characters, best practice is to use lower case characters only. Examples of class-name values include app, cpu, dev, io, link, pg, pset, svc, system, and zone. The //:class.solaris/ and //:class.s/ class names are reserved.

A class and res pair is a canonical resource name. Each name space must be unique on each system. For example, a system cannot have more than one CPU with ID 0. If a given name can be used by multiple resources, then that name is not a suitable namespace identifier.

The / and : characters are allowed in resource names. The following fmri resource uses both / and : in the name. Resource names can contain any characters except the reserved three-character sequence //:. As much as possible, resource names are the same as names used in the related administrative commands.

//:class.svc//:res.fmri/system/identity:node

The metadata for a class defines how resources in that class can be named. Resources can use different naming schemes within a single class, as shown in the following examples from the kstat class:

//:class.kstat//:res.disk/sd/sd0/0
//:class.kstat//:res.device_error/sderr/sd0,err/0
//:class.kstat//:res.misc/pci-ide/fm/0
//:class.kstat//:res.zones/cpu/sys_zone_0/0

You can use metadata to provide a description of each component, provide topology mappings, and provide aliases. See the ssid-metadata(7) man page for more information about statistics store metadata files.

The statistics store reads all the data without regard to how the data is organized into different files. For documentation purposes for other developers and administrators, if you describe multiple components in a single file, all the components described in one file should be related.

Classes can define in metadata other classes in which their resources appear.

The /usr/lib/sstore/metadata/json-schema/ directory contains JSON schema files that describe the format of the metadata files in /usr/lib/sstore/metadata/json/.

The properties sensitive and expensive restrict the use of statistics as described in Restricting Access to Sensitive Data and Restricting Capture of Data that is Expensive to Capture.