AI-assisted content notice: This documentation was created with support from artificial intelligence and has been reviewed by humans for accuracy.
Drop-in directories¶
Since version 3.8.0, the openITCOCKPIT Monitoring Agent can read its definitions (custom checks, logfiles, certificates, ...) not only from one file, but also from a drop-in directory next to this file.
This is useful to deploy single checks with configuration management tools like Ansible, Puppet or SCCM:
- Each team or role deploys its own file, e.g.
customchecks.d/50-database.ini, without editing a shared file. - A check can be deployed to selected hosts only.
- Checks in a drop-in directory are not overwritten when openITCOCKPIT updates the configuration of the agent. openITCOCKPIT only changes the main files, never the drop-in directories.
Available drop-in directories¶
Next to each definition file, the agent reads all *.ini files of a directory with the same name and the extension .d:
| Drop-in directory | Main file | Definitions |
|---|---|---|
customchecks.d |
customchecks.ini |
Custom checks |
logfiles.d |
logfiles.ini |
Logfiles |
certificates.d |
certificates.ini |
Certificates |
files.d |
files.ini |
Files and directories |
http.d |
http.ini |
HTTP(S) checks |
perfcounters.d |
perfcounters.ini |
Windows performance counters |
redfish.d |
redfish.ini |
Redfish (BMC) |
prometheus_exporters.d |
prometheus_exporters.ini |
Prometheus exporters |
The directories are located in the configuration directory of the agent:
| Operating system | Example |
|---|---|
| Linux, FreeBSD, AIX | /etc/openitcockpit-agent/customchecks.d/ |
| macOS | /Applications/openitcockpit-agent/customchecks.d/ |
| Windows | C:\Program Files\openitcockpit\openitcockpit-agent\customchecks.d\ |
If you changed the path of a definition file in the config.ini, the drop-in directory is next to this file. For example, the drop-in directory of /opt/monitoring/mychecks.ini is /opt/monitoring/mychecks.d/.
Info
The agent does not create the drop-in directories. Create them only if you need them.
How the files are read¶
- The agent reads the main file first and then the files of the drop-in directory in alphabetical order. Use a numeric prefix like
10-,20-, ... to control the order. - Only files with the extension
.iniare read. Files starting with a dot (e.g. swap files of an editor), other files (e.g..bakor.txt) and subdirectories are ignored. - The main file is optional. Custom checks can also be defined in
customchecks.donly. - A file which can not be read is skipped with an error in the log of the agent, the definitions of all other files are still used.
- Like the main files, changes are applied after a restart of the agent.
Sections with the same name¶
Each section is one definition (e.g. one custom check). If a later file contains a section with the same name, it replaces the earlier section completely. The settings of both sections are not merged, so the new section has to contain all settings you need.
This allows you to change or disable a definition of the main file without editing it.
customchecks.ini:
[check_disk]
command = /usr/lib/nagios/plugins/check_disk -w 10% -c 5%
interval = 60
enabled = true
[check_users]
command = /usr/lib/nagios/plugins/check_users -w 5 -c 10
enabled = true
customchecks.d/90-override.ini:
# Other thresholds for check_disk. interval is not set, so the default interval is used.
[check_disk]
command = /usr/lib/nagios/plugins/check_disk -w 20% -c 10%
enabled = true
# Disable check_users on this host
[check_users]
enabled = false
If the agent runs with --verbose, it logs which file replaces a definition of another file.
Example: Deploy a custom check¶
customchecks.d/50-my-app.ini:
[check_my_app]
command = /opt/my-app/bin/check_my_app
interval = 60
timeout = 10
enabled = true
Restart the agent and add the new custom check to the monitoring, as described in Define custom checks.
Security¶
The agent runs custom checks with its own permissions, which are usually root (Linux, macOS, FreeBSD, AIX) or SYSTEM (Windows). Everybody who can write to customchecks.d can run commands with these permissions.
Make sure that only root or the Administrators can write to the drop-in directories. This is the case if you create them in the default configuration directory of the agent.