Skip to content

Latest commit

 

History

History
108 lines (93 loc) · 5.85 KB

README.md

File metadata and controls

108 lines (93 loc) · 5.85 KB

Nagios-plugins-SRM

CI

This is Nagios probe to monitor SRM 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.

The probe can query the BDII service in order to build the Storage URL to test given the host-name and the VO name.

A X509 valid proxy certificate is needed to execute the probe (configured via X509_USER_PROXY variable).

The probes runs the following passive checks in sequence:

  • GetSURLs: use the endpoint passed as argument or build the SURL contacting the BDII
  • VOLsDir: list the folder
  • VOPut: put a test file
  • VOLs: list the file previously copied
  • VOGetTurl: get the TURL for the file previously copied
  • VOGet: copy the file locally and check if content matches
  • VODel: delete the file

the active check VOAll just combines the passive checks outcomes.

Usage

usage: srm_probe.py [-h] [--version] [-H HOSTNAME] [-w WARNING] [-c CRITICAL]
                    [-d] [-p PREFIX] [-s SUFFIX] [-t TIMEOUT] [-C COMMAND]
                    [--dry-run] [-o OUTPUT] [-E ENDPOINT] [-X X509]
                    [-VO VONAME] [--srmv SRMV] [--ldap-url LDAP_URL]
                    [--se-timeout SE_TIMEOUT]

NAGIOS SRM probe

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  -H HOSTNAME, --hostname HOSTNAME
                        Host name, IP Address, or unix socket (must be an
                        absolute path)
  -w WARNING, --warning WARNING
                        Offset to result in warning status
  -c CRITICAL, --critical CRITICAL
                        Offset to result in critical status
  -d, --debug           Specify debugging mode
  -p PREFIX, --prefix PREFIX
                        Text to prepend to ever metric name
  -s SUFFIX, --suffix SUFFIX
                        Text to append to every metric name
  -t TIMEOUT, --timeout TIMEOUT
                        Global timeout for plugin execution
  -C COMMAND, --command COMMAND
                        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)
  -E ENDPOINT, --endpoint ENDPOINT
                        SRM base SURL to test
  -X X509, --x509 X509  location of x509 certificate proxy file
  -VO VONAME, --voname VONAME
                        VO name, needed for interaction with BDII
  --srmv SRMV           srm version to use
  --ldap-url LDAP_URL   LDAP URL
  --se-timeout SE_TIMEOUT
                        storage operations timeout

Example

bash-4.2# ./plugins/srm_probe.py -H ccsrm.in2p3.fr --voname dteam  -X /tmp/proxy --dry-run -d
May 14 13:56:02 DEBUG core[1219]: Call sequence: [(<function getSURLs at 0x7f53d106d230>, 'GetSURLs', True), (<function metricVOLsDir at 0x7f53d106d2a8>, 'VOLsDir', True), (<function metricVOPut at 0x7f53d106d320>, 'VOPut', True), (<function metricVOLs at 0x7f53d106d398>, 'VOLs', True), (<function metricVOGetTURLs at 0x7f53d106d410>, 'VOGetTurl', True), (<function metricVOGet at 0x7f53d106d488>, 'VOGet', True), (<function metricVODel at 0x7f53d106d500>, 'VODel', True), (<function metricVOAlll at 0x7f53d106d578>, 'VOAll', False)] 
May 14 13:56:02 DEBUG core[1219]:    Function call: getSURLs
No such object (32)
May 14 13:56:03 DEBUG core[1219]: 'OK - SURLs successfully retrieved\\n'
May 14 13:56:03 DEBUG core[1219]: [1589464563] PROCESS_SERVICE_CHECK_RESULT;ccsrm.in2p3.fr;GetSURLs;0;OK - SURLs successfully retrieved\n
May 14 13:56:03 DEBUG core[1219]:    Function call: metricVOLsDir
May 14 13:56:03 DEBUG core[1219]: 'OK - Storage Path[srm://ccsrm.in2p3.fr:8443/srm/managerv2?SFN=/pnfs/in2p3.fr/data/dteam/] Directory successfully listed\\n'
May 14 13:56:03 DEBUG core[1219]: [1589464563] PROCESS_SERVICE_CHECK_RESULT;ccsrm.in2p3.fr;VOLsDir;0;OK - Storage Path[srm://ccsrm.in2p3.fr:8443/srm/managerv2?SFN=/pnfs/in2p3.fr/data/dteam/] Directory successfully listed\n
May 14 13:56:03 DEBUG core[1219]:    Function call: metricVOPut
May 14 13:56:04 DEBUG core[1219]: 'OK - File was copied to SRM. Transfer time: 0:00:01.456309\\n'
May 14 13:56:04 DEBUG core[1219]: [1589464564] PROCESS_SERVICE_CHECK_RESULT;ccsrm.in2p3.fr;VOPut;0;OK - File was copied to SRM. Transfer time: 0:00:01.456309\n
May 14 13:56:04 DEBUG core[1219]:    Function call: metricVOLs
May 14 13:56:05 DEBUG core[1219]: 'OK - File successfully listed\\n'
May 14 13:56:05 DEBUG core[1219]: [1589464565] PROCESS_SERVICE_CHECK_RESULT;ccsrm.in2p3.fr;VOLs;0;OK - File successfully listed\n
May 14 13:56:05 DEBUG core[1219]:    Function call: metricVOGetTURLs
May 14 13:56:05 DEBUG core[1219]: 'OK - protocol OK-[gsiftp]\\n'
May 14 13:56:05 DEBUG core[1219]: [1589464565] PROCESS_SERVICE_CHECK_RESULT;ccsrm.in2p3.fr;VOGetTurl;0;OK - protocol OK-[gsiftp]\n
May 14 13:56:05 DEBUG core[1219]:    Function call: metricVOGet
May 14 13:56:06 DEBUG core[1219]: 'OK - File was copied from SRM. Diff successful. Transfer time: 0:00:01.443261\\n'
May 14 13:56:06 DEBUG core[1219]: [1589464566] PROCESS_SERVICE_CHECK_RESULT;ccsrm.in2p3.fr;VOGet;0;OK - File was copied from SRM. Diff successful. Transfer time: 0:00:01.443261\n
May 14 13:56:06 DEBUG core[1219]:    Function call: metricVODel
May 14 13:56:06 DEBUG core[1219]: 'OK - File was deleted from SRM.\\n'
May 14 13:56:06 DEBUG core[1219]: [1589464566] PROCESS_SERVICE_CHECK_RESULT;ccsrm.in2p3.fr;VODel;0;OK - File was deleted from SRM.\n
May 14 13:56:06 DEBUG core[1219]:    Function call: metricVOAlll
OK - All fine

rpm build

mkdir build
cd build
make rpm -f ../Makefile