File not found reported by fileinfo on Windows server 2019

CMK version: 2.0.0p17.cfe
**OS version:**Ubuntu 20.4

Error message:
File not found
Output of “cmk --debug -vvn hostname”: (If it is a problem with checks or plugins)

My Ubuntu seems to think that “cmk” stands for cloudmonkey and does not recognize it as call to CheckMK.
The problem is that using both fileinfo as well as mk_filestats, to monitor presence of afile at the path starting with “C:\Program Files…” I get the alarm “File not found”, which is not true.
I am avare of a “bug” in DOS that the “DIR” command needs this path, as well as any other with spaces in it, to be written as C:\Program" "Files… to give the correct response, but I do not know which command Check MK uses to determine size and age of the file.
DIR is quite suitable, but with this flaw.

I have inserted full path in the field “File name”, but have still the “File not found”.

Where/how can I check the command the agent uses to check if the file does exist and how can I correct the syntax if wrong?

To make it clear for myself.
You want to check the size and age of files on a Windows host.
Please show the “fileinfo” part of your “check_mk.user.yml” or “check_mk.bakery.cml”.

You have understood me correctly :slight_smile:
Here it is - all is commented :confused:

fileinfo:
# enabled: yes
# below are possible examples
path:
# - ‘c:\a\a’ # generates missing| string
# - ‘c:\Users\Public*.log’ # real string to process
# - “this\is\not\recommended\” # double quoating uses escape sequen>
# - ‘c:\Users\Public*\Desktop.ini’ works, 8 files to control
# - 'c:\Windows\Resources*
\aero\aero*.’ works too, you will get two >
# - 'c:\dev\shared_public*.
’ # typical test folder, provided during d>
# - ‘’ # empty strings will be ignored
# - ‘–’ # all string without "C:" or “\” at start will be ignored to>

If there is nothing active inside the config then it cannot show anything.
It would be good to see your configuration to say if it should work or not.

Check with ‘‘which cmk’’ what binary is used. It should be in bin below home directory of site user.
E.g. for site master: /omd/sites/master/bin/cmk.

As site user try ~/bin/cmk

regards

Michael

1 Like

That is clear :slight_smile:
What I do not understand is - how than it returns report “File not found”?
I have used “forced” to check size.
Now trying to use regular check - I get error from picture.

Does this say something useful?
Seems to me that CMK does not like the name of the file, as I have netered it:
C:\Program Files\Hewlett-Packard\CSA\jboss-as\standalone\deployments\idm-service.war.deployed

This cannot be used if you don’t define anything on the agent side.

This file definition needs to be inside the YAML config file.

1 Like

Run the agent with option showconfig:

 C:\Program Files (x86)\checkmk\service> .\check_mk_agent.exe showconfig

Paste the output here as code.

On monitoring side do a cmk -d <hostname> and post the section <<>>

regards

Michael

1 Like

I thaught that if I enter it inside WATO, that it places it in any cfg that it needs to be in.
Now have put the path into the cfg file:


And defined non forced monitoring of the file with just the file name, on both fileinfo and mk_filestats :smiley:
The result is that I have NO indication that I am even trying to monitor tis file now :confused:

Maybe am editing wrong cfg?
/opt/omd/versions/2.0.0p17.cfe/share/check_mk/agents/windows/check_mk.user.yml

Thank you for the insight and good will :slight_smile:
I do not know the meaning of “paste as a code”, like this:

# Environment Variables:
# MK_LOCALDIR="C:\ProgramData\checkmk\agent\local"
# MK_STATEDIR="C:\ProgramData\checkmk\agent\state"
# MK_PLUGINSDIR="C:\ProgramData\checkmk\agent\plugins"
# MK_TEMPDIR="C:\ProgramData\checkmk\agent\tmp"
# MK_LOGDIR="C:\ProgramData\checkmk\agent\log"
# MK_CONFDIR="C:\ProgramData\checkmk\agent\config"
# MK_SPOOLDIR="C:\ProgramData\checkmk\agent\spool"
# MK_INSTALLDIR="C:\ProgramData\checkmk\agent\install"
# MK_MSI_PATH="C:\ProgramData\checkmk\agent\update"
# MK_MODULESDIR="C:\ProgramData\checkmk\agent\modules"
# Loaded Config Files:
# system: 'C:\Program Files (x86)\checkmk\service\check_mk.yml'
# bakery: 'C:\ProgramData\checkmk\agent\bakery'
# user  : 'C:\ProgramData\checkmk\agent\check_mk.user.yml'

