5 if [ ! -d "$base" -o ! -f "$base/netdata.c" ]
7 echo >&2 "Cannot find my home directory '${base}'."
12 echo "Creating a directory for netdata..."
14 for x in /run/netdata /var/run/netdata /tmp/netdata
16 echo " Trying '${x}'..."
22 echo " OK. '${x}' works."
27 echo " OK. '${x}' works."
35 echo >&2 "Cannot find where to put JSON files."
39 echo "Stopping a (possibly) running netdata..."
40 killall netdata 2>/dev/null
42 echo "Compiling netdata"
43 gcc -O3 -o netdata netdata.c || exit 1
45 echo "Starting netdata"
46 ./netdata -d -u 1 -l 60 -o "${data}" || exit 1
48 echo "Waiting 2 seconds for the JSON files"
49 # wait 2 seconds for the JSON files to be generated
54 echo "Removing existing $base/data link"
60 echo "Linking '${data}' to $base/data"
61 ln -s "${data}" data || exit 1
63 echo >&2 "Directory $base/data already exists. Not touching it, however it should be a link '${data}'."
66 echo "Finding proper parameters for dashboard..."
68 all=`ls "${data}" | grep .json$ | sed "s/\.json$//g"`
78 while [ $a -lt $count ]
98 echo "Generating all.html"
100 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
101 <html xmlns="http://www.w3.org/1999/xhtml">
103 * {font-family:Arial}
104 div {float: left; margin: 0 0 0 0; }
106 <title>netdata</title>
108 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
110 <!--Load the AJAX API-->
111 <script type="text/javascript" src="https://www.google.com/jsapi"></script>
112 <script type="text/javascript" src="jquery-1.10.1.min.js"></script>
113 <script type="text/javascript" src="netdata.js"></script>
114 <script type="text/javascript">
116 // Set a callback to run when the Google Visualization API is loaded.
117 google.setOnLoadCallback(drawCharts);
119 function drawCharts() {
120 var width = $w; // if zero, auto-adjusts to 50% of screen, 1-10 goes 1/width of screen
123 // EDIT: add one line per interface you have
125 // EDIT: name div id json data graph title
126 // EDIT: --------------------------------------------------------------------------------
131 cat >>all.html <<EOF2
132 drawChart('${x}', '${x}_div', width, height, "data/${x}.json", "Live Network Usage for ${x}");
148 cat >>all.html <<EOF3
151 function myChartsRefresh() {
152 // refresh up to 4 charts per second
156 // EDIT: how often the charts are updated, in milliseconds
157 setInterval(myChartsRefresh, $tim);
163 EDIT: add one div per interface you have
164 EDIT: use the same id above and bellow!
170 cat >>all.html <<EOF4
171 <div id="${x}_div"></div>
175 cat >>all.html <<EOF5
181 echo "Just hit all.html from your browser."