Connectors directory[1]   Full listing of connectors[2]

Linux Files Monitoring

Description

This connector returns information of a specific file on Linux.

community[3] linux[4] system[5]

Source[6]

Target

Typical platform: Linux[7]

Operating system: Linux

Prerequisites

Leverages: Linux commands and SSH

Technology and protocols: Commands

Variables:

  • contentPattern: Regular expression pattern to match file content for monitoring. (Error|Exception|Failure) (default: )
  • matchPath: Regular expression pattern to match file names for monitoring. (/opt/metricshub/logs/*.log,/var/log/*.log) (default: )

Examples

CLI

metricshub HOSTNAME -t linux -c +LinuxFile --ssh -u USER

metricshub.yaml

resourceGroups:
  <RESOURCE_GROUP>:
    resources:
      <HOSTNAME-ID>:
        attributes:
          host.name: <HOSTNAME> # Change with actual host name
          host.type: linux
        connectors: [ +LinuxFile ] # Optional, to load only this connector
        protocols:
          ssh:
            username: <USERNAME> # Change with actual credentials
            password: <PASSWORD> # Encrypted using metricshub-encrypt
        additionalConnectors:
          LinuxFile: # Unique ID. Use 'uses' if different from the original connector ID
            uses: LinuxFile # Optional - Original ID if not in key
            force: true # Optional (default: true); false for auto-detection only
            variables:
              contentPattern: <VALUE> # Replace with desired value.
              matchPath: <VALUE> # Replace with desired value.

Connector Activation Criteria

The Linux Files Monitoring connector must be selected manually, and its status will be reported as OK if all the below criteria are met:

  • The command below succeeds on the monitored host
    • Command: ${file::detection.sh} "${var::matchPath}"
    • Output contains: .+ (regex)

Metrics

Type Collected Metrics Specific Attributes
file
  • system.file.atime
  • system.file.ctime
  • system.file.lines
  • system.file.mtime
  • system.file.size
  • id
  • system.file.name
  • system.file.path
patternMatching
  • system.file.keywords
  • id
  • system.file.keyword
  • system.file.name
  • system.file.path
No results.