You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Creates a new automated rule definition. Cryostat processes automated rules
1385
+
to start recordings on matching targets as they appear, non-interactively.
1386
+
Newly-POSTed rule definitions will also retroactively apply to already-known
1387
+
targets, if any.
1388
+
1389
+
##### request
1390
+
`POST /api/v2/rules`
1391
+
1392
+
The request may be an HTTP form or a JSON document. In either case, the
1393
+
attributes `"name"`, `"targetAlias"`, and `"eventSpecifier"` must be
1394
+
provided.
1395
+
1396
+
`"name"`: the name of this rule definition. This must be unique. This name
1397
+
will also be used to generate the name of the associated recordings.
1398
+
1399
+
`"targetAlias"`: targets with an exactly matching `alias` will match this
1400
+
rule definition, activating this rule for the target and causing the defined
1401
+
recording to be started on the target.
1402
+
1403
+
`"eventSpecifier"`: a string of the form `template=Foo,type=TYPE`. This
1404
+
defines the event template that will be used for creating new recordings in
1405
+
matching targets.
1406
+
1407
+
The following attributes are optional:
1408
+
1409
+
`"description"`: a textual description of the purpose or reason for this
1410
+
rule definition. This is informational and for display only.
1411
+
1412
+
`"archivalPeriodSeconds"`: a positive integer value that defines how long
1413
+
Cryostat should wait, in seconds, between archiving snapshots of the
1414
+
recording. The default setting is 30.
1415
+
1416
+
`"preservedArchives"`: a positive integer value that defines how many
1417
+
archived copies of the recording should be kept in storage. When the number
1418
+
of archived copies exceeds this number the oldest copies are deleted from
1419
+
storage. The default setting is 1.
1420
+
1421
+
`"maxAgeSeconds"`: a positive integer value that defines the maximum age of
1422
+
data to be retained in the active, in-memory Flight Recording within the
1423
+
Target JVM. This can be used in combination with `"archivalPeriodSeconds"`
1424
+
to minimize or eliminate data overlap between the end of one archived
1425
+
recording and the start of the subsequent archived recording. If not
1426
+
specified, the default setting is equal to `"archivalPeriodSeconds"`.
1427
+
1428
+
`"maxSizeBytes"`: a positive integer value that defines the maximum size, in
1429
+
bytes, of the active in-memory Flight Recording within the Target JVM. If
1430
+
the recording exceeds this memory size then event data will be dropped from
1431
+
the recording. The default setting is unlimited.
1432
+
1433
+
##### response
1434
+
`201` - The result is the name of the created rule. The `LOCATION` header
1435
+
will be set and its value will be the relative path to the created resource.
1436
+
1437
+
`400` - The rule definition could not be processed, either because the
1438
+
provided document was malformed or invalid.
1439
+
1440
+
`401` - User authentication failed. The reason is an error message.
1441
+
There will be an `X-WWW-Authenticate: $SCHEME` header that indicates
1442
+
the authentication scheme that is used.
1443
+
1444
+
`409` - A rule with the same name already exists.
1445
+
1446
+
`415` - The request's `Content-Type` was invalid or unrecognized.
1447
+
1448
+
`500` - There was an unexpected error.
1449
+
1450
+
##### example
1451
+
```
1452
+
$ curl -X POST -F name="Test Rule" -F description="This is a rule for testing" -F targetAlias="io.cryostat.Cryostat" -F eventSpecifier="template=Continuous,type=TARGET" http://0.0.0.0:8181/api/v2/rules
Get a JSON document describing a rule definition with the given name.
1489
+
1490
+
##### request
1491
+
`GET /api/v2/rules/:name`
1492
+
1493
+
##### response
1494
+
`200` - The result is a JSON string representing the rule definition.
1495
+
1496
+
`401` - User authentication failed. The reason is an error message.
1497
+
There will be an `X-WWW-Authenticate: $SCHEME` header that indicates
1498
+
the authentication scheme that is used.
1499
+
1500
+
`404` - No rule with the given name exists.
1501
+
1502
+
`500` - There was an unexpected error.
1503
+
1504
+
##### example
1505
+
```
1506
+
$ curl http://0.0.0.0:8181/api/v2/rules/Test_Rule
1507
+
{"meta":{"type":"application/json","status":"OK"},"data":{"result":{"name":"Test_Rule","description":"This is a rule for testing","targetAlias":"io.cryostat.Cryostat","eventSpecifier":"template=Continuous,type=TARGET","archivalPeriodSeconds":30,"preservedArchives":1,"maxAgeSeconds":30,"maxSizeBytes":-1}}}
1508
+
```
1509
+
1510
+
* #### `RulesGetHandler`
1511
+
1512
+
##### synopsis
1513
+
Get a JSON array representing all rule definitions.
1514
+
1515
+
##### request
1516
+
`GET /api/v2/rules`
1517
+
1518
+
##### response
1519
+
`200` - The result is a JSON array representing all rule definitions.
1520
+
1521
+
`401` - User authentication failed. The reason is an error message.
1522
+
There will be an `X-WWW-Authenticate: $SCHEME` header that indicates
1523
+
the authentication scheme that is used.
1524
+
1525
+
`500` - There was an unexpected error.
1526
+
1527
+
##### example
1528
+
```
1529
+
$ curl http://0.0.0.0:8181/api/v2/rules
1530
+
{"meta":{"type":"application/json","status":"OK"},"data":{"result":[{"name":"Test_Rule","description":"This is a rule for testing","targetAlias":"io.cryostat.Cryostat","eventSpecifier":"template=Continuous,type=TARGET","archivalPeriodSeconds":30,"preservedArchives":1,"maxAgeSeconds":30,"maxSizeBytes":-1}]}}
1531
+
```
1532
+
1533
+
### Stored Target Credentials
1534
+
1535
+
* #### `TargetCredentialsPostHandler`
1536
+
1537
+
##### synopsis
1538
+
Creates stored credentials for a given target. These are used for automated
1539
+
rules processing - if a Target JVM requires JMX authentication, Cryostat
1540
+
will use stored credentials when attempting to open JMX connections to the
1541
+
target. These are retained in Cryostat's memory only and not persisted to
1542
+
disk.
1543
+
1544
+
##### request
1545
+
`POST /api/v2/targets/:targetId/credentials`
1546
+
1547
+
The request should be an HTTP form with the attributes `"username"` and
1548
+
`"password"`. Both are required.
1549
+
1550
+
##### response
1551
+
`200` - The result is null. The request was processed successfully and the
1552
+
credentials were stored, potentially overriding previous credentials for the
1553
+
same target.
1554
+
1555
+
`400` - `"username"` and/or `"password"` were not provided.
1556
+
1557
+
`401` - User authentication failed. The reason is an error message.
1558
+
There will be an `X-WWW-Authenticate: $SCHEME` header that indicates
0 commit comments