#
global:
  enabled: true
  only_from: ~
  port: 6556
  ipv6: no
  encrypted: no
  passphrase: secret
  execute: [exe, bat, vbs, cmd, ps1]
  async: yes
  try_kill_plugin_process: safe
  sections:
    - check_mk
    - mrpe
    - skype
    - spool
    - plugins
    - local
    - winperf
    - uptime
    - systemtime
    - df
    - mem
    - services
    - msexch
    - dotnet_clrmemory
    - wmi_webservices
    - wmi_cpuload
    - ps
    - fileinfo
    - logwatch
    - openhardwaremonitor
  disabled_sections: []
  realtime:
    enabled: no
    timeout: 90
    port: 6559
    encrypted: no
    passphrase: this is my password
    run: [mem, df, winperf_processor]
  wmi_timeout: 5
  logging:
    location: ~
    file: ~
    debug: yes
    windbg: yes
    eventlog: yes
  install: true
ps:
  enabled: yes
  use_wmi: yes
  full_path: no
winperf:
  enabled: yes
  exe: agent
  trace: no
  fork: yes
  prefix: winperf
  timeout: 10
  counters:
    - 234: phydisk
    - 510: if
    - 238: processor
fileinfo:
  enabled: yes
  path: []
logwatch:
  enabled: yes
  sendall: no
  vista_api: no
  max_size: 500000
  max_line_length: -1
  max_entries: -1
  timeout: -1
  logfile:
    - Parameters: ignore
    - State: ignore
    - "*": warn nocontext
plugins:
  enabled: yes
  player: ""
  max_wait: 60
  async_start: yes
  folders: [$CUSTOM_PLUGINS_PATH$, $BUILTIN_PLUGINS_PATH$]
  execution:
    - pattern: $CUSTOM_PLUGINS_PATH$\cmk-update-agent.exe
      run: no
    - pattern: $CUSTOM_PLUGINS_PATH$\*.*
      timeout: 60
      run: yes
    - pattern: $BUILTIN_PLUGINS_PATH$\*.*
      timeout: 60
      run: no
    - pattern: "*"
      run: no
local:
  enabled: yes
  player: ""
  max_wait: 60
  async_start: true
  execution:
    - pattern: "*.*"
      timeout: 60
      run: yes
mrpe:
  enabled: yes
  parallel: no
  timeout: 60
  config: ~
modules:
  enabled: yes
  python: auto
  quick_reinstall: no
  table:
    - name: python-3.8
      exts: [.checkmk.py, .py]
      exec: .venv\Scripts\python.exe {}
system:
  enabled: yes
  firewall:
    mode: configure
    port: auto
  cleanup_uninstall: smart
  wait_network: 30
  service:
    restart_on_crash: yes
    error_mode: log
    start_mode: auto

section <<>> is empty

You need to edit the config file on the target machine. Normally you find it here → “C:\ProgramData\checkmk\agent\check_mk.user.yml”.

For the path please don’t write something like this → 'C:\Program" "Files\
It will only work if the path is like this C:\Program Files\.

Your “check_mk_agent.exe showconfig” shows also that no “fileinfo” is configured at the moment

fileinfo:
  enabled: yes
  path: []

In this output you must see your path if configured correctly.
If you edit the YAML file please pay attention to the formatting.

1 Like

This is the fileinfo part in the C:\ProgramData\checkmk\agent\check_mk.user.yml file:


But the output on c:\Program Files (x86)\checkmk\service>.\check_mk_agent.exe showconfig
is still:
image

I have restarted CheckMK service but nothing changed…

If you get the output like this then your YAML file formatting is not correct.
The indentation is very important. It is possible to use a YAML syntax checker on the net or in your editor of choice.
I personally only do a two space indentation in my files.

Your screenshot shows first 5 spaces, then 4 spaces and then 10 spaces.

Example from my test system.

fileinfo:
  path:
    - 'C:\Temp\*.ps1'
1 Like

THANK YOU :smiley:
Needs EXACT position to be noticed.

That error is because you need to escape the backslash:

c:\Program Files\Hewlett-Packard\

The regex engine interprets a \ as an escape character.

regards

Michael

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.