For information on Device Facts, check out What are Device Facts
Navigate to the Catalog page and select the Custom Facts tab. From here, you can click New to create a new Fact or click Edit to modify existing Facts:
Fill out all the fields in the New Custom Fact window that appears:
Custom facts are made out of the following Components:
- Name - A descriptor for your fact. This will be the name used in the policy, catalog, and Devices Page.
- Return Type - This will be one of four options: string, number, boolean, or list. These types represent how the Addigy agent will collect output from your script and how it will appear in the rest of the system. This will be gone over more in depth in the Scripting Window section below.
- Description - This field should contain a description of the fact. Use the description as a way to communicate with other Addigy users how to understand and leverage your fact.
Consider adding the following information:
- What the different results of the fact mean
- What versions of the OS it has been tested on
- How the result is collected
- If there are any special considerations or dependencies for your fact
- Language of Script - The dropdown menu allows you to select the scripting language you will be using. Currently, Z-Shell, Bash, and Python are supported.The hashbang textbox contains a path to the binary that will run your fact. You can use this textbox to call a different interpreter for your script (a Python3 binary, for example).
We recommend that you stick to the default hashbangs unless you understand how to call other interpreters or shells and know that the path will be available on your machines.
- Scripting Window - Enter the script that will be run to collect your fact. All standard output and standard error from the script will be collected and parsed by the Addigy agent auditor for the specified return type.
For each return type, a specific type of output will be looked for:
- String: Any collection of Unicode characters. Newline characters will be removed from the output for formatting purposes
- Boolean: True or False. Represented by either "true", "True", "TRUE", "False", "false", or "FALSE"
- Number: A single positive or negative integer
- List: a collection of Strings delimited by newline characters. \n
Once you have created the fact, make sure you add it to the policy containing the devices you'd like this information pulled from or else it won't run on devices and return N/A.
- Some Custom Facts may contain sensitive scripts that you don't want to deploy to all the devices you manage. Don't worry. Custom Facts will only be deployed to the policies that you have added them to.
- Once your Custom Fact has been created and deployed, it will be available just like the default facts in the Devices table and when creating alerts.
- Custom facts will report "N/A" until the device has run an audit with the custom fact. The auditor will run every ~5 minutes, however, this can manually be pushed to a device by selecting "Refresh Data" within the device's GoLive page.
For a more detailed look at building Custom Facts, see our article Best Practices and Examples of Custom Facts.