github.com/netdata/go.d.plugin@v0.58.1/modules/filecheck/integrations/files_and_directories.md (about)

     1  <!--startmeta
     2  custom_edit_url: "https://github.com/netdata/go.d.plugin/edit/master/modules/filecheck/README.md"
     3  meta_yaml: "https://github.com/netdata/go.d.plugin/edit/master/modules/filecheck/metadata.yaml"
     4  sidebar_label: "Files and directories"
     5  learn_status: "Published"
     6  learn_rel_path: "Data Collection/Linux Systems"
     7  most_popular: False
     8  message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE"
     9  endmeta-->
    10  
    11  # Files and directories
    12  
    13  
    14  <img src="https://netdata.cloud/img/filesystem.svg" width="150"/>
    15  
    16  
    17  Plugin: go.d.plugin
    18  Module: filecheck
    19  
    20  <img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" />
    21  
    22  ## Overview
    23  
    24  This collector monitors files and directories.
    25  
    26  
    27  
    28  
    29  This collector is supported on all platforms.
    30  
    31  This collector supports collecting metrics from multiple instances of this integration, including remote instances.
    32  
    33  `netdata` user needs the following permissions on all the directories in pathname that lead to the file/dir:
    34  
    35  - files monitoring: `execute`.
    36  - directories monitoring: `read` and `execute`.
    37  
    38  If you need to modify the permissions we
    39  suggest [to use file access control lists](https://linux.die.net/man/1/setfacl):
    40  
    41  ```cmd
    42  setfacl -m u:netconfig:rx file ...
    43  ``` 
    44  
    45  > **Warning**: For security reasons, this should not be applied recursively, but only to the exact set of directories
    46  > that lead to the file/dir you want to monitor.
    47  
    48  
    49  ### Default Behavior
    50  
    51  #### Auto-Detection
    52  
    53  This integration doesn't support auto-detection.
    54  
    55  #### Limits
    56  
    57  The default configuration for this integration does not impose any limits on data collection.
    58  
    59  #### Performance Impact
    60  
    61  The default configuration for this integration is not expected to impose a significant performance impact on the system.
    62  
    63  
    64  ## Metrics
    65  
    66  Metrics grouped by *scope*.
    67  
    68  The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels.
    69  
    70  
    71  
    72  ### Per Files and directories instance
    73  
    74  TBD
    75  
    76  This scope has no labels.
    77  
    78  Metrics:
    79  
    80  | Metric | Dimensions | Unit |
    81  |:------|:----------|:----|
    82  | filecheck.file_existence | a dimension per file | boolean |
    83  | filecheck.file_mtime_ago | a dimension per file | seconds |
    84  | filecheck.file_size | a dimension per file | bytes |
    85  | filecheck.dir_existence | a dimension per directory | boolean |
    86  | filecheck.dir_mtime_ago | a dimension per directory | seconds |
    87  | filecheck.dir_num_of_files | a dimension per directory | files |
    88  | filecheck.dir_size | a dimension per directory | bytes |
    89  
    90  
    91  
    92  ## Alerts
    93  
    94  There are no alerts configured by default for this integration.
    95  
    96  
    97  ## Setup
    98  
    99  ### Prerequisites
   100  
   101  No action required.
   102  
   103  ### Configuration
   104  
   105  #### File
   106  
   107  The configuration file name for this integration is `go.d/filecheck.conf`.
   108  
   109  
   110  You can edit the configuration file using the `edit-config` script from the
   111  Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md#the-netdata-config-directory).
   112  
   113  ```bash
   114  cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
   115  sudo ./edit-config go.d/filecheck.conf
   116  ```
   117  #### Options
   118  
   119  The following options can be defined globally: update_every, autodetection_retry.
   120  
   121  
   122  <details><summary>Config options</summary>
   123  
   124  | Name | Description | Default | Required |
   125  |:----|:-----------|:-------|:--------:|
   126  | update_every | Data collection frequency. | 10 | no |
   127  | autodetection_retry | Recheck interval in seconds. Zero means no recheck will be scheduled. | 0 | no |
   128  | files | List of files to monitor. |  | yes |
   129  | dirs | List of directories to monitor. |  | yes |
   130  | discovery_every | Files and directories discovery interval. | 60 | no |
   131  
   132  ##### files
   133  
   134  Files matching the selector will be monitored.
   135  
   136  - Logic: (pattern1 OR pattern2) AND !(pattern3 or pattern4)
   137  - Pattern syntax: [shell file name pattern](https://golang.org/pkg/path/filepath/#Match)
   138  - Syntax:
   139  
   140  ```yaml
   141  files:
   142    includes:
   143      - pattern1
   144      - pattern2
   145    excludes:
   146      - pattern3
   147      - pattern4
   148  ```
   149  
   150  
   151  ##### dirs
   152  
   153  Directories matching the selector will be monitored.
   154  
   155  - Logic: (pattern1 OR pattern2) AND !(pattern3 or pattern4)
   156  - Pattern syntax: [shell file name pattern](https://golang.org/pkg/path/filepath/#Match)
   157  - Syntax:
   158  
   159  ```yaml
   160  dirs:
   161    includes:
   162      - pattern1
   163      - pattern2
   164    excludes:
   165      - pattern3
   166      - pattern4
   167  ```
   168  
   169  
   170  </details>
   171  
   172  #### Examples
   173  
   174  ##### Files
   175  
   176  Files monitoring example configuration.
   177  
   178  <details><summary>Config</summary>
   179  
   180  ```yaml
   181  jobs:
   182    - name: files_example
   183      files:
   184        include:
   185          - '/path/to/file1'
   186          - '/path/to/file2'
   187          - '/path/to/*.log'
   188  
   189  ```
   190  </details>
   191  
   192  ##### Directories
   193  
   194  Directories monitoring example configuration.
   195  
   196  <details><summary>Config</summary>
   197  
   198  ```yaml
   199  jobs:
   200    - name: files_example
   201      dirs:
   202        collect_dir_size: no
   203        include:
   204          - '/path/to/dir1'
   205          - '/path/to/dir2'
   206          - '/path/to/dir3*'
   207  
   208  ```
   209  </details>
   210  
   211  
   212  
   213  ## Troubleshooting
   214  
   215  ### Debug Mode
   216  
   217  To troubleshoot issues with the `filecheck` collector, run the `go.d.plugin` with the debug option enabled. The output
   218  should give you clues as to why the collector isn't working.
   219  
   220  - Navigate to the `plugins.d` directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on
   221    your system, open `netdata.conf` and look for the `plugins` setting under `[directories]`.
   222  
   223    ```bash
   224    cd /usr/libexec/netdata/plugins.d/
   225    ```
   226  
   227  - Switch to the `netdata` user.
   228  
   229    ```bash
   230    sudo -u netdata -s
   231    ```
   232  
   233  - Run the `go.d.plugin` to debug the collector:
   234  
   235    ```bash
   236    ./go.d.plugin -d -m filecheck
   237    ```
   238  
   239