Question

SMB/CIFS & SFTP plugin - File filtering

  • 3 November 2023
  • 3 replies
  • 180 views

Badge +1

Hello,

 

I’m using two plugins to monitor file-date : centreon_protocol_cifs.pl & centreon_protocol_sftp.pl

Both have a native option/argument named : “FILE”

I need to be able to exclude certain file by their name and or extensions from my monitoring.

I can’t find help or documentation anywhere on this, how do i use this field ?

 

i found this topic with the same need but no answer from 1y ago : 

 

Thank you for your help and feedback,

Thomas,


3 replies

Userlevel 5
Badge +14

Hello

have you tried using Regular Expression ? most centreon check use them to filter things

 

How to play with Regex - Part I | Community (centreon.com)

How to play with Regex - Part II | Community (centreon.com)

(specifically the 2nd part, “data exclusion”)

that being said, I don’t use this plugin so I don’t know if it will work, sorry.

Badge

Hi,

Same issue, I just want to filter folders or files

We would like to know what the --file mode is for and how it is used or if it is adapted to this need

This mode is developed by the centreon teams for this plugin but there is no relevant documentation explaining how to use it.

Exclusion of a file or folder is a basic requirement

 

Badge +1

Hello @christophe.niel-ACT,

 

Thank you for your help, i did tried the Regex without success in the “FILE” field and after the command via extra option : 

 

After checking the plugin file centreon_protocol_sftp.pl, i notice the following line :

 

=item B<--filter-file>
    Filter files (can be a regexp. Directory in the name). 

 

but i can’t make it work for now, i tried : 

/usr/lib/centreon/plugins//centreon_protocol_sftp.pl --plugin=apps::protocols::sftp::plugin --mode=files-date --hostname='XX.XX.XX.XX'  --ssh-username='User' --ssh-password='pwd'  --file='' --directory='PATH' --warning-mtime-last='' --critical-mtime-last='60' --filter-file='^(?!test$)'

 

I get the following :

Unknown option: filter-file at /usr/lib/centreon/plugins//centreon_protocol_sftp.pl line 1317.

 

From my understanding, i should get all the files older than 60sec in the path i gave except the test one.

Reply