Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 8 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
FROM golang:1.19-alpine as builder
RUN apk update && apk add git bash && rm -rf /var/cache/apk/* \
&& mkdir -p /github.com/simagix/mongo-ftdc && cd /github.com/simagix \
&& git clone --depth 1 https://github.com/simagix/mongo-ftdc.git
RUN apk update && apk add git bash && rm -rf /var/cache/apk/*
# ADD . /github.com/simagix/mongo-ftdc
WORKDIR /github.com/simagix/mongo-ftdc
WORKDIR /mongo-ftdc
COPY . /mongo-ftdc/
RUN ./build.sh
FROM alpine
LABEL Ken Chen <ken.chen@simagix.com>
RUN addgroup -S simagix && adduser -S simagix -G simagix
USER simagix
WORKDIR /home/simagix
COPY --from=builder /github.com/simagix/mongo-ftdc/dist/ftdc_json /ftdc_json
CMD ["/ftdc_json", "--latest", "3", "diagnostic.data/"]
RUN addgroup -S ajithkn && adduser -S ajithkn -G ajithkn
USER ajithkn
WORKDIR /home/ajithkn
COPY --from=builder /mongo-ftdc/dist/ftdc_json /ftdc_json
CMD ["/ftdc_json", "--latest", "3", "diagnostic.data/"]
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# MongoDB FTDC Metrics and Charts

A dockerized tool to view MongoDB FTDC metrics.
Introducing new dockerized tool designed to visualize MongoDB FTDC (Field Type Data Capture) metrics. This dashboard provides comprehensive insights into the performance and health of your MongoDB deployment.

## New Features

- FTDC Metrics: Gain visibility into various MongoDB metrics, including WiredTiger and storage engine statistics.
- Customizable Charts: Customize charts to monitor specific metrics based on your requirements.
- New Metrics: We've added Ops Counters Repl, Write Conflicts, Collection Scan, Cursors, TTL Delete, Flow Control and Document Operations metrics to provide deeper insights into your MongoDB deployment.
- Enhanced Graphs: Replication lag and disk IOPS graphs have been enhanced for improved monitoring and analysis.

## Build

Expand Down
10 changes: 5 additions & 5 deletions assessment.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var FormulaMap = map[string]ScoreFormula{
"queued_write": {label: "queued_write", formula: "p95 of queued_write", low: 1, high: 5},
"scan_keys": {label: "scan_keys", formula: "scan_keys", low: 0, high: (1024 * 1024)},
"scan_objects": {label: "scan_objects", formula: "max of [](scan_objects/scan_keys)", low: 2, high: 5},
"scan_sort": {label: "scan_sort", formula: "scan_sort", low: 0, high: 1000},
"op_blkSort": {label: "op_blkSort", formula: "op_blkSort", low: 0, high: 1000},
"ticket_avail_read": {label: "ticket_avail_read %%", formula: "(p5 of ticket_avail_read)/128", low: 0, high: 100},
"ticket_avail_write": {label: "ticket_avail_write %%", formula: "(p5 of ticket_avail_write)/128", low: 0, high: 100},
"wt_cache_used": {label: "wt_cache_used %%", formula: "(p95 of wt_cache_used)/wt_cache_max", low: 80, high: 95},
Expand Down Expand Up @@ -112,8 +112,8 @@ func (as *Assessment) GetAssessment(from time.Time, to time.Time) map[string]int
marr = append(marr, m)
}
}
for k, v := range as.stats.DiskStats {
p5, median, p95 := as.getStatsByData(v.IOPS, from, to)
/* for k, v := range as.stats.DiskStats {
p5, median, p95 := as.getStatsByData(v.READ_IOPS, from, to)
if p95 == 0 {
continue
}
Expand All @@ -126,7 +126,7 @@ func (as *Assessment) GetAssessment(from time.Time, to time.Time) map[string]int
if m.score < 101 || as.verbose {
marr = append(marr, m)
}
}
}*/
sort.Slice(marr, func(i int, j int) bool {
// return marr[i].label < marr[j].label
if marr[i].score < marr[j].score {
Expand Down Expand Up @@ -283,7 +283,7 @@ func (as *Assessment) getScore(metric string, p5 float64, median float64, p95 fl
}
}
score = GetScoreByRange(max, lwm, hwm)
} else if metric == "scan_sort" { // 1 k sorted in mem
} else if metric == "op_blkSort" { // 1 k sorted in mem
score = GetScoreByRange(p95, lwm, hwm)
} else if strings.HasPrefix(metric, "ticket_avail_") {
score = int(100 * p5 / 128)
Expand Down
18 changes: 18 additions & 0 deletions attribs.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func (attr *Attribs) GetServerStatusDataPoints(i int) ServerStatusDoc {
ss.Metrics.QueryExecutor.Scanned = attr.get("serverStatus/metrics/queryExecutor/scanned", i)
ss.Metrics.QueryExecutor.ScannedObjects = attr.get("serverStatus/metrics/queryExecutor/scannedObjects", i)
ss.Metrics.Operation.ScanAndOrder = attr.get("serverStatus/metrics/operation/scanAndOrder", i)
ss.Metrics.Operation.WriteConflicts = attr.get("serverStatus/metrics/operation/WriteConflicts", i)
ss.OpLatencies.Commands.Latency = attr.get("serverStatus/opLatencies/commands/latency", i)
ss.OpLatencies.Commands.Ops = attr.get("serverStatus/opLatencies/commands/ops", i)
ss.OpLatencies.Reads.Latency = attr.get("serverStatus/opLatencies/reads/latency", i)
Expand All @@ -56,6 +57,23 @@ func (attr *Attribs) GetServerStatusDataPoints(i int) ServerStatusDoc {
ss.OpCounters.Insert = attr.get("serverStatus/opcounters/insert", i)
ss.OpCounters.Query = attr.get("serverStatus/opcounters/query", i)
ss.OpCounters.Update = attr.get("serverStatus/opcounters/update", i)
ss.OpCountersRepl.Command = attr.get("serverStatus/opcountersRepl/command", i)
ss.OpCountersRepl.Delete = attr.get("serverStatus/opcountersRepl/delete", i)
ss.OpCountersRepl.Getmore = attr.get("serverStatus/opcountersRepl/getmore", i)
ss.OpCountersRepl.Insert = attr.get("serverStatus/opcountersRepl/insert", i)
ss.OpCountersRepl.Query = attr.get("serverStatus/opcountersRepl/query", i)
ss.OpCountersRepl.Update = attr.get("serverStatus/opcountersRepl/update", i)
ss.Metrics.Cursor.Total = attr.get("serverStatus/metrics/cursor/open/total", i)
ss.Metrics.Cursor.Pinned = attr.get("serverStatus/metrics/cursor/open/pinned", i)
ss.Metrics.Cursor.NoTimeout = attr.get("serverStatus/metrics/cursor/open/noTimeout", i)
ss.FlowControl.IsLaggedCount = attr.get("serverStatus/flowControl/isLaggedCount", i)
ss.Metrics.QueryExecutor.CollectionScans.NonTailable = attr.get("serverStatus/metrics/queryExecutor/collectionScans/nonTailable", i)
ss.Metrics.QueryExecutor.CollectionScans.Total = attr.get("serverStatus/metrics/queryExecutor/collectionScans/total", i)
ss.Metrics.Document.Deleted = attr.get("serverStatus/metrics/document/deleted", i)
ss.Metrics.Document.Inserted = attr.get("serverStatus/metrics/document/inserted", i)
ss.Metrics.Document.Returned = attr.get("serverStatus/metrics/document/returned", i)
ss.Metrics.Document.Updated = attr.get("serverStatus/metrics/document/updated", i)
ss.Metrics.TTL.DeletedDocuments = attr.get("serverStatus/metrics/ttl/deletedDocuments", i)
ss.Uptime = attr.get("serverStatus/uptime", i)

ss.WiredTiger.BlockManager.BytesRead = attr.get("serverStatus/wiredTiger/block-manager/bytes read", i)
Expand Down
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ LDFLAGS="-X main.version=$VERSION -X main.repo=$EXEC"
mkdir -p dist
if [ "$1" == "docker" ]; then
VER=$(cat version)
TAG="simagix/ftdc"
TAG="ajithkn716/mongo-ftdc"
docker-compose down > /dev/null 2>&1
if [[ "${VER}" == "master" ]]; then
VER="latest"
fi
docker build --no-cache -f Dockerfile -t ${TAG}:${VER} .
docker tag ${TAG}:${VER} ${TAG}

docker build --no-cache -f grafana/Dockerfile -t simagix/grafana-ftdc:${VER} .
docker tag simagix/grafana-ftdc:${VER} simagix/grafana-ftdc
docker build --no-cache -f grafana/Dockerfile -t ajithkn716/grafana-ftdc:${VER} .
docker tag ajithkn716/grafana-ftdc:${VER} ajithkn716/grafana-ftdc
else
env CGO_ENABLED=0 go build -ldflags "$LDFLAGS" -o dist/$EXEC main/ftdc_json.go
dist/$EXEC -version
Expand Down
4 changes: 2 additions & 2 deletions diagnostic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"testing"
)

const DiagnosticDataDirectory = "../diagnostic.data"
const DiagnosticDataFilename = DiagnosticDataDirectory + "/metrics.2017-10-12T20-08-53Z-00000"
const DiagnosticDataDirectory = "./diagnostic.data"
const DiagnosticDataFilename = DiagnosticDataDirectory + "/metrics.2024-04-30T10-51-20Z-00000"

func TestReadDiagnosticFiles(t *testing.T) {
var err error
Expand Down
Binary file added dist/ftdc_json
Binary file not shown.
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ version: "3"

services:
grafana-ftdc:
image: simagix/grafana-ftdc:latest
image: ajithkn716/grafana-ftdc:latest
hostname: grafana-ftdc
ports:
- "3030:3000"
environment:
GF_INSTALL_PLUGINS: simpod-json-datasource

ftdc:
image: simagix/ftdc:latest
image: ajithkn716/mongo-ftdc:latest
hostname: ftdc
ports:
- "5408:5408"
Expand Down
Loading