Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #137: Develop MySQL Connector #142

Merged
merged 34 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3a0d2db
Issue #137: Create MySQL Connector
SafaeAJ Oct 31, 2024
aac2c9d
Merge remote-tracking branch 'remotes/origin/main' into develop-mysql…
SafaeAJ Nov 4, 2024
71ddf3a
Issue #137: Create MySQL Connector
SafaeAJ Nov 8, 2024
468944a
Issue #137: Create MySQL Connector
SafaeAJ Nov 8, 2024
0a3052e
Issue #137: Create MySQL Connector
SafaeAJ Nov 21, 2024
9000515
Merge remote-tracking branch 'remotes/origin/main' into feature/issue…
SafaeAJ Nov 22, 2024
40792ee
Issue #137: Develop MySQL Connector
SafaeAJ Nov 22, 2024
e9e7a67
Issue #137: Develop MySQL Connector
SafaeAJ Nov 22, 2024
0cc0733
Issue #137: Develop MySQL Connector
SafaeAJ Nov 22, 2024
9f75630
Issue #137: Develop MySQL Connector
SafaeAJ Nov 22, 2024
c7dd14f
Merge remote-tracking branch 'remotes/origin/main' into feature/issue…
SafaeAJ Nov 22, 2024
084a0bc
Issue #137: Develop MySQL Connector
SafaeAJ Nov 25, 2024
b4a4bdd
Issue #137: Develop MySQL Connector
SafaeAJ Nov 25, 2024
b59fc85
Issue #137: Develop MySQL Connector
SafaeAJ Nov 27, 2024
5721a12
Issue #137: Develop MySQL Connector
SafaeAJ Nov 28, 2024
0a0e708
Issue #137: Develop MySQL Connector
SafaeAJ Nov 28, 2024
7c37c3e
Issue #137: Develop MySQL Connector
SafaeAJ Nov 28, 2024
113fb1f
Issue #137: Develop MySQL Connector
SafaeAJ Nov 29, 2024
09a3e90
Issue #137: Develop MySQL Connector
SafaeAJ Nov 29, 2024
51975ce
Merge remote-tracking branch 'remotes/origin/main' into feature/issue…
SafaeAJ Dec 9, 2024
8fe76b3
Issue #137: Develop MySQL Connector
SafaeAJ Jan 7, 2025
2ef4b96
Issue #137: Develop MySQL Connector
SafaeAJ Jan 13, 2025
558edd1
Issue #137: Develop MySQL Connector
SafaeAJ Jan 14, 2025
a96380d
Issue #137: Develop MySQL Connector
SafaeAJ Jan 15, 2025
3683f84
Issue #137: Develop MySQL Connector
SafaeAJ Jan 15, 2025
447d7b7
Issue #137: Develop MySQL Connector
SafaeAJ Jan 15, 2025
2941a67
Issue #137: Develop MySQL Connector
SafaeAJ Jan 15, 2025
6bd0746
Issue #137: Develop MySQL Connector
SafaeAJ Jan 15, 2025
fda4cae
Issue #137: Develop MySQL Connector
SafaeAJ Jan 16, 2025
e7b4c33
Issue #137: Develop MySQL Connector
SafaeAJ Jan 16, 2025
56cad69
Merge remote-tracking branch 'remotes/origin/main' into feature/issue…
SafaeAJ Jan 16, 2025
21cd0f9
Issue #137: Develop MySQL Connector
SafaeAJ Jan 16, 2025
6130055
Issue #137: Develop MySQL Connector
SafaeAJ Jan 17, 2025
a93c338
Merge remote-tracking branch 'remotes/origin/main' into feature/issue…
SafaeAJ Jan 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/main/connector/database/Database/Database.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
metrics:
db.io:
description: The number of bytes sent or received to/from all clients.
type: Counter
unit: By
db.connections:
description: The number of connection attempts (successful or not) to the MySQL server.
SafaeAJ marked this conversation as resolved.
Show resolved Hide resolved
type: Counter
unit: "{connection}"
db.client.connection.count:
description: The number of client connections to the database.
type: UpDownCounter
unit: "{connection}"
db.uptime:
description: The total number of seconds the server has been up.
type: Gauge
unit: "s"
db.queries:
description: The total number of statements executed by the server, including statements within stored programs but excluding `COM_PING` and `COM_STATISTICS` commands.
type: Counter
unit: "{statement}"
359 changes: 359 additions & 0 deletions src/main/connector/database/MySQL/MySQL.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/site/markdown/develop/detection/command-line.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
keywords: develop, connector, criteria
keywords: develop, criteria
description: This page defines the detection’s criteria that are defined in a connector.

## Command Line (Detection)
Expand Down
2 changes: 1 addition & 1 deletion src/site/markdown/develop/detection/engine-requirements.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
keywords: develop, connector, criteria
keywords: develop, criteria
description: This page defines the detection’s criteria that are defined in a connector.

# Product Requirements (Detection)
Expand Down
2 changes: 1 addition & 1 deletion src/site/markdown/develop/detection/http.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
keywords: develop, connector, criteria
keywords: develop, criteria
description: This page defines the detection’s criteria that are defined in a connector.

