forked from digital-asset/daml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add collectd metrics (digital-asset#6189)
* Add collectd metrics CHANGELOG_BEGIN CHANGELOG_END * Remove useless file * Fix typo
- Loading branch information
1 parent
81aff44
commit dde5af0
Showing
3 changed files
with
1,001 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,56 @@ | ||
# Collectd metrics | ||
|
||
|
||
## Collectd installation - macOS | ||
|
||
First, check whether the directory `/usr/local/sbin` exists on your machine. | ||
This directory does not exist on MacOs by default, and homebrew will try to link | ||
collectd into this directory. If it does not exist, run: | ||
|
||
``` | ||
sudo mkdir /usr/local/sbin | ||
sudo chown -R `whoami`:admin /usr/local/sbin | ||
``` | ||
|
||
To install collectd, run: | ||
|
||
``` | ||
brew install libpq | ||
brew install --build-from-source collectd | ||
``` | ||
|
||
Note: The collectd bottle does not contain the postgresql plugin. | ||
You therefore need to install `libpq` first, then build collectd from source. | ||
|
||
If everything went well, you should have the following file on your machine: | ||
|
||
``` | ||
/usr/local/Cellar/collectd/5.11.0/lib/collectd/postgresql.so | ||
``` | ||
|
||
## Collectd configuration | ||
|
||
Once installed, replace `/usr/local/etc/collectd.conf` with the [file from this directory](./collectd.conf) | ||
|
||
## Postgres configuration | ||
|
||
To allow collectd to monitor PostgreSQL, | ||
create a `collectd` user and grant it priviledges to your databases. | ||
|
||
``` | ||
psql -d postgres | ||
# create user collectd with encrypted password 'collectd'; | ||
# grant all privileges on database damlsandbox to collectd; | ||
# grant all privileges on database damlsandboxindex to collectd; | ||
``` | ||
|
||
Note: this assumes your databaseses are called `damlsandbox` and `damlsandboxindex`. | ||
If you want to monitor different databases, change also the corresponding entries in `collectd.conf`. | ||
|
||
## Running collectd | ||
|
||
To run collectd as a foreground process, run: | ||
|
||
``` | ||
sudo /usr/local/sbin/collectd -f -C /usr/local/etc/collectd.conf | ||
``` |
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,81 @@ | ||
Hostname "localhost" | ||
FQDNLookup false | ||
BaseDir "/usr/local/var/lib/collectd" | ||
PIDFile "/usr/local/var/run/collectd.pid" | ||
TypesDB "/usr/local/Cellar/collectd/5.11.0/share/collectd/types.db" | ||
|
||
AutoLoadPlugin true | ||
|
||
Interval 1 | ||
|
||
MaxReadInterval 86400 | ||
Timeout 2 | ||
ReadThreads 5 | ||
WriteThreads 5 | ||
|
||
<Plugin cpu> | ||
ReportByCpu true | ||
ReportByState true | ||
ValuesPercentage true | ||
</Plugin> | ||
|
||
<Plugin load> | ||
ReportRelative true | ||
</Plugin> | ||
|
||
<Plugin memory> | ||
ValuesAbsolute true | ||
ValuesPercentage false | ||
</Plugin> | ||
|
||
<Plugin "disk"> | ||
IgnoreSelected false | ||
</Plugin> | ||
|
||
<Plugin processes> | ||
ProcessMatch "docker" "com.docker.hyperkit" | ||
Process "java" | ||
ProcessMatch "postgres" "postgres.*" | ||
</Plugin> | ||
|
||
<Plugin postgresql> | ||
<Database damlsandbox> | ||
Host "localhost" | ||
Port "5432" | ||
User "collectd" | ||
Password "collectd" | ||
# Predefined: | ||
Query backends | ||
Query transactions | ||
Query queries | ||
Query table_states | ||
Query disk_io | ||
Query disk_usage | ||
</Database> | ||
<Database damlsandboxindex> | ||
Host "localhost" | ||
Port "5432" | ||
User "collectd" | ||
Password "collectd" | ||
# Predefined: | ||
Query backends | ||
Query transactions | ||
Query queries | ||
Query table_states | ||
Query disk_io | ||
Query disk_usage | ||
</Database> | ||
</Plugin> | ||
|
||
<Plugin write_graphite> | ||
<Carbon> | ||
Host "localhost" | ||
Port "2003" | ||
Prefix "collectd." | ||
Protocol "tcp" | ||
LogSendErrors true | ||
StoreRates true | ||
AlwaysAppendDS false | ||
EscapeCharacter "_" | ||
</Carbon> | ||
</Plugin> |
Oops, something went wrong.