Skip to content

Commit

Permalink
Merge pull request #31 from intergral/rabbitmq-instance-label
Browse files Browse the repository at this point in the history
RabbitMQ instance label
  • Loading branch information
ibalal-intergral authored Feb 12, 2024
2 parents a0a9d1f + 9f184cb commit 3454645
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 26 deletions.
5 changes: 3 additions & 2 deletions linux/observability-agent-autoconf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -670,11 +670,12 @@ if { (ss -ltn | grep -qE :5672) || [ -n "${rabbitmq_scrape_target}" ]; } && [ "$
if ! (ss -ltn | grep -qE :15692); then
echo "RabbitMQ exporter is not enabled, see the Observability Agent docs to learn how to enable it"
fi
instance_label=${rabbitmq_instance_label:=${rabbitmq_scrape_target:="127.0.0.1:15692"}}
if [ -n "${rabbitmq_scrape_target}" ]; then
cat <<EOF >> "$CONFIG"
prometheus.scrape "rabbit" {
targets = [
{"__address__" = "$rabbitmq_scrape_target", "instance" = "one"},
{"__address__" = "$rabbitmq_scrape_target", "instance" = "${instance_label}"},
]
forward_to = [prometheus.remote_write.default.receiver]
Expand All @@ -685,7 +686,7 @@ EOF
cat <<EOF >> "$CONFIG"
prometheus.scrape "rabbit" {
targets = [
{"__address__" = "127.0.0.1:15692", "instance" = "one"},
{"__address__" = "127.0.0.1:15692", "instance" = "${instance_label}"},
]
forward_to = [prometheus.remote_write.default.receiver]
Expand Down
45 changes: 23 additions & 22 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,28 +80,29 @@ To add integrations without being prompted for credentials, there are several en

### Metric Exporters

| Variable | Type | Description |
|--------------------------|----------|-------------------------------------------------------------------|
| `mysql_user` | `string` | User for the local Mysql database |
| `mysql_password` | `string` | Password for the local Mysql database |
| `mysql_disabled` | `bool` | Enables/Disables the Mysql exporter (enabled by default) |
| `mssql_user` | `string` | User for the local Mssql database |
| `mssql_password` | `string` | Password for the local Mssql database |
| `mssql_disabled` | `bool` | Enables/Disables the Mssql exporter (enabled by default) |
| `postgres_user` | `string` | User for the local Postgres database |
| `postgres_password` | `string` | Password for the local Postgres database |
| `postgres_disabled` | `bool` | Enables/Disables the Postgres exporter (enabled by default) |
| `rabbitmq_disabled` | `bool` | Enables/Disables the RabbitMQ exporter (enabled by default) |
| `redis_disabled` | `bool` | Enables/Disables the Redis exporter (enabled by default) |
| `elasticsearch_user` | `string` | User for the Elastic search instance |
| `elasticsearch_password` | `string` | Password for the Elastic search instance |
| `elasticsearch_disabled` | `bool` | Enables/Disables the Elastic search exporter (enabled by default) |
| `mongodb_user` | `string` | User for the local Mongo database |
| `mongodb_password` | `string` | Password for the local Mongo database |
| `mongodb_disabled` | `bool` | Enables/Disables the MongoDB exporter (enabled by default) |
| `oracledb_user` | `string` | User for the local Oracle database |
| `oracledb_password` | `string` | Password for the local Oracle database |
| `oracledb_disabled` | `bool` | Enables/Disables the OracleDB exporter (enabled by default) |
| Variable | Type | Description |
|---------------------------|----------|-------------------------------------------------------------------|
| `mysql_user` | `string` | User for the local Mysql database |
| `mysql_password` | `string` | Password for the local Mysql database |
| `mysql_disabled` | `bool` | Enables/Disables the Mysql exporter (enabled by default) |
| `mssql_user` | `string` | User for the local Mssql database |
| `mssql_password` | `string` | Password for the local Mssql database |
| `mssql_disabled` | `bool` | Enables/Disables the Mssql exporter (enabled by default) |
| `postgres_user` | `string` | User for the local Postgres database |
| `postgres_password` | `string` | Password for the local Postgres database |
| `postgres_disabled` | `bool` | Enables/Disables the Postgres exporter (enabled by default) |
| `rabbitmq_disabled` | `bool` | Enables/Disables the RabbitMQ exporter (enabled by default) |
| `rabbitmq_instance_label` | `string` | Optional variable to set the RabbitMQ instance identifier |
| `redis_disabled` | `bool` | Enables/Disables the Redis exporter (enabled by default) |
| `elasticsearch_user` | `string` | User for the Elastic search instance |
| `elasticsearch_password` | `string` | Password for the Elastic search instance |
| `elasticsearch_disabled` | `bool` | Enables/Disables the Elastic search exporter (enabled by default) |
| `mongodb_user` | `string` | User for the local Mongo database |
| `mongodb_password` | `string` | Password for the local Mongo database |
| `mongodb_disabled` | `bool` | Enables/Disables the MongoDB exporter (enabled by default) |
| `oracledb_user` | `string` | User for the local Oracle database |
| `oracledb_password` | `string` | Password for the local Oracle database |
| `oracledb_disabled` | `bool` | Enables/Disables the OracleDB exporter (enabled by default) |

### Exporting metrics from external machines

Expand Down
16 changes: 14 additions & 2 deletions windows/observability-agent-autoconf.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -465,13 +465,25 @@ if (((Get-NetTCPConnection).LocalPort -contains 5672 -or $env:rabbitmq_scrape_ta
{
Write-Output "RabbitMQ exporter is not enabled, see the Observability Agent docs to learn how to enable it"
}
if ($env:rabbitmq_instance_label)
{
$instance_label = $env:rabbitmq_instance_label
}
elseif ($env:rabbitmq_scrape_target)
{
$instance_label = $env:rabbitmq_scrape_target
}
else
{
$instance_label = "127.0.0.1:15692"
}
if ($env:rabbitmq_scrape_target)
{
# Add the endpoint to the config
@"
prometheus.scrape "rabbit" {
targets = [
{"__address__" = "$rabbitmq_scrape_target", "instance" = "one"},
{"__address__" = "$rabbitmq_scrape_target", "instance" = "$instance_label"},
]
forward_to = [prometheus.remote_write.default.receiver]
Expand All @@ -485,7 +497,7 @@ forward_to = [prometheus.remote_write.default.receiver]
@"
prometheus.scrape "rabbit" {
targets = [
{"__address__" = "127.0.0.1:15692", "instance" = "one"},
{"__address__" = "127.0.0.1:15692", "instance" = "$instance_label"},
]
forward_to = [prometheus.remote_write.default.receiver]
Expand Down

0 comments on commit 3454645

Please sign in to comment.