filecheck

package
v0.25.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2020 License: GPL-3.0 Imports: 5 Imported by: 1

README

filecheck

This module monitors files and directories.

File metrics:

  • existence
  • time since the last modification
  • size

Directory metrics:

  • existence
  • time since the last modification
  • number of files

Permissions

netdata user needs the following permissions on all the directories in pathname that lead to the file/dir:

  • files monitoring: execute.
  • directories monitoring: read and execute.

If you need to modify the permissions we suggest to use file access control lists:

setfacl -m u:netdata:rx file ...

⚠ For security reasons, this should not be applied recursively, but only to the exact set of directories that lead to the file/dir you want to monitor.

Charts

Files and directories have their own set of charts.

Files
  • File Existence in boolean
  • File Time Since the Last Modification in seconds
  • File Size in bytes
Directories
  • Dir Existence in boolean
  • Dir Time Since the Last Modification in seconds
  • Dir Number of Files in files

Configuration

Edit the go.d/filecheck.conf configuration file using edit-config from the Agent's config directory, which is typically at /etc/netdata.

cd /etc/netdata # Replace this path with your Netdata config directory
sudo ./edit-config go.d/filecheck.conf

Needs only a path to a file or a directory. The path doesn't support any wildcards.

Here is an example:

jobs:
 - name: files_dirs_example
   files:
     include:
       - '/path/to/file1'
       - '/path/to/file2'
   dirs:
     include:
       - '/path/to/dir1'
       - '/path/to/dir2'

 - name: files_example
   files:
     include:
       - '/path/to/file1'
       - '/path/to/file2'

 - name: dirs_example
   dirs:
     include:
       - '/path/to/dir1'
       - '/path/to/dir2'

For all available options, see the Filecheck collector's configuration file.

Limitations

  • file/dir path pattern doesn't support any wildcards
  • filecheck uses stat call to collect metrics, which is not very efficient.

Troubleshooting

To troubleshoot issues with the Filecheck collector, run the go.d.plugin with the debug option enabled. The output should give you clues as to why the collector isn't working.

First, navigate to your plugins directory, usually at /usr/libexec/netdata/plugins.d/. If that's not the case on your system, open netdata.conf and look for the setting plugins directory. Once you're in the plugin's directory, switch to the netdata user.

cd /usr/libexec/netdata/plugins.d/
sudo -u netdata -s

You can now run the go.d.plugin orchestrator to debug the collector:

./go.d.plugin -d -m filecheck

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Files filesConfig `yaml:"files"`
	Dirs  dirsConfig  `yaml:"dirs"`
}

type Filecheck

type Filecheck struct {
	module.Base
	Config `yaml:",inline"`
	// contains filtered or unexported fields
}

func New

func New() *Filecheck

func (*Filecheck) Charts

func (fc *Filecheck) Charts() *module.Charts

func (*Filecheck) Check

func (fc *Filecheck) Check() bool

func (Filecheck) Cleanup

func (Filecheck) Cleanup()

func (*Filecheck) Collect

func (fc *Filecheck) Collect() map[string]int64

func (*Filecheck) Init

func (fc *Filecheck) Init() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL