How to Manage Devices and Revisions Using the FortiManager CLI

Published on: 12-26-2022 By Vishwajeet Pandey

Introduction

The FortiManager CLI provides a suite of commands that allow administrators to manage devices and their configuration revisions more efficiently. In this post, we will cover how to use various dmserver commands to handle device configurations, including deleting revisions, showing device lists, and fetching device configurations.

dmserver Commands Overview

The dmserver commands in FortiManager are essential for executing device management tasks. Here's a quick overview of the commands you will learn:

  • dmserver clearrev – Clear all revisions for a given device.
  • dmserver delrev – Delete specific configuration revisions for a device.
  • dmserver revlist – Show a list of configuration revisions for a device.
  • dmserver showconfig – Show the current configuration of a managed device.
  • dmserver showdev – Display a list of available devices.
  • dmserver showrev – Display a specific configuration revision for a device.

Using dmserver Commands

dmserver clearrev

The dmserver clearrev command is used to clear all configuration revisions for a specific device. This is useful when you want to reset the revision history for a device.

  • Syntax: execute dmserver clearrev <devname>
  • Variable Description:
    • <devname> – The name of the device.
dmserver delrev

The dmserver delrev command allows you to delete configuration revisions for a device within a specified range. This is particularly useful when you need to remove outdated or unnecessary revisions.

  • Syntax: execute dmserver delrev <device_name> <startrev> <endrev>
  • Variable Description:
    • <device_name> – The name of the device.
    • <startrev> – The starting configuration revision number.
    • <endrev> – The ending configuration revision number.
dmserver revlist

Use the dmserver revlist command to display a list of revisions for a specific device. This helps in identifying the revisions available and choosing the ones to delete or review.

  • Syntax: execute dmserver revlist <device_name>
  • Variable Description:
    • <device_name> – The name of the device.
dmserver showconfig

The dmserver showconfig command fetches and displays the current configuration of a managed device. If the device is not reachable, an error will occur.

  • Syntax: execute dmserver showconfig <device_name>
  • Variable Description:
    • <device_name> – The name of the device.
dmserver showdev

To show a list of available devices, use the dmserver showdev command. This displays details such as device ID, device name, and serial number.

  • Syntax: execute dmserver showdev
dmserver showrev

The dmserver showrev command displays a specific configuration revision for a device. You can also use a negative revision number to display the latest revision.

  • Syntax: execute dmserver showrev <device_name> <revision>
  • Variable Description:
    • <device_name> – The name of the device.
    • <revision> – The configuration revision to display.

Conclusion

Using the FortiManager CLI to manage devices and their configuration revisions can significantly streamline administration tasks. Commands such as dmserver delrev and dmserver clearrev provide powerful tools for managing device configurations efficiently.

For more detailed information on FortiManager CLI commands, refer to the official Fortinet CLI reference.