diff --git a/README.md b/README.md index c83d9e7f..192cadb3 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Start by reading [how to use a template](docs/use_a_template.md), then check eac | Template | Description | Author | |----------------------|-------------|:------:| | [AWS Cloudwatch Monitoring](aws_cloudwatch/) | Monitor AWS EC2 and ELB | [bonitoo.io](.) | -| [Counter Strike: Global Offensive](csgo/) | Get stats about your game. | [Ignacio Van Droogenbroeck](https://github.com/xe-nvdk) | +| [Counter Strike: Global Offensive](csgo/) | Get stats about your game. Kills, Deaths and stats by weapon. | [Ignacio Van Droogenbroeck](https://github.com/xe-nvdk) | | [Currency Exchange Rates](currency_exchange_rates/) | Visualize and analyze currency exchange rates using Quandl. | Wojciech Kocjan | | [Covid-19 in South America](InfluxDBv2_Covid19_SouthAmerica/) | Current data and graphs covering Covid-19 cases and deaths in South America | [Ignacio Van Droogenbroeck](https://github.com/xe-nvdk) | | [Docker](docker/) | Monitor your running docker containers. | [@russorat](https://github.com/russorat) | @@ -32,6 +32,7 @@ Start by reading [how to use a template](docs/use_a_template.md), then check eac | [Microsoft SQL Server](mssql/) | View information of SQL Server Instance. Uptime, Databases Activities, Read and Write times and more | [Ignacio Van Droogenbroeck](https://github.com/xe-nvdk) | | [MySQL / MariaDB](mysql_mariadb/) | View information of MySQL Instance. Uptime, Current Queries, Active Threads, Connections, Traffic and more. | [Ignacio Van Droogenbroeck](https://github.com/xe-nvdk) | | [Network Interface Monitor](network_interface_performance/) | Monitor network interfaces on one or more hosts. | [@russorat](https://github.com/russorat) | +| [Postgres Monitor](postgresql/) | Monitor Postgres Server. CPU, Deadlocks, Data and more | [Ignacio Van Droogenbroeck](https://github.com/xe-nvdk) | | [Redis Monitor](redis/) | Monitor your Redis server. | [@russorat](https://github.com/russorat) | | [sFlow Traffic Monitor](sflow/) | Monitor your sFlow traffic. | [@russorat](https://github.com/russorat) | | [Telegraf Dashboard](telegraf/) | View throughput and internal stats about your Telegraf instances | Steven Soroka | diff --git a/postgresql/postgres.yml b/postgresql/postgres.yml new file mode 100755 index 00000000..b751c40b --- /dev/null +++ b/postgresql/postgres.yml @@ -0,0 +1,620 @@ +apiVersion: influxdata.com/v2alpha1 +kind: Label +metadata: + name: flamboyant-dubinsky-332001 +spec: + color: '#F95F53' + name: postgres +--- +apiVersion: influxdata.com/v2alpha1 +kind: Bucket +metadata: + name: vivid-heisenberg-732003 +spec: + associations: + - kind: Label + name: flamboyant-dubinsky-332001 + name: postgres +--- +apiVersion: influxdata.com/v2alpha1 +kind: Dashboard +metadata: + name: jovial-montalcini-f32001 +spec: + associations: + - kind: Label + name: flamboyant-dubinsky-332001 + charts: + - colors: + - hex: '#00C9FF' + name: laser + type: min + - hex: '#9394FF' + name: comet + type: max + value: 100 + decimalPlaces: 2 + height: 3 + kind: Gauge + name: Current IOwait + queries: + - query: |- + from(bucket: "postgres") + |> range(start: v.timeRangeStart, stop: v.timeRangeStop) + |> filter(fn: (r) => r["_measurement"] == "cpu") + |> filter(fn: (r) => r["_field"] == "usage_iowait") + width: 3 + - axes: + - base: "10" + name: x + scale: linear + - base: "10" + name: y + scale: linear + colors: + - hex: '#31C0F6' + name: Nineteen Eighty Four + type: scale + - hex: '#A500A5' + name: Nineteen Eighty Four + type: scale + - hex: '#FF7E27' + name: Nineteen Eighty Four + type: scale + geom: line + height: 2 + kind: Xy + name: Fetch Data (Select) + position: overlaid + queries: + - query: |- + from(bucket: "postgres") + |> range(start: v.timeRangeStart, stop: v.timeRangeStop) + |> filter(fn: (r) => r["_measurement"] == "postgresql") + |> filter(fn: (r) => r["_field"] == "tup_fetched") + |> derivative(unit: v.windowPeriod, nonNegative: false) + |> yield(name: "derivative") + shade: true + width: 4 + xCol: _time + yCol: _value + yPos: 3 + - axes: + - base: "10" + name: x + scale: linear + - base: "10" + name: y + scale: linear + colors: + - hex: '#31C0F6' + name: Nineteen Eighty Four + type: scale + - hex: '#A500A5' + name: Nineteen Eighty Four + type: scale + - hex: '#FF7E27' + name: Nineteen Eighty Four + type: scale + geom: line + height: 2 + kind: Xy + name: Insert Data + position: overlaid + queries: + - query: |- + from(bucket: "postgres") + |> range(start: v.timeRangeStart, stop: v.timeRangeStop) + |> filter(fn: (r) => r["_measurement"] == "postgresql") + |> filter(fn: (r) => r["_field"] == "tup_inserted") + |> derivative(unit: v.windowPeriod, nonNegative: false) + |> yield(name: "derivative") + shade: true + width: 4 + xCol: _time + yCol: _value + yPos: 5 + - axes: + - base: "10" + name: x + scale: linear + - base: "10" + name: y + scale: linear + colors: + - hex: '#31C0F6' + name: Nineteen Eighty Four + type: scale + - hex: '#A500A5' + name: Nineteen Eighty Four + type: scale + - hex: '#FF7E27' + name: Nineteen Eighty Four + type: scale + geom: line + height: 2 + kind: Xy + name: Disk Used % + position: overlaid + queries: + - query: |- + from(bucket: "postgres") + |> range(start: v.timeRangeStart, stop: v.timeRangeStop) + |> filter(fn: (r) => r["_measurement"] == "disk") + |> filter(fn: (r) => r["_field"] == "used_percent") + shade: true + width: 4 + xCol: _time + yCol: _value + yPos: 7 + - axes: + - base: "10" + name: x + scale: linear + - base: "10" + name: y + scale: linear + colors: + - hex: '#31C0F6' + name: Nineteen Eighty Four + type: scale + - hex: '#A500A5' + name: Nineteen Eighty Four + type: scale + - hex: '#FF7E27' + name: Nineteen Eighty Four + type: scale + geom: line + height: 2 + kind: Xy + name: Blocks Read + position: overlaid + queries: + - query: |- + from(bucket: "postgres") + |> range(start: v.timeRangeStart, stop: v.timeRangeStop) + |> filter(fn: (r) => r["_measurement"] == "postgresql") + |> filter(fn: (r) => r["_field"] == "blks_read") + |> derivative(unit: v.windowPeriod, nonNegative: false) + |> yield(name: "derivative") + shade: true + width: 6 + xCol: _time + yCol: _value + yPos: 9 + - colors: + - hex: '#4ED8A0' + name: rainforest + type: min + - hex: '#BF3D5E' + name: ruby + type: threshold + value: 85 + - hex: '#BF3D5E' + name: ruby + type: max + value: 100 + decimalPlaces: 2 + height: 3 + kind: Gauge + name: Current CPU + queries: + - query: |- + from(bucket: "postgres") + |> range(start: v.timeRangeStart, stop: v.timeRangeStop) + |> filter(fn: (r) => r["_measurement"] == "cpu") + |> filter(fn: (r) => r["_field"] == "usage_user") + width: 3 + xPos: 3 + - axes: + - base: "10" + name: x + scale: linear + - base: "10" + name: y + scale: linear + colors: + - hex: '#31C0F6' + name: Nineteen Eighty Four + type: scale + - hex: '#A500A5' + name: Nineteen Eighty Four + type: scale + - hex: '#FF7E27' + name: Nineteen Eighty Four + type: scale + geom: line + height: 2 + kind: Xy + name: Returned Data + position: overlaid + queries: + - query: |- + from(bucket: "postgres") + |> range(start: v.timeRangeStart, stop: v.timeRangeStop) + |> filter(fn: (r) => r["_measurement"] == "postgresql") + |> filter(fn: (r) => r["_field"] == "tup_returned") + |> derivative(unit: v.windowPeriod, nonNegative: false) + |> yield(name: "derivative") + shade: true + width: 4 + xCol: _time + xPos: 4 + yCol: _value + yPos: 3 + - axes: + - base: "10" + name: x + scale: linear + - base: "10" + name: y + scale: linear + colors: + - hex: '#31C0F6' + name: Nineteen Eighty Four + type: scale + - hex: '#A500A5' + name: Nineteen Eighty Four + type: scale + - hex: '#FF7E27' + name: Nineteen Eighty Four + type: scale + geom: line + height: 2 + kind: Xy + name: Deleted Data + position: overlaid + queries: + - query: |- + from(bucket: "postgres") + |> range(start: v.timeRangeStart, stop: v.timeRangeStop) + |> filter(fn: (r) => r["_measurement"] == "postgresql") + |> filter(fn: (r) => r["_field"] == "tup_deleted") + |> derivative(unit: v.windowPeriod, nonNegative: false) + |> yield(name: "derivative") + shade: true + width: 4 + xCol: _time + xPos: 4 + yCol: _value + yPos: 5 + - axes: + - base: "10" + name: x + scale: linear + - base: "10" + name: y + scale: linear + colors: + - hex: '#31C0F6' + name: Nineteen Eighty Four + type: scale + - hex: '#A500A5' + name: Nineteen Eighty Four + type: scale + - hex: '#FF7E27' + name: Nineteen Eighty Four + type: scale + geom: line + height: 2 + kind: Xy + name: Disk Read Time + position: overlaid + queries: + - query: |- + from(bucket: "postgres") + |> range(start: v.timeRangeStart, stop: v.timeRangeStop) + |> filter(fn: (r) => r["_measurement"] == "diskio") + |> filter(fn: (r) => r["_field"] == "read_time") + |> derivative(unit: v.windowPeriod, nonNegative: false) + |> yield(name: "derivative") + shade: true + width: 4 + xCol: _time + xPos: 4 + yCol: _value + yPos: 7 + - colors: + - hex: '#00C9FF' + name: laser + type: min + - hex: '#9394FF' + name: comet + type: max + value: 100 + decimalPlaces: 2 + height: 3 + kind: Gauge + name: RAM Used (%) + queries: + - query: |- + from(bucket: "postgres") + |> range(start: v.timeRangeStart, stop: v.timeRangeStop) + |> filter(fn: (r) => r["_measurement"] == "mem") + |> filter(fn: (r) => r["_field"] == "used_percent") + width: 2 + xPos: 6 + - axes: + - base: "10" + name: x + scale: linear + - base: "10" + name: y + scale: linear + colors: + - hex: '#31C0F6' + name: Nineteen Eighty Four + type: scale + - hex: '#A500A5' + name: Nineteen Eighty Four + type: scale + - hex: '#FF7E27' + name: Nineteen Eighty Four + type: scale + geom: line + height: 2 + kind: Xy + name: Blocks Hit + position: overlaid + queries: + - query: |- + from(bucket: "postgres") + |> range(start: v.timeRangeStart, stop: v.timeRangeStop) + |> filter(fn: (r) => r["_measurement"] == "postgresql") + |> filter(fn: (r) => r["_field"] == "blks_hit") + |> derivative(unit: v.windowPeriod, nonNegative: false) + |> yield(name: "derivative") + shade: true + width: 6 + xCol: _time + xPos: 6 + yCol: _value + yPos: 9 + - colors: + - hex: '#00C9FF' + name: laser + type: text + decimalPlaces: 0 + height: 3 + kind: Single_Stat + name: RAM Available (GB) + queries: + - query: |- + from(bucket: "postgres") + |> range(start: v.timeRangeStart, stop: v.timeRangeStop) + |> filter(fn: (r) => r["_measurement"] == "mem") + |> filter(fn: (r) => r["_field"] == "available") + |> last() + |> map(fn: (r) => ({r with _value: r._value / 1000024})) + width: 2 + xPos: 8 + - axes: + - base: "10" + name: y + scale: linear + - base: "10" + name: x + scale: linear + colors: + - hex: '#31C0F6' + name: Nineteen Eighty Four + type: scale + - hex: '#A500A5' + name: Nineteen Eighty Four + type: scale + - hex: '#FF7E27' + name: Nineteen Eighty Four + type: scale + geom: line + height: 2 + kind: Xy + name: Update Data + position: overlaid + queries: + - query: |- + from(bucket: "postgres") + |> range(start: v.timeRangeStart, stop: v.timeRangeStop) + |> filter(fn: (r) => r["_measurement"] == "postgresql") + |> filter(fn: (r) => r["_field"] == "tup_updated") + |> derivative(unit: v.windowPeriod, nonNegative: false) + |> yield(name: "derivative") + shade: true + width: 4 + xCol: _time + xPos: 8 + yCol: _value + yPos: 3 + - axes: + - base: "10" + name: x + scale: linear + - base: "10" + name: y + scale: linear + colors: + - hex: '#00C9FF' + name: laser + type: text + decimalPlaces: 2 + height: 2 + kind: Single_Stat_Plus_Line + name: Conflicts + position: overlaid + queries: + - query: |- + from(bucket: "postgres") + |> range(start: v.timeRangeStart, stop: v.timeRangeStop) + |> filter(fn: (r) => r["_measurement"] == "postgresql") + |> filter(fn: (r) => r["_field"] == "conflicts") + width: 2 + xCol: _time + xPos: 8 + yCol: _value + yPos: 5 + - axes: + - base: "10" + name: y + scale: linear + - base: "10" + name: x + scale: linear + colors: + - hex: '#74D495' + name: Atlantis + type: scale + - hex: '#3F3FBA' + name: Atlantis + type: scale + - hex: '#FF4D9E' + name: Atlantis + type: scale + geom: line + height: 2 + kind: Xy + name: Disk Write Time + position: overlaid + queries: + - query: |- + from(bucket: "postgres") + |> range(start: v.timeRangeStart, stop: v.timeRangeStop) + |> filter(fn: (r) => r["_measurement"] == "diskio") + |> filter(fn: (r) => r["_field"] == "write_time") + |> derivative(unit: v.windowPeriod, nonNegative: false) + |> yield(name: "derivative") + shade: true + width: 4 + xCol: _time + xPos: 8 + yCol: _value + yPos: 7 + - colors: + - hex: '#00C9FF' + name: laser + type: text + decimalPlaces: 1 + height: 3 + kind: Single_Stat + name: RAM Cached (GB) + queries: + - query: |- + from(bucket: "postgres") + |> range(start: v.timeRangeStart, stop: v.timeRangeStop) + |> filter(fn: (r) => r["_measurement"] == "mem") + |> filter(fn: (r) => r["_field"] == "cached") + |> last() + |> map(fn: (r) => ({r with _value: r._value / 1000024})) + width: 2 + xPos: 10 + - axes: + - base: "10" + name: y + scale: linear + - base: "10" + name: x + scale: linear + colors: + - hex: '#00C9FF' + name: laser + type: text + decimalPlaces: 2 + height: 2 + kind: Single_Stat_Plus_Line + name: Deadlocks + position: overlaid + queries: + - query: |- + from(bucket: "postgres") + |> range(start: v.timeRangeStart, stop: v.timeRangeStop) + |> filter(fn: (r) => r["_measurement"] == "postgresql") + |> filter(fn: (r) => r["_field"] == "deadlocks") + width: 2 + xCol: _time + xPos: 10 + yCol: _value + yPos: 5 + name: Postgres + +--- + +apiVersion: influxdata.com/v2alpha1 +kind: Telegraf +metadata: + name: postgres-config +spec: + config: | + + [[outputs.influxdb_v2]] + ## The URLs of the InfluxDB cluster nodes. + ## + ## Multiple URLs can be specified for a single cluster, only ONE of the + ## urls will be written to each interval. + ## urls exp: http://127.0.0.1:9999 + urls = ["$INFLUX_HOST"] + + ## Token for authentication. + token = "$INFLUX_TOKEN" + + ## Organization is the name of the organization you wish to write to; must exist. + organization = "$INFLUX_ORG" + + ## Destination bucket to write into. + bucket = "$INFLUX_BUCKET" + + [agent] + interval = "1m" + + [[inputs.postgresql]] + # address = "postgres://postgres:mysecretpassword@localhost:5432" + address = "$PSQL_STRING_CONNECTION" + ignored_databases = ["template0", "template1"] + + [[inputs.cpu]] + ## Whether to report per-cpu stats or not + percpu = true + ## Whether to report total system cpu stats or not + totalcpu = true + ## If true, collect raw CPU time metrics. + collect_cpu_time = false + ## If true, compute and report the sum of all non-idle CPU states. + report_active = false + + [[inputs.disk]] + ## By default stats will be gathered for all mount points. + ## Set mount_points will restrict the stats to only the specified mount points. + # mount_points = ["/"] + + ## Ignore mount points by filesystem type. + ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"] + + # Read metrics about disk IO by device + [[inputs.diskio]] + ## By default, telegraf will gather stats for all devices including + ## disk partitions. + ## Setting devices will restrict the stats to the specified devices. + # devices = ["sda", "sdb"] + ## Uncomment the following line if you need disk serial numbers. + # skip_serial_number = false + # + ## On systems which support it, device metadata can be added in the form of + ## tags. + ## Currently only Linux is supported via udev properties. You can view + ## available properties for a device by running: + ## 'udevadm info -q property -n /dev/sda' + ## Note: Most, but not all, udev properties can be accessed this way. Properties + ## that are currently inaccessible include DEVTYPE, DEVNAME, and DEVPATH. + # device_tags = ["ID_FS_TYPE", "ID_FS_USAGE"] + # + ## Using the same metadata source as device_tags, you can also customize the + ## name of the device via templates. + ## The 'name_templates' parameter is a list of templates to try and apply to + ## the device. The template may contain variables in the form of '$PROPERTY' or + ## '${PROPERTY}'. The first template which does not contain any variables not + ## present for the device is used as the device name tag. + ## The typical use case is for LVM volumes, to get the VG/LV name instead of + ## the near-meaningless DM-0 name. + # name_templates = ["$ID_FS_LABEL","$DM_VG_NAME/$DM_LV_NAME"] + + # Read metrics about memory usage + [[inputs.mem]] + # no configuration + \ No newline at end of file diff --git a/postgresql/readme.md b/postgresql/readme.md new file mode 100644 index 00000000..b0042f72 --- /dev/null +++ b/postgresql/readme.md @@ -0,0 +1,46 @@ +# Postgres Template for InfluxDB v2 + +Provided by: Ignacio Van Droogenbroeck + +This Dashboard offers you information about your Postgres instance. CPU Usage, RAM Usage, Deadlocks, Fetch, Update, Return Data and more. + +![Dashboard Screenshot](screenshot.png) + +### Quick Install + +If you have your InfluxDB credentials [configured in the CLI](Vhttps://v2.docs.influxdata.com/v2.0/reference/cli/influx/config/), you can install this template with: + +``` +influx pkg -u https://raw.githubusercontent.com/influxdata/community-templates/master/postgresql/postgres.yml +``` + +## Included Resources + + - 1 Telegraf Configuration: 'postgres-config + - 1 Dashboards: 'Postgres' + - 1 Label: 'postgres' + - 1 Bucket: 'postgres' + +## Setup Instructions + +General instructions on using InfluxDB Templates can be found in the [use a template](../docs/use_a_template.md) document. + + Telegraf Configuration requires the following environment variables + - `INFLUX_TOKEN` - The token with the permissions to read Telegraf configs and write data to the `telegraf` bucket. You can just use your master token to get started. + - `INFLUX_ORG` - The name of your Organization. + - `INFLUX_HOST` - The address of you InfluxDB + - `INFLUX_BUCKET` - The name of the Bucket. If you going to use the bucket included, you need to export the variable. Ex: export INFLUX_BUCKET=postgres + +In order to use this Dashboard, you need to specify the connection string to the Postgres instance as variable. The same needs to define user and password (read only recommended) + +ex: $ export PSQL_STRING_CONNECTIONG=postgres://postgres:mysecretpassword@localhost:5432 + +## Contact + +Author: Ignacio Van Droogenbroeck + +Email: ignacio[at]vandroogenbroeck[dot]net + +Github and Gitlab user: @xe-nvdk + +Influx Slack: Ignacio Van Droogenbroeck diff --git a/postgresql/screenshot.png b/postgresql/screenshot.png new file mode 100644 index 00000000..ca4df87f Binary files /dev/null and b/postgresql/screenshot.png differ