-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DOCS] adding analyze service monitor docs
Signed-off-by: Nicolas Takashi <nicolas.tcs@hotmail.com>
- Loading branch information
1 parent
06283f2
commit 41f44cc
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Analyze Command | ||
|
||
The analyze command is used to examine Prometheus Operator objects to ensure they comply with specific rules. It checks whether the objects meet certain predefined conditions. | ||
|
||
```bash mdox-exec="go run main.go analyze --help" mdox-expect-exit-code=0 | ||
Analyzes the given object and runs a set of rules on it to determine if it is compliant with the given rules. | ||
For example: | ||
- Analyze if the service monitor is selecting any service or using the correct service port. | ||
|
||
Usage: | ||
poctl analyze [flags] | ||
|
||
Flags: | ||
-h, --help help for analyze | ||
-k, --kind string The kind of object to analyze. For example, ServiceMonitor | ||
-n, --name string The name of the object to analyze | ||
-s, --namespace string The namespace of the object to analyze | ||
|
||
Global Flags: | ||
--kubeconfig string path to the kubeconfig file, defaults to $KUBECONFIG | ||
--log-format string Log format (default "text") | ||
--log-level string Log level (default "DEBUG") | ||
``` | ||
|
||
## Analyze ServiceMonitor | ||
|
||
The analyze command can specifically target a ServiceMonitor object within a Kubernetes cluster. Users can specify the namespace and name of the ServiceMonitor to assess its compliance with the predefined rules. | ||
|
||
```bash mdox-exec="go run main.go analyze servicemonitor --help" mdox-expect-exit-code=0 | ||
Analyzes the given object and runs a set of rules on it to determine if it is compliant with the given rules. | ||
For example: | ||
- Analyze if the service monitor is selecting any service or using the correct service port. | ||
|
||
Usage: | ||
poctl analyze [flags] | ||
|
||
Flags: | ||
-h, --help help for analyze | ||
-k, --kind string The kind of object to analyze. For example, ServiceMonitor | ||
-n, --name string The name of the object to analyze | ||
-s, --namespace string The namespace of the object to analyze | ||
|
||
Global Flags: | ||
--kubeconfig string path to the kubeconfig file, defaults to $KUBECONFIG | ||
--log-format string Log format (default "text") | ||
--log-level string Log level (default "DEBUG") | ||
``` | ||
|
||
## Rules | ||
|
||
The analyze command evaluates objects against a set of rules to determine compliance. These rules are defined in the `analyzer` package and are specifically implemented in the `internal/analyzer/servicemonitor.go` file. | ||
|
||
|
||
### ServiceMonitor Existence | ||
|
||
The ServiceMonitor object must exist in the Kubernetes cluster. | ||
|
||
### Selector Presence | ||
|
||
The ServiceMonitor object must have a defined selector that selects at least one service. | ||
|
||
### Port Matching | ||
|
||
Each endpoint within the ServiceMonitor object must have a defined port, and this port should match the port of the service it monitors. |