
= DeviceConfigMonitor
:description: Learn about the DeviceConfigMonitor in OpenNMS {page-component-title} that tries to retrieve configuration from network devices and shows retrieval status.

This monitor tries to retrieve configuration from the network device and shows the status of that retrieval (success, failed, and so on).

== Monitor Facts

[cols="1,7"]
|===
| Class Name
| `org.opennms.features.deviceconfig.monitors.DeviceConfigMonitor`
|===

== Configuration and use

.Monitor-specific parameters for the DeviceConfigMonitor
[cols="1,3,1"]
|===

| Parameter
| Description
| Default value

3+| *Required*

| script-file
| Script file to use to retrieve configuration.
Place script files in the `etc/device-config` folder.
Find example script files in `etc/examples/device-config` folder with `.dcb` extension.
Overwrite script file name in metadata as `dcb:script-file`.
Don't include `.dcb` extension when specifying the file name in metadata.
| default.dcb

| username
| Username for SSH login.
Overwrite in metadata as `dcb:username`.
Note that you can use xref:operation:deep-dive/meta-data.adoc#ga-metadata-scv[Secure Credentials Vault (SCV) metadata].
| admin

| password
| Password for SSH login.
Overwrite in metadata as `dcb:password`.
Note that you can use Secure Credentials Vault (SCV) metadata.
| admin

3+| *Optional*

| config-type
| If device has multiple configurations, specify the config-type with each service.
The config-type and service name suffix should match (kebab-case for service name, camelCase for config-type).
Overwrite in metadata as `dcb:config-type`.
| default

| ssh-port
| SSH port for the target device.
Overwrite in meatadata as `dcb:ssh-port`.
| 22

| ssh-timeout
| SSH maximum timeout after which SSH session will be closed.
Overwrite in metadata as `dcb:ssh-timeout`.
| 60000

| schedule
| Schedule to fetch configuration, in the form of cron expression.
  Defaults to never run; overwrite this in metadata with proper cron expression.
  Overwrite in metadata as `dcb:schedule`.
| never

| retention-period
| Maximum retention period after which configs without any updates will be deleted from database.
Overwrite in metadata as `dcb:retention-period`.
Specified in ISO-8601 period format `PnYnMnD` and `PnW`.
Defaults to `P1Y` (1 Year).
Example: `P20Y2M25D` means 20 years, 2 months, and 25 days.
| P1Y

| host-key
| SSH fingerprint of the remote host key.
  If this is specified, the provided fingerprint will be used to verify the host key of the remote host.
  The key must be encoded as `HASH:BASE64`.
  One can use `ssh-keygen -l -f <(ssh-keyscan $TARGET)` to find the fingerprints of a remote system.
  If this is not specified, the host key of the remote host is not checked.
| _unchecked_

| auth-key
| SSH Private key used to authenticate.
  This must be specified in PEM format.
  If unspecified, key authentication is not used.
| _unused_

| shell
| If specified, this command is executed on the remote host instead of a login shell.
| _Default login shell_

|ignore-comments
|Whether to ignore commented lines when checking the configuration for drift versus the previous backup
|false

|===

== Schedule and interval

The service uses an interval of 300 seconds and a cron expression for the schedule.
The monitor checks every 300 seconds (interval) for the next trigger time in the cron schedule.
It retrieves the configuration only when the next trigger time matches the current time (current time must be greater than the trigger time).
For example, if the monitor checks at 11:59 p.m., but the trigger time is 12:00 a.m., the monitor will retrieve the configuration at the next check interval at 12:04 a.m.
