Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-manzi committed Jun 26, 2024
1 parent 944a01e commit 76bf524
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 44 deletions.
63 changes: 21 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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: [(<function metricLsDir at 0x7f761240bc80>, 'LsDir', True), (<function metricPut at 0x7f761240bd08>, 'Put', True), (<function metricLs at 0x7f761240bd90>, 'Ls', True), (<function metricGet at 0x7f761240be18>, 'Get', True), (<function metricDel at 0x7f761240bea0>, 'Del', True), (<function metricAlll at 0x7f761240bf28>, '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 <bucket> -accesskey <accesskey> -secretkey <secretkey>
mkdir build
cd build
make rpm -f ../Makefile
#To build
make rpm
```
2 changes: 1 addition & 1 deletion nagios-plugins-s3.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion plugins/s3_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down

0 comments on commit 76bf524

Please sign in to comment.