Adding Resources Dynamically

If you need to create new resources from within your application, use the sstore_resource_add() interface. See the sstore_resource_add(3SSTORE) man page for details. Typically you should not need to add resources from within your application. Instead, you should define any needed resources as static-instances in the class json file and use your application only to add statistic values.

If your application will use the sstore_resource_add() interface to create resources dynamically, then you do not need to specify static resources in the metadata. You still need to provide resource namespace rules in the class json metadata file.

An example where resources are added dynamically is the cpu class, where the number of CPUs on the system is not known until the system is running.

See Collect Data for Dynamically Allocated Resources for an example of how to add resources dynamically.