********************
 Grid Storage Probe
********************

The ``check_gridstorage`` probe can check file operations against grid storage
protocols, including SRM, GridFTP, LFC, and other protocols supported by
``arccp`` and ``arcls``.

The main configuration section of this probe is ``gridstorage``, see
:ref:`configuration-files`.  This probe requires an X509 proxy, see
:ref:`x509-proxy`.


Basic Invocation
----------------

To perform read-only checks against a URL pointing to an existing file, use::

    check_gridstorage --url <url>

To perform read-write checks against an URL, use either::

    check_gridstorage --url <url> --enable-write
    check_gridstorage -H <hostname> --dir-url <url> --enable-write

In the latter case, the probe will add a file name based on the host name and
a time stamp.  The ``--dir-url=<url>`` option will not work correctly with the
LFC protocol, since the file name needs to be encoded inside the URL.


Performed Checks
----------------

The probe will do the following checks:

* If writing is enabled, a small is generated at copied to the provided URL.
  The contents of the file includes the time and host name passed to ``-H`` or
  "``localhost``".

* The URL is listed and it's checked that the listing contains the name of the
  uploaded file.

* The file is read back.

* If writing is enabled, the content is compared to what was written.  Since
  the content contains as host name and a time stamp, it's unlikely that an
  old file is accidentally matched.

* If writing is enabled, the file is deleted.

Any failure in the above checks will return CRITICAL to Nagios.


Additional Options
------------------

If you wish to do a more thorough list-test, you can ask the probe to list the
whole directory containing the test file.  This is done by passing
``--list-dir``.  This will use ``--dir-url=<url>`` if specified, otherwise it
will guess the URL of the containing directory by stripping off the last
component of ``--url=<url>``.  In any case, the listed URL must contain the
test-file.  Be aware that if the directory contains many entries, the probe
may time out.

You can disable the read or list tests with ``--disable-read`` and
``--disable-list``.


LFC Invocation
--------------

LFC tests are special in that write operations associate a logical path with a
physical storage.  The probe therefore allows passing an URL to be used only
for the write operation, so the write-enabled test should look something
like ::

    check_gridstorage \
        --enable-write \
        --write-url=lfc://<physical-url>@<lfc-host>/<logical-path> \
        --url=lfc://<lfc-host>/<logical-path> \
        [--list-dir]
