# Monitoring dashboards as a Service (experimental)

!!! warning "Experimental feature"
    This feature is experimental. The syntax and the service may change in the future.

Apart from the [monitoring offers in OpenShift](https://docs.redhat.com/en/documentation/openshift_container_platform/4.21/html-single/monitoring/index),
we also offer active monitoring for services hosted on Datafactory and elsewhere in the TUnet.

You can order and configure your own monitoring dashboard from the OpenShift CLI.

## Ordering a monitoring dashboard

You can order a monitoring dashboard by applying the following YAML in your [project](https://datalab.tuwien.ac.at/de/infrastructure/openshift/creating-a-project/):

```yaml
apiVersion: tuwien.ac.at/v1alpha1
kind: Monitor
metadata:
  name: somename
  namespace: project-yournamespace
spec:
  checks:
    - # Check 1 here:
      name: Name of this check
      group: Optional grouping for this check
      intervalSeconds: 30 # Default: 120, min: 15
      # Other options here

    - # Check 2 here:
      # ...
```

Once created, your dashboard will be available at `https://<NAMESPACE>-<NAME>.monitoring.datalab.unicloud.at`.

## Checks

### ICMP check

An ICMP check fires an ICMPv4 echo request at the targeted hostname or IP address. IPv6 is not supported at this time.

```yaml
spec:
  checks:
    - name: Name of this check
      group: Optional grouping for this check
      intervalSeconds: 30 # Default: 120, min: 15
      icmp:
        host: myserver.tuwien.ac.at
```

### DNS check

The DNS check validates if a specific DNS record can be resolved.

```yaml
spec:
  checks:
    - name: Name of this check
      group: Optional grouping for this check
      intervalSeconds: 30 # Default: 120, min: 15
      dns:
        queryName: tunamea.tuwien.ac.at.
        queryType: A # Optional: A, AAAA, CAA, CNAME, DNAME, MX, PTR, SOA, SRV and TXT
        expectDNSRCode: NOERROR # Optional: NOERROR, FORMERR, SERVFAIL, NXDOMAIN
        expectedResponse: 128.130.4.3
```

### HTTP check

This check sends a HTTP or HTTPS request to a specified endpoint. HTTPS requests must be served with a valid
certificate.

```yaml
spec:
  checks:
    - name: Name of this check
      group: Optional grouping for this check
      intervalSeconds: 30 # Default: 120, min: 15
      http:
        url: https://myserver.tuwien.ac.at
        requestMethod: GET #Optional: GET, POST, PUT, PATCH, DELETE
        requestHeaders: # Optional
          - header: X-My-Header
            content: My Value
        requestBody: | # Optional
          Hello world!
        expectStatus: 200 # Optional
        expectResponseTimeMS: 10000 # Optional
        expectBody: | # Optional
          OK
        expectTLSCertificateExpirationHours: 128 # Optional
```