diff --git a/README.md b/README.md index f193f55..38a5eef 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,27 @@ -# Nagios-plugins-storage +# Nagios-plugins-s3 -This is Nagios probe to monitor Storage endpoints executing simple file operations via Xrootd or Webdav protocols +This is Nagios probe to monitor S3 Storage endpoints executing simple file operations -It's based on the gfal2 library for the storage operations and the python-nap library for execution and reporting. - -A X509 valid proxy certificate is needed to execute the probe (configured via X509_USER_PROXY variable). +It's based on the boto3 library for the storage operations and the python-nap library for execution and reporting. The probes runs the following passive checks in sequence: -* LsDir: list the folder +* LsBuckets: list the buckets at th eendpoint * Put: put a test file -* Ls: list the file previously copied * Get: copy the file locally and check if content matches * Del: delete the file -the active check VOAll just combines the passive checks outcomes. +the active check 'all' just combines the passive checks outcomes. ## Usage ```shell -usage: storage_probe.py [-h] [--version] [-H HOSTNAME] [-w WARNING] [-c CRITICAL] - [-d] [--print-all] [-p PREFIX] [-s SUFFIX] [-t TIMEOUT] - [-C COMMAND] [--dry-run] [-o OUTPUT] [-E ENDPOINT] [-X X509] - [-to TOKEN] [--se-timeout SE_TIMEOUT] [-S] [-RO] +usage: s3_probe.py [-h] [--version] [-H HOSTNAME] [-w WARNING] [-c CRITICAL] [-d] [--print-all] [-p PREFIX] [-s SUFFIX] [-t TIMEOUT] [-C COMMAND] [--dry-run] [-o OUTPUT] [-E ENDPOINT] [-accesskey S3_ACCESS_KEY] + [-secretkey S3_SECRET_KEY] [-region S3_REGION] [-bucket S3_BUCKET] [--se-timeout SE_TIMEOUT] [-RO] -NAGIOS Storage probe +NAGIOS S3 probe -options: +optional arguments: -h, --help show this help message and exit --version show program's version number and exit -H HOSTNAME, --hostname HOSTNAME @@ -47,44 +42,28 @@ options: Nagios command pipe for submitting passive results --dry-run Dry run, will not execute commands and submit passive results -o OUTPUT, --output OUTPUT - Plugin output format; valid options are nagios, check_mk - or passive (via command pipe); defaults to nagios) + Plugin output format; valid options are nagios, check_mk or passive (via command pipe); defaults to nagios) -E ENDPOINT, --endpoint ENDPOINT base URL to test - -X X509, --x509 X509 location of x509 certificate proxy file - -to TOKEN, --token TOKEN - BEARER TOKEN to be used + -accesskey S3_ACCESS_KEY, --s3-access-key S3_ACCESS_KEY + S3 access key + -secretkey S3_SECRET_KEY, --s3-secret-key S3_SECRET_KEY + S3 secret key + -region S3_REGION, --s3-region S3_REGION + S3 region + -bucket S3_BUCKET, --s3-bucket S3_BUCKET + S3 bucket --se-timeout SE_TIMEOUT storage operations timeout - -S, --skip-ls-dir skip LSDir tests, needed for Object storage backend -RO, --read-only enable read-only tests ``` ## Example ```shell -./plugins/storage_probe.py -E root://eospps.cern.ch:1094/eos/pps/opstest/ftstests/test_andrea -H eospps.cern.ch --dry-run -X /tmp/x509up_u0 -d -Dec 01 18:40:53 DEBUG core[1559]: Call sequence: [(, 'LsDir', True), (, 'Put', True), (, 'Ls', True), (, 'Get', True), (, 'Del', True), (, 'All', False)] -Dec 01 18:40:53 DEBUG core[1559]: Function call: metricLsDir -Dec 01 18:40:53 DEBUG core[1559]: b'OK - Storage Path[root://eospps.cern.ch:1094/eos/pps/opstest/ftstests/test_andrea] Directory successfully listed\\n' -Dec 01 18:40:53 DEBUG core[1559]: [1638384053] PROCESS_SERVICE_CHECK_RESULT;eospps.cern.ch;LsDir;0;OK - Storage Path[root://eospps.cern.ch:1094/eos/pps/opstest/ftstests/test_andrea] Directory successfully listed\n -Dec 01 18:40:53 DEBUG core[1559]: Function call: metricPut -Dec 01 18:40:54 DEBUG core[1559]: b'OK - File was copied to the Storage endpoint: Transfer time: 0:00:00.815718\\n' -Dec 01 18:40:54 DEBUG core[1559]: [1638384054] PROCESS_SERVICE_CHECK_RESULT;eospps.cern.ch;Put;0;OK - File was copied to the Storage endpoint: Transfer time: 0:00:00.815718\n -Dec 01 18:40:54 DEBUG core[1559]: Function call: metricLs -Dec 01 18:40:54 DEBUG core[1559]: b'OK - File successfully listed\\n' -Dec 01 18:40:54 DEBUG core[1559]: [1638384054] PROCESS_SERVICE_CHECK_RESULT;eospps.cern.ch;Ls;0;OK - File successfully listed\n -Dec 01 18:40:54 DEBUG core[1559]: Function call: metricGet -Dec 01 18:40:54 DEBUG core[1559]: b'OK - File was copied from Storage endpoint.: Diff successful. Transfer time: 0:00:00.127798\\n' -Dec 01 18:40:54 DEBUG core[1559]: [1638384054] PROCESS_SERVICE_CHECK_RESULT;eospps.cern.ch;Get;0;OK - File was copied from the Storage endpoint.: Diff successful. Transfer time: 0:00:00.127798\n -Dec 01 18:40:54 DEBUG core[1559]: Function call: metricDel -Dec 01 18:40:54 DEBUG core[1559]: b'OK - File was deleted from the Storage endpoint.\\n' -Dec 01 18:40:54 DEBUG core[1559]: [1638384054] PROCESS_SERVICE_CHECK_RESULT;eospps.cern.ch;Del;0;OK - File was deleted from the Storage endpoint.\n -Dec 01 18:40:54 DEBUG core[1559]: Function call: metricAlll -OK - All fine +/plugins/s3_probe.py -d -E https://S3_endpoint -bucket -accesskey -secretkey -mkdir build -cd build -make rpm -f ../Makefile +#To build +make rpm ``` diff --git a/nagios-plugins-s3.spec b/nagios-plugins-s3.spec index 100ae20..753f240 100644 --- a/nagios-plugins-s3.spec +++ b/nagios-plugins-s3.spec @@ -10,7 +10,7 @@ Release: 1%{?dist} Summary: Nagios probes to be run remotely against s3 endpoints License: MIT Group: Applications/Internet -URL: https://github.com/EGI-Federation/nagios-plugins-storage +URL: https://github.com/EGI-Federation/nagios-plugins-s3 # The source of this package was pulled from upstream's vcs. Use the # following commands to generate the tarball: Source0: %{name}-%{version}.tar.gz diff --git a/plugins/s3_probe.py b/plugins/s3_probe.py index 6e780b0..5097866 100755 --- a/plugins/s3_probe.py +++ b/plugins/s3_probe.py @@ -199,7 +199,6 @@ def metricDel(args, io): "problem invoking delete(): %s:%s" % (str(e), sys.exc_info()[0]), ) - @app.metric(seq=5, metric_name="All", passive=False) def metricAlll(args, io): """Active metric to combine the result from the previous passive ones"""