# HTTP (Detection)
Expand Down
2 changes: 1 addition & 1 deletion src/site/markdown/develop/detection/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
keywords: develop, connector, detection
keywords: develop, detection
description: This page defines the connector’s detection section.

# Detection
Expand Down
2 changes: 1 addition & 1 deletion src/site/markdown/develop/detection/ipmi.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
keywords: develop, connector, criteria
keywords: develop, criteria
description: This page defines the detection’s criteria that are defined in a connector.

## IPMI (Detection)
Expand Down
2 changes: 1 addition & 1 deletion src/site/markdown/develop/detection/process.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
keywords: develop, connector, criteria
keywords: develop, criteria
description: This page defines the detection’s criteria that are defined in a connector.

## Process (Detection)
Expand Down
2 changes: 1 addition & 1 deletion src/site/markdown/develop/detection/resource-type.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
keywords: develop, connector, criteria
keywords: develop, criteria
description: This page defines the detection’s criteria that are defined in a connector.

# Device Type (Detection)
Expand Down
2 changes: 1 addition & 1 deletion src/site/markdown/develop/detection/service.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
keywords: develop, connector, criteria
keywords: develop, criteria
description: This page defines the detection’s criteria that are defined in a connector.

# Service (Detection)
Expand Down
2 changes: 1 addition & 1 deletion src/site/markdown/develop/detection/snmp-get.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
keywords: develop, connector, criteria
keywords: develop, criteria
description: This page defines the detection’s criteria that are defined in a connector.

# SNMP Get (Detection)
Expand Down
2 changes: 1 addition & 1 deletion src/site/markdown/develop/detection/snmp-getnext.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
keywords: develop, connector, criteria
keywords: develop, criteria
description: This page defines the detection’s criteria that are defined in a connector.

# SNMP GetNext (Detection)
Expand Down
38 changes: 38 additions & 0 deletions src/site/markdown/develop/detection/sql.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
keywords: develop, criteria
description: This page defines the detection’s criteria that are defined in a connector.

# SQL (Detection)

The goal of this part is to see how to define SQL criteria.

```yaml
connector:
# ...
detection: # <object>
# ...
criteria: # <object-array>
- type: sql
query: # <string>
expectedResult: # <string>
errorMessage: # <string>
```

## Input Properties

| Input Property | Description |
| -------------- | ----------- |
| `query` | SQL query to be executed |
| `expectedResult` | Regular expression that is expected to match the result of the SQL query |
| `errorMessage` | The message to display if the detection criterion fails |

### Example

```yaml
connector:
detection:
criteria:
- type: sql
query: SELECT @@version_comment REGEXP 'mysql' AS is_mysql;
expectedResult: 1
errorMessage: Not a MySQL Server
```
2 changes: 1 addition & 1 deletion src/site/markdown/develop/detection/wbem.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
keywords: develop, connector, criteria
keywords: develop, criteria
description: This page defines the detection’s criteria that are defined in a connector.

# WBEM (Detection)
Expand Down
2 changes: 1 addition & 1 deletion src/site/markdown/develop/detection/wmi.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
keywords: develop, connector, criteria
keywords: develop, criteria
description: This page defines the detection’s criteria that are defined in a connector.

# WMI (Detection)
Expand Down
25 changes: 25 additions & 0 deletions src/site/markdown/develop/sources/sql.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
keywords: sql, database
description: Use the "SQL" source type to query a relational database with an SQL query in MetricsHub.
# SQL (Source)

```yaml
connector:
# ...
pre: # <object>
<sourceKey>: # <source-object>

monitors:
<monitorType>: # <object>
<job>: # <object>
sources: # <object>
<sourceKey>:
type: sql
query: # <string>
forceSerialization: <boolean>
executeForEachEntryOf: # <object>
source: # <string>
concatMethod: # oneOf [ <enum>, <object> ] | possible values for <enum> : [ list, json_array, json_array_extended ]
concatStart: # <string>
concatEnd: # <string>
computes: <compute-object-array>
```
2 changes: 2 additions & 0 deletions src/site/site.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
<item name="SNMP Get" href="develop/detection/snmp-get.html" />
<item name="WBEM" href="develop/detection/wbem.html" />
<item name="WMI (WQL)" href="develop/detection/wmi.html" />
<item name="SQL" href="develop/detection/sql.html" />
</item>
<item name="Monitors" href="develop/monitors.html" />
<item name="Sources" href="develop/sources/index.html" >
Expand All @@ -107,6 +108,7 @@
<item name="Table Union" href="develop/sources/table-union.html" />
<item name="WBEM" href="develop/sources/wbem.html" />
<item name="WMI" href="develop/sources/wmi.html" />
<item name="SQL" href="develop/sources/sql.html" />
<item name="Static (Constant)" href="develop/sources/static.html" />
<item name="Copy (Duplicate)" href="develop/sources/copy.html" />
<item name="Local SQL" href="develop/sources/local-sql.html" />
Expand Down