How-to rename fs_ Service to Filesystem

This article describes how to rename the fs_service to filesystem post-2.0 upgrade.

LAST TESTED ON CHECKMK 2.0.0P1

Table of Contents

Problem

If you did the upgrade to Checkmk 2.0 and are using the old Service descriptions, you need to migrate this manually.

Screenshot of service search showing file systems using old service descriptions.


Solution

Before you start, please make a backup of the Round Robin Database (RRD) files!


  1. We need to find all the rrd files with fs_*

    OMD[mysite]:~$ for i in $(find . -type f -name "fs_*"); do  echo $i; done
    ./var/check_mk/rrd/mywindowshost/fs_C__.rrd
    ./var/check_mk/rrd/mywindowshost/fs_C__.info
    ./var/check_mk/rrd/mylinuxhost/fs__boot_efi.info
    ./var/check_mk/rrd/mylinuxhost/fs__media_linuxhost_SDCard.rrd
    ./var/check_mk/rrd/mylinuxhost/fs__boot.info
    ./var/check_mk/rrd/mylinuxhost/fs__media_linuxhost_USB.rrd
    ./var/check_mk/rrd/mylinuxhost/fs__opt_omd_sites_mysite_tmp.rrd
    ./var/check_mk/rrd/mylinuxhost/fs__.rrd
    ./var/check_mk/rrd/mylinuxhost/fs__media_linuxhost_USB.info
    ./var/check_mk/rrd/mylinuxhost/fs__boot.rrd
    ./var/check_mk/rrd/mylinuxhost/fs__media_linuxhost_SDCard.info
    ./var/check_mk/rrd/mylinuxhost/fs__opt_omd_sites_mysite_tmp.info
    ./var/check_mk/rrd/mylinuxhost/fs__.info
    ./var/check_mk/rrd/mylinuxhost/fs__boot_efi.rrd
    ./var/check_mk/rrd/mylinuxhost/fs__boot_efi.info
    ./var/check_mk/rrd/mylinuxhost/fs__media_linuxhost_SDCard.rrd
    ./var/check_mk/rrd/mylinuxhost/fs__boot.info
    ./var/check_mk/rrd/mylinuxhost/fs__media_linuxhost_USB.rrd
    ./var/check_mk/rrd/mylinuxhost/fs__opt_omd_sites_mysite_tmp.rrd
    ./var/check_mk/rrd/mylinuxhost/fs__.rrd
    ./var/check_mk/rrd/mylinuxhost/fs__media_linuxhost_USB.info
    ./var/check_mk/rrd/mylinuxhost/fs__boot.rrd
    ./var/check_mk/rrd/mylinuxhost/fs__media_linuxhost_SDCard.info
    ./var/check_mk/rrd/mylinuxhost/fs__opt_omd_sites_mysite_tmp.info
    ./var/check_mk/rrd/mylinuxhost/fs__.info
    ./var/check_mk/rrd/mylinuxhost/fs__boot_efi.rrd

    .

  2. We need to rename all these files from fs_* to Filesystem_:

    Caution: This is the most dangerous step.

    OMD[mysite]:~$ for i in $(find . -type f -name "fs_*"); do sed -i "s/SERVICE fs_\(.*\)/SERVICE Filesystem \\1/" $i; mv "$i" "$(echo "$i" |sed s/fs_/Filesystem_/)"; done

    .

  3. Let's check if it worked

    OMD[mysite]:~$ for i in $(find . -type f -name "fs_*"); do  echo $i; done
    
    No results for fs_*
    
    OMD[mysite]:~$ for i in $(find . -type f -name "Filesystem_*"); do  echo $i; done
    ./var/check_mk/rrd/mywindowshost/Filesystem_C__.info
    ./var/check_mk/rrd/mywindowshost/Filesystem_C__.rrd
    ./var/check_mk/rrd/mylinuxhost/Filesystem__boot.rrd
    ./var/check_mk/rrd/mylinuxhost/Filesystem__.info
    ./var/check_mk/rrd/mylinuxhost/Filesystem__media_linuxhost_SDCard.rrd
    ./var/check_mk/rrd/mylinuxhost/Filesystem__boot_efi.info
    ./var/check_mk/rrd/mylinuxhost/Filesystem__boot_efi.rrd
    ./var/check_mk/rrd/mylinuxhost/Filesystem__opt_omd_sites_mysite_tmp.info
    ./var/check_mk/rrd/mylinuxhost/Filesystem__opt_omd_sites_mysite_tmp.rrd
    ./var/check_mk/rrd/mylinuxhost/Filesystem__media_linuxhost_USB.rrd
    ./var/check_mk/rrd/mylinuxhost/Filesystem__.rrd
    ./var/check_mk/rrd/mylinuxhost/Filesystem__media_linuxhost_USB.info
    ./var/check_mk/rrd/mylinuxhost/Filesystem__boot.info
    ./var/check_mk/rrd/mylinuxhost/Filesystem__media_linuxhost_SDCard.info
    ./var/check_mk/rrd/mylinuxhost/Filesystem__boot.rrd
    ./var/check_mk/rrd/mylinuxhost/Filesystem__.info
    ./var/check_mk/rrd/mylinuxhost/Filesystem__media_linuxhost_SDCard.rrd
    ./var/check_mk/rrd/mylinuxhost/Filesystem__boot_efi.info
    ./var/check_mk/rrd/mylinuxhost/Filesystem__boot_efi.rrd
    ./var/check_mk/rrd/mylinuxhost/Filesystem__opt_omd_sites_mysite_tmp.info
    ./var/check_mk/rrd/mylinuxhost/Filesystem__opt_omd_sites_mysite_tmp.rrd
    ./var/check_mk/rrd/mylinuxhost/Filesystem__media_linuxhost_USB.rrd
    ./var/check_mk/rrd/mylinuxhost/Filesystem__.rrd
    ./var/check_mk/rrd/mylinuxhost/Filesystem__media_linuxhost_USB.info
    ./var/check_mk/rrd/mylinuxhost/Filesystem__boot.info
    ./var/check_mk/rrd/mylinuxhost/Filesystem__media_linuxhost_SDCard.info
    OMD[mysite]:~$ 

    .

  4. Now we need to change the service description in the global settings:

    Setup → General → Global Settings → Use new service descriptions → Used space in filesystems
    Screenshot of global settings and new service descriptions. Used space in filesystems is highlighted.

    .

  5. Please follow the instructions here
    .
  6. Now you should see the new Services in Checkmk with your old historic data:

    Screenshot of the newly created file system service.