netdata dashboard using guages for hosts and docker containers
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

151 lines
5.4 KiB

#!/bin/bash
# Write a master dashboard based on the hosts.ini file in the current directory
# Vars for the site
sitename="Dev0 Netdata"
title="Dev0 Netdata"
desc="Master Dashboard"
theme="'slate'"
# read hosts.ini as array
readarray ARRAY < hosts.ini
# echo the file header, clearing the file
echo '<!DOCTYPE html>
<!-- SPDX-License-Identifier: GPL-3.0-or-later -->
<html lang="en">
<head>
<title>NetData Dashboard</title>
<meta name="application-name" content="netdata">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="author" content="costa@tsaousis.gr">
<meta property="og:locale" content="en_US" />
<meta property="og:image" content="https://cloud.githubusercontent.com/assets/2662304/22945737/e98cd0c6-f2fd-11e6-96f1-5501934b0955.png"/>
<meta property="og:url" content="http://my-netdata.io/"/>
<meta property="og:type" content="website"/>
<meta property="og:site_name" content="$sitename"/>
<meta property="og:title" content="$title"/>
<meta property="og:description" content="$desc" />
</head>
<script>var netdataTheme = '$theme';</script>
<script type="text/javascript" src="http://netdata.dev0.sh/dashboard.js"></script>
<script>NETDATA.options.current.stop_updates_when_focus_is_lost = false;</script>
<body>
<div style="width: 100%; text-align: center; padding-top: 1%;">' > master.html
# iterate over the dashboard for each host, adding it to the master.html file
for i in "${ARRAY[@]}"
do
i=$(tr -d ' ' <<< "$i")
echo ' <div style="margin-right: 10px; width: 20%;"
class="netdata-container-easypiechart"
data-host="http://'$i':19999"
data-netdata="system.ram"
data-dimensions="used|buffers|active|wired"
data-append-options="percentage"
data-chart-library="easypiechart"
data-easypiechart-max-value="100"
data-title="Memory" data-units="%"
data-gauge-max-value="100"
data-width="8%"
data-after="-360"
data-points="360"
data-colors="#16A086"
role="application">
</div>
<div style="margin-right: 10px; width: 20%;"
class="netdata-container-easypiechart"
data-host="http://'$i':19999"
data-netdata="system.net"
data-dimensions="received"
data-chart-library="easypiechart"
data-title="NetIn"
data-width="8%"
data-after="-360"
data-points="360"
data-colors="#16A086"
role="application">
</div>
<div style="margin-right: 10px; width: 20%;"
class="netdata-container-easypiechart"
data-host="http://'$i':19999"
data-netdata="system.net"
data-dimensions="sent"
data-chart-library="easypiechart"
data-title="NetOut"
data-width="8%"
data-after="-360"
data-points="360"
data-colors="#16A086"
role="application">
</div>
<div style="margin-right: 10px; width: 20%;"
class="netdata-container-gauge"
data-host="http://'$i':19999"
data-netdata="system.cpu"
data-chart-library="gauge"
data-title="'$i'" data-units="%"
data-gauge-max-value="100"
data-width="15%"
data-after="-360"
data-points="360"
data-colors="#16A086"
role="application">
</div>
<div style="margin-right: 10px; width: 20%;"
class="netdata-container-easypiechart"
data-host="http://'$i':19999"
data-netdata="system.io"
data-dimensions="in"
data-append-options="percentage"
data-chart-library="easypiechart"
data-easypiechart-max-value="1024"
data-title="Disk Read"
data-width="8%"
data-after="-360"
data-points="360"
data-colors="#16A086"
role="application">
</div>
<div style="margin-right: 10px; width: 20%;"
class="netdata-container-easypiechart"
data-host="http://'$i':19999"
data-netdata="system.io"
data-dimensions="out"
data-append-options="percentage"
data-chart-library="easypiechart"
data-easypiechart-max-value="1024"
data-title="Disk Write"
data-width="8%"
data-after="-360"
data-points="360"
data-colors="#16A086"
role="application">
</div>
<div style="margin-right: 10px; width: 20%;"
class="netdata-container-easypiechart"
data-host="http://'$i':19999"
data-netdata="system.entropy"
data-dimensions="entropy"
data-chart-library="easypiechart"
data-easypiechart-max-value="4000"
data-title="Entropy"
data-width="8%"
data-after="-360"
data-points="360"
data-colors="#16A086"
role="application">
</div>
<br>' >> master.html
done
echo "
</div>
</body>
</html>" >> master.html