# if this chart is called X.chart.sh, then all functions and global variables
# must start with X_
-cpufreq_sys_dir="/sys/devices"
+cpufreq_sys_dir="${NETDATA_HOST_PREFIX}/sys/devices"
cpufreq_sys_depth=10
cpufreq_source_update=1
health.d/swap.conf \
health.d/tcp_resets.conf \
$(NULL)
+
+chartsconfigdir=$(configdir)/charts.d
+dist_chartsconfig_DATA = \
+ charts.d/apache.conf \
+ charts.d/apcupsd.conf \
+ charts.d/cpufreq.conf \
+ charts.d/exim.conf \
+ charts.d/load_average.conf \
+ charts.d/mysql.conf \
+ charts.d/nut.conf \
+ charts.d/phpfpm.conf \
+ charts.d/sensors.conf \
+ charts.d/tomcat.conf \
+ charts.d/ap.conf \
+ charts.d/cpu_apps.conf \
+ charts.d/example.conf \
+ charts.d/hddtemp.conf \
+ charts.d/mem_apps.conf \
+ charts.d/nginx.conf \
+ charts.d/opensips.conf \
+ charts.d/postfix.conf \
+ charts.d/squid.conf \
+ $(NULL)
--- /dev/null
+# no need for shebang - this file is loaded from charts.d.plugin
+
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+
+# nothing fancy to configure.
+# this module will run
+# iw dev - to find wireless devices in AP mode
+# iw ${dev} station dump - to get connected clients
+# based on the above, it generates several charts
+
+# the data collection frequency
+# if unset, will inherit the netdata update frequency
+#ap_update_every=
+
+# the charts priority on the dashboard
+#ap_priority=6900
--- /dev/null
+# no need for shebang - this file is loaded from charts.d.plugin
+
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+
+# THIS PLUGIN IS DEPRECATED
+# USE THE PYTHON.D ONE
+
+# the URL to download apache status info
+#apache_url="http://127.0.0.1:80/server-status?auto"
+#apache_curl_opts=
+
+# convert apache floating point values
+# to integer using this multiplier
+# this only affects precision - the values
+# will be in the proper units
+#apache_decimal_detail=1000000
+
+# the data collection frequency
+# if unset, will inherit the netdata update frequency
+#apache_update_every=
+
+# the charts priority on the dashboard
+#apache_priority=60000
--- /dev/null
+# no need for shebang - this file is loaded from charts.d.plugin
+
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+
+#apcupsd_ip=127.0.0.1
+#apcupsd_port=3551
+
+# how long to wait for apcupsd to respond
+#apcupsd_timeout=3
+
+# the data collection frequency
+# if unset, will inherit the netdata update frequency
+#apcupsd_update_every=10
+
+# the charts priority on the dashboard
+#apcupsd_priority=90000
--- /dev/null
+# no need for shebang - this file is loaded from charts.d.plugin
+
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+
+# THIS PLUGIN IS DEPRECATED
+# app.plugin can do better
+
+#cpu_apps_apps=
+
+# the data collection frequency
+# if unset, will inherit the netdata update frequency
+#cpu_apps_update_every=2
--- /dev/null
+# no need for shebang - this file is loaded from charts.d.plugin
+
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+
+# THIS PLUGIN IS DEPRECATED
+# USE THE PYTHON.D ONE
+
+#cpufreq_sys_dir="/sys/devices"
+#cpufreq_sys_depth=10
+#cpufreq_source_update=1
+
+# the data collection frequency
+# if unset, will inherit the netdata update frequency
+#cpufreq_update_every=
+
+# the charts priority on the dashboard
+#cpufreq_priority=10000
--- /dev/null
+# no need for shebang - this file is loaded from charts.d.plugin
+
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+
+# to enable this chart, you have to set this to 12345
+# (just a demonstration for something that needs to be checked)
+#example_magic_number=12345
+
+# the data collection frequency
+# if unset, will inherit the netdata update frequency
+#example_update_every=
+
+# the charts priority on the dashboard
+#example_priority=150000
--- /dev/null
+# no need for shebang - this file is loaded from charts.d.plugin
+
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+
+# THIS PLUGIN IS DEPRECATED
+# USE THE PYTHON.D ONE
+
+# the exim command to run
+# if empty, it will use the one found in the system path
+#exim_command=
+
+# the data collection frequency
+# if unset, will inherit the netdata update frequency
+#exim_update_every=5
+
+# the charts priority on the dashboard
+#exim_priority=60000
--- /dev/null
+# no need for shebang - this file is loaded from charts.d.plugin
+
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+
+# THIS PLUGIN IS DEPRECATED
+# USE THE PYTHON.D ONE
+
+#hddtemp_host="localhost"
+#hddtemp_port="7634"
+
+# the data collection frequency
+# if unset, will inherit the netdata update frequency
+#hddtemp_update_every=3
+
+# the charts priority on the dashboard
+#hddtemp_priority=90000
+
--- /dev/null
+# no need for shebang - this file is loaded from charts.d.plugin
+
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+
+# THIS PLUGIN IS DEPRECATED
+# netdata can collect this metric already
+
+#load_average_enabled=0
+
+# the data collection frequency
+# if unset, will inherit the netdata update frequency
+#load_average_update_every=5
+
+# the charts priority on the dashboard
+#load_priority=100
--- /dev/null
+# no need for shebang - this file is loaded from charts.d.plugin
+
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+
+# THIS PLUGIN IS DEPRECATED
+# app.plugin can do better
+
+#mem_apps_apps=
+
+# the data collection frequency
+# if unset, will inherit the netdata update frequency
+#mem_apps_update_every=2
--- /dev/null
+# no need for shebang - this file is loaded from charts.d.plugin
+
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+
+# THIS PLUGIN IS DEPRECATED
+# USE THE PYTHON.D ONE
+
+#mysql_cmds[name]=""
+#mysql_opts[name]=""
+
+# the data collection frequency
+# if unset, will inherit the netdata update frequency
+#mysql_update_every=2
+
+# the charts priority on the dashboard
+#mysql_priority=60000
--- /dev/null
+# no need for shebang - this file is loaded from charts.d.plugin
+
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+
+# THIS PLUGIN IS DEPRECATED
+# USE THE PYTHON.D ONE
+
+#nginx_url="http://127.0.0.1:80/stub_status"
+#nginx_curl_opts=""
+
+# the data collection frequency
+# if unset, will inherit the netdata update frequency
+#nginx_update_every=
+
+# the charts priority on the dashboard
+#nginx_priority=60000
--- /dev/null
+# no need for shebang - this file is loaded from charts.d.plugin
+
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+
+# a space separated list of UPS names
+# if empty, the list returned by 'upsc -l' will be used
+#nut_ups=
+
+# how much time in seconds, to wait for nut to respond
+#nut_timeout=2
+
+# the data collection frequency
+# if unset, will inherit the netdata update frequency
+#nut_update_every=2
+
+# the charts priority on the dashboard
+#nut_priority=90000
--- /dev/null
+# no need for shebang - this file is loaded from charts.d.plugin
+
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+
+#opensips_opts="fifo get_statistics all"
+#opensips_cmd=
+#opensips_timeout=2
+
+# the data collection frequency
+# if unset, will inherit the netdata update frequency
+#opensips_update_every=5
+
+# the charts priority on the dashboard
+#opensips_priority=80000
--- /dev/null
+# no need for shebang - this file is loaded from charts.d.plugin
+
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+
+# THIS PLUGIN IS DEPRECATED
+# USE THE PYTHON.D ONE
+
+# first, you need open php-fpm status in php-fpm.conf
+# second, you need add status location in nginx.conf
+# you can see, https://easyengine.io/tutorials/php/fpm-status-page/
+#phpfpm_urls[name]=""
+#phpfpm_curl_opts[name]=""
+
+# the data collection frequency
+# if unset, will inherit the netdata update frequency
+#phpfpm_update_every=
+
+# the charts priority on the dashboard
+#phpfpm_priority=60000
--- /dev/null
+# no need for shebang - this file is loaded from charts.d.plugin
+
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+
+# THIS PLUGIN IS DEPRECATED
+# USE THE PYTHON.D ONE
+
+# the postqueue command
+# if empty, it will use the one found in the system path
+#postfix_postqueue=
+
+# the data collection frequency
+# if unset, will inherit the netdata update frequency
+#postfix_update_every=15
+
+# the charts priority on the dashboard
+#postfix_priority=60000
--- /dev/null
+# no need for shebang - this file is loaded from charts.d.plugin
+
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+
+# THIS PLUGIN IS DEPRECATED
+# USE THE PYTHON.D ONE
+
+# the directory the kernel keeps sensor data
+#sensors_sys_dir="/sys/devices"
+
+# how deep in the tree to check for sensor data
+#sensors_sys_depth=10
+
+# if set to 1, the script will overwrite internal
+# script functions with code generated ones
+# leave to 1, is faster
+#sensors_source_update=1
+
+# the data collection frequency
+# if unset, will inherit the netdata update frequency
+#sensors_update_every=
+
+# the charts priority on the dashboard
+#sensors_priority=90000
--- /dev/null
+# no need for shebang - this file is loaded from charts.d.plugin
+
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+
+# THIS PLUGIN IS DEPRECATED
+# USE THE PYTHON.D ONE
+
+#squid_host=
+#squid_port=
+#squid_url=
+#squid_timeout=2
+
+# the data collection frequency
+# if unset, will inherit the netdata update frequency
+#squid_update_every=2
+
+# the charts priority on the dashboard
+#squid_priority=60000
--- /dev/null
+# no need for shebang - this file is loaded from charts.d.plugin
+
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+
+# THIS PLUGIN IS DEPRECATED
+# USE THE PYTHON.D ONE
+
+# the URL to download tomcat status info
+# usually http://localhost:8080/manager/status?XML=true
+#tomcat_url=""
+#tomcat_curl_opts=""
+
+# set tomcat username/password here
+#tomcat_user=""
+#tomcat_password=""
+
+# the data collection frequency
+# if unset, will inherit the netdata update frequency
+#tomcat_update_every=1
+
+# the charts priority on the dashboard
+#tomcat_priority=60000
+
+# convert tomcat floating point values
+# to integer using this multiplier
+# this only affects precision - the values
+# will be in the proper units
+#tomcat_decimal_detail=1000000
+
+# used by volume chart to convert bytes to KB
+#tomcat_decimal_KB_detail=1000
# pass: 'password' # the mysql password to use
#
+# ----------------------------------------------------------------------
+# mySQL CONFIGURATION
+#
+# netdata does not need any privilege - only the ability to connect
+# to the mysql server (netdata will not be able to see any data).
+#
+# Execute these commands to give the local user 'netdata' the ability
+# to connect to the mysql server on localhost, without a password:
+#
+# > create user 'netdata'@'localhost';
+# > grant usage on *.* to 'netdata'@'localhost' with grant option;
+# > flush privileges;
+#
+# with the above statements, netdata will be able to gather mysql
+# statistics, without the ability to see or alter any data or affect
+# mysql operation in any way. No change is required below.
+
# ----------------------------------------------------------------------
# AUTO-DETECTION JOBS
# only one of them will run (they have the same name)
name : 'local'
'my.cnf' : '/etc/mysql/my.cnf'
+debiancnf:
+ name : 'local'
+ 'my.cnf' : '/etc/mysql/debian.cnf'
+
socket1:
name : 'local'
# user : ''
['0c5e0fa364d7bdf7c16e8459a0544572']='health.d/netfilter.conf'
['0cd4e1fb57497e4d4c2451a9e58f724d']='python.d/redis.conf'
['0e59bc11d0a869ea0247c04c08c8d72e']='python.d/ipfs.conf'
+ ['0ef8af1f358741afa7fd5d0ffabefaac']='charts.d/mysql.conf'
+ ['10c3b525850a1cb9de760a8ee96fbc6e']='charts.d/opensips.conf'
['13141998a5d71308d9c119834c27bfd3']='python.d.conf'
['142a5b693d34b0308bb0b8aec71fad79']='python.d/postfix.conf'
+ ['14783e051650442ec9e2ed38d81d667e']='charts.d/exim.conf'
['15d8401b56a74120f9f832873ec9c578']='health.d/postgres.conf'
['15e32114994b92be7853b88091e7c6fb']='python.d/exim.conf'
['174c21a6ce5de97bda83d502aa47a9f8']='health.d/apache.conf'
['23ae815aefa221b1929f96752a1f7556']='health.d/squid.conf'
['2472e49550326f7142e2c425ccbca005']='health.d/softnet.conf'
['254de8ec49602bea2da3631676d7cfec']='health.d/cpu.conf'
+ ['256a7f06f7e579a61752fc64418cffe5']='charts.d/nut.conf'
+ ['262f98b3d88b98978cb08d566ce85a9d']='charts.d/squid.conf'
['2827de41cf34a91b7a8e4d8724f59668']='health.d/net.conf'
['28df44a90e8ea4c6156314c03e88bf44']='health.d/softnet.conf'
['297160ae7ee01a547ed14f857b4f2c8d']='health.d/memcached.conf'
['3848172053221b95279ba9bf789cd4e0']='health.d/apache.conf'
['3866efafd38e161136428d0f818cac43']='health.d/net.conf'
['38d1bf04fe9901481dd6febcc0404a86']='python.d.conf'
+ ['39304b2570611c3acb35b72762b46778']='charts.d/sensors.conf'
['39571e9fad9b759200c5d5b2ee13feb4']='python.d/redis.conf'
['39f9422b0f0c3eec11a31aff79d89514']='health.d/retroshare.conf'
['3af522d65b50a5e447607ffb28c81ff5']='apps_groups.conf'
['42ad0e70b1365b6e7244cc305dbaa529']='health_alarm_notify.conf'
['42bf1c7c64ed77038a0aa094d792a9e2']='python.d/mysql.conf'
['43ebb7f224c3b232d8ad044d7e9508b6']='health.d/net.conf'
+ ['444e20cf75e2cd019e8d412d5d1f4a7f']='charts.d/cpu_apps.conf'
['450667c552ab7a7d8d4a2c214fdacca5']='health.d/entropy.conf'
['45a77ac36ba9f1898144b902de17204b']='health.d/memcached.conf'
['46798cda21e1a5faa769abf4e5d27c48']='health.d/disks.conf'
['46ef6c1b638e40a7dfd62defdc5f99a3']='health.d/retroshare.conf'
['47180421d580baeaedf8c0ef3d647fb5']='python.d/hddtemp.conf'
['48195c5c8c0476a49b714b4c76bdb570']='python.d/squid.conf'
+ ['48eef63bcf744bae114b502b6dacb4a1']='charts.d/phpfpm.conf'
['4a448831776de8acf2e0bdc4cc994cb4']='apps_groups.conf'
['4b775fb31342f1478b3773d041a72911']='python.d.conf'
['4ccb06fff1ce06dc5bc80e0a9f568f6e']='charts.d.conf'
['5e6fd588ef6934cf04ddb5e662aa02ea']='health.d/postgres.conf'
['5eb670b6fe39da5fec2523d910b0dd1e']='health.d/cpu.conf'
['5ff1bcaa58695754e2f6980bfe19f579']='health.d/entropy.conf'
+ ['61b7ed36f35e7bd930f5f7f91694a112']='charts.d/postfix.conf'
['621f10b257a11add5ff5aff41e9662e3']='health.d/memcached.conf'
['623771eecb3c277fc728b5304793f93b']='health.d/cpu.conf'
['636d032928ea0f4741eab264fb49c099']='apps_groups.conf'
['647361e99b5f4e0d73470c569bb9461c']='apps_groups.conf'
['64ac37868097a462e5ee6905c350267e']='python.d/postgres.conf'
['64c48f9726ab987baec9c617a9fef7a6']='health.d/nginx.conf'
+ ['65c6933a17fb6b7f8e6baeab73431c17']='charts.d/apcupsd.conf'
['6608c6546b3c6bde084fc1d34b1163c1']='health.d/retroshare.conf'
['669ebef43ee341f6889d382e86d0e200']='health.d/named.conf'
['66dfe138058ca26a31a118007eb31f35']='health.d/nginx.conf'
+ ['6814b9bc84483db428f6a479ba221855']='python.d/mysql.conf'
['6a18f61a595c0d48c3363bcc0dbfa6b9']='health_alarm_notify.conf'
['6a47af861ad3dd112124c37fbf09672b']='apps_groups.conf'
['6b39de5d85db45115db236347a6896d4']='health.d/named.conf'
['7454ed74511d7b9819dfe173f9020786']='python.d/redis.conf'
['749fe31362969d75f1ea66d15231d98d']='python.d/retroshare.conf'
['7596ae54d46ce199ac599429ef753caf']='health.d/cpu.conf'
+ ['75a9c4b0b1c73956df55585eb0619f6c']='charts.d/ap.conf'
['777f4da70f461ef675bde07fb3644312']='python.d/redis.conf'
+ ['7808ba2ca26bd0642270740cf6a8ee59']='charts.d/mem_apps.conf'
['7830066c46a7e5f9682b8d3f4566b4e5']='python.d/cpufreq.conf'
['78bb08809dffcb62e9bc493840f9c039']='python.d/squid.conf'
['78e0065738394f5bf15023f41d66ed4b']='python.d/squid.conf'
['842b1ad5b89bfa5f421d9c5b72e001a4']='health.d/apache.conf'
['845023f9b4a526aa0e6493756dbe6034']='health.d/squid.conf'
['846ce94bfeeb90c0dc6a89e8d25f1a68']='health.d/named.conf'
+ ['8490f690d97adacc4e2096df82e7e8a5']='charts.d/cpufreq.conf'
['8810140ce9c09af1d18b9602c4003904']='health_alarm_notify.conf'
['88f77865f75c9fb61c97d700bd4561ee']='python.d/mysql.conf'
['8989b5e2f4ef9cd278ef58be0fae4074']='health.d/disks.conf'
['bb51112d01ff20053196a57632df8962']='apps_groups.conf'
['bba2f3886587f137ea08a6e63dd3d376']='python.d.conf'
['bda5517ea01640cfdfa0a27549619d6a']='health.d/memcached.conf'
+ ['c004430f55310ae9ed489c4905ed02cb']='charts.d/apache.conf'
['c080e006f544c949baca33cc24a9c126']='health_alarm_notify.conf'
['c1a7e634b5b8aad523a0d115a93379cd']='health.d/memcached.conf'
['c3296c08260bcd556e74711c820817be']='health.d/cpu.conf'
['ca249db7a0637d55abb938d969f9b486']='python.d/postfix.conf'
['cb178b15427274d7def5b14bc4c09441']='health.d/net.conf'
['cb60badf376d246ad8ec9d3f524db430']='health.d/disks.conf'
+ ['cc4d31a0d1ff9c339892c1f8a0c5fcd3']='charts.d/load_average.conf'
['ccde91d209aeb02c4a6be0e43a8d92b3']='health.d/apache.conf'
['cd08e5534c94bf1f2cd28396c76b8bbc']='health.d/ram.conf'
['ce2e8768964a936f58c4c2144aee8a01']='health_alarm_notify.conf'
['eb5168f0b516bc982aac45e59da6e52e']='health.d/nginx.conf'
['eb748d6fb69d11b0d29c5794657e206c']='health.d/qos.conf'
['ebd0612ccc5807524ebb2b647e3e56c9']='apps_groups.conf'
+ ['ecd3aa97e2581f88eb466d6612690ef2']='charts.d/nginx.conf'
['ee5343881744e6a97e6ee5cdd329cfb8']='health.d/retroshare.conf'
['ef9916ea144878a9f37cbb6b1b29da10']='health.d/squid.conf'
['f2f1b8656f5011e965ac45b818cf668d']='apps_groups.conf'
+ ['f42df9f13abfae2426519c6728b34882']='charts.d/example.conf'
+ ['f66e5236ba1245bb2e5fd99191f114c6']='charts.d/hddtemp.conf'
['f6c6656f900ff52d159dca12d624016a']='python.d/postgres.conf'
['f7a99e94231beda85c6254912d8d31c1']='python.d/tomcat.conf'
['f82924563e41d99cdae5431f0af69155']='python.d.conf'
['fa4396513b358d6ec6a7f5bfb08439b8']='health.d/net.conf'
['fd3164e6e8cb6726706267eae49aa082']='health_alarm_notify.conf'
['fdd11640ba626cc2064c2fe3ea3eee4c']='health.d/cpu.conf'
+ ['fde44f62c8d7e52f09705cd273fae6b1']='charts.d/tomcat.conf'
['fdea185e0e52b459b48852aa37f20e0f']='apps_groups.conf'
['fe478efe2e721724edb1fe2ef1addf93']='health_alarm_notify.conf'
['feb8bcf828aa2529a7ee4a140feeb12d']='health.d/net.conf'
fi
LC_ALL=C
-umask 022
+umask 007
# Be nice on production environments
renice 19 $$ >/dev/null 2>/dev/null
fi
done
+echo >&2 "Fixing permissions ..."
+run find ./system/ -type f -a \! -name \*.in -a \! -name Makefile\* -a \! -name \*.conf -exec chmod 755 {} \;
+
NETDATA_ADDED_TO_DOCKER=0
if [ ${UID} -eq 0 ]
then
echo "${value}"
}
-# user
-defuser="netdata"
-[ ! "${UID}" = "0" ] && defuser="${USER}"
-NETDATA_USER="$( config_option "run as user" "${defuser}" )"
+# the user netdata will run as
+if [ "${UID}" = "0" ]
+ then
+ NETDATA_USER="$( config_option "run as user" "netdata" )"
+else
+ NETDATA_USER="${USER}"
+fi
-NETDATA_WEB_USER="$( config_option "web files owner" "${defuser}" )"
+# the owners of the web files
+NETDATA_WEB_USER="$( config_option "web files owner" "${NETDATA_USER}" )"
NETDATA_WEB_GROUP="$( config_option "web files group" "${NETDATA_WEB_USER}" )"
# debug flags
-defdebug=0
-NETDATA_DEBUG="$( config_option "debug flags" ${defdebug} )"
+NETDATA_DEBUG="$( config_option "debug flags" 0 )"
# port
defport=19999
echo >&2
echo >&2 "Fixing directories (user: ${NETDATA_USER})..."
-for x in "${NETDATA_WEB_DIR}" "${NETDATA_CONF_DIR}" "${NETDATA_CACHE_DIR}" "${NETDATA_LOG_DIR}" "${NETDATA_LIB_DIR}" "${NETDATA_CONF_DIR}/python.d" "${NETDATA_CONF_DIR}/charts.d" "${NETDATA_CONF_DIR}/node.d"
+
+# --- conf dir ----
+
+for x in "python.d" "charts.d" "node.d"
do
- if [ ! -d "${x}" ]
+ if [ ! -d "${NETDATA_CONF_DIR}/${x}" ]
then
- echo >&2 "Creating directory '${x}'"
- run mkdir -p "${x}" || exit 1
+ echo >&2 "Creating directory '${NETDATA_CONF_DIR}/${x}'"
+ run mkdir -p "${NETDATA_CONF_DIR}/${x}" || exit 1
fi
+done
+run chown --recursive "${NETDATA_USER}:${NETDATA_USER}" "${NETDATA_CONF_DIR}"
+run find "${NETDATA_CONF_DIR}" -type f -exec chmod 0660 {} \;
+run find "${NETDATA_CONF_DIR}" -type d -exec chmod 0775 {} \;
+
+# --- web dir ----
+
+if [ ! -d "${NETDATA_WEB_DIR}" ]
+ then
+ echo >&2 "Creating directory '${NETDATA_WEB_DIR}'"
+ run mkdir -p "${NETDATA_WEB_DIR}" || exit 1
+fi
+run chown --recursive "${NETDATA_WEB_USER}:${NETDATA_WEB_GROUP}" "${NETDATA_WEB_DIR}"
+run find "${NETDATA_WEB_DIR}" -type f -exec chmod 0664 {} \;
+run find "${NETDATA_WEB_DIR}" -type d -exec chmod 0775 {} \;
+
+# --- data dirs ----
- if [ ${UID} -eq 0 ]
+for x in "${NETDATA_LIB_DIR}" "${NETDATA_CACHE_DIR}" "${NETDATA_LOG_DIR}"
+do
+ if [ ! -d "${x}" ]
then
- if [ "${x}" = "${NETDATA_WEB_DIR}" ]
- then
- run chown -R "${NETDATA_WEB_USER}:${NETDATA_WEB_GROUP}" "${x}" || echo >&2 "WARNING: Cannot change the ownership of the files in directory ${x} to ${NETDATA_WEB_USER}:${NETDATA_WEB_GROUP}..."
- else
- run chown -R "${NETDATA_USER}:${NETDATA_USER}" "${x}" || echo >&2 "WARNING: Cannot change the ownership of the files in directory ${x} to ${NETDATA_USER}..."
- fi
+ echo >&2 "Creating directory '${x}'"
+ run mkdir -p "${x}" || exit 1
fi
- run chmod 0755 "${x}" || echo >&2 "WARNING: Cannot change the permissions of the directory ${x} to 0755..."
+ run chown --recursive "${NETDATA_USER}:${NETDATA_USER}" "${x}"
+ #run find "${x}" -type f -exec chmod 0660 {} \;
+ #run find "${x}" -type d -exec chmod 0770 {} \;
done
+# --- plugins ----
+
if [ ${UID} -eq 0 ]
then
- run chown root "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
- run chmod 0755 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
+ run chown --recursive root:root "${NETDATA_PREFIX}/usr/libexec/netdata"
+ run find "${NETDATA_PREFIX}/usr/libexec/netdata" -type d -exec chmod 0755 {} \;
+ run find "${NETDATA_PREFIX}/usr/libexec/netdata" -type f -exec chmod 0644 {} \;
+ run find "${NETDATA_PREFIX}/usr/libexec/netdata" -type f -a -name \*.plugin -exec chmod 0755 {} \;
+ run find "${NETDATA_PREFIX}/usr/libexec/netdata" -type f -a -name \*.sh -exec chmod 0755 {} \;
+
run setcap cap_dac_read_search,cap_sys_ptrace+ep "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
if [ $? -ne 0 ]
then
run chown root "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
run chmod 4755 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
fi
+else
+ run chown --recursive "${NETDATA_USER}:${NETDATA_USER}" "${NETDATA_PREFIX}/usr/libexec/netdata"
+ run find "${NETDATA_PREFIX}/usr/libexec/netdata" -type f -exec chmod 0755 {} \;
+ run find "${NETDATA_PREFIX}/usr/libexec/netdata" -type d -exec chmod 0755 {} \;
fi
# -----------------------------------------------------------------------------
then
chown "${NETDATA_USER}" "${NETDATA_PREFIX}/etc/netdata/netdata.conf"
fi
- chmod 0664 "${NETDATA_PREFIX}/etc/netdata/netdata.conf"
+ chmod 0644 "${NETDATA_PREFIX}/etc/netdata/netdata.conf"
fi
banner "is installed now!"
echo >&2 " enjoy real-time performance and health monitoring..."
},
zeropad2: function(s) {
- if(typeof s !== 'string')
- s = s.toString();
-
- switch(s.length) {
- case 0: return '00';
- case 1: return '0' + s;
- default: return s;
- }
+ return ("00" + s).slice(-2);
},
logdate: function(d) {
if(typeof service === 'undefined')
service = {};
- var now = new Date().getTime();
+ var now = Date.now();
service._current_chart = null; // the current chart we work on
service._queue = ''; // data to be sent to netdata
if(this.added !== true) {
this.added = true;
- var now = new Date().getTime();
+ var now = Date.now();
this.next_run = now - (now % (service.update_every * 1000)) + (service.update_every * 1000);
netdata.services.push(this);
this.module.active++;
this.running = true;
- this.started = new Date().getTime();
+ this.started = Date.now();
this.updates++;
if(netdata.options.DEBUG === true)
netdata.debug(this.module.name + ': ' + this.name + ': making ' + this.processor.name + ' request: ' + netdata.stringify(this));
this.processor.process(this, function(response) {
- service.ended = new Date().getTime();
+ service.ended = Date.now();
service.duration = service.ended - service.started;
if(typeof response === 'undefined')
runAllServices: function() {
if(netdata.options.DEBUG === true) netdata.debug('runAllServices()');
- var now = new Date().getTime();
+ var now = Date.now();
var len = netdata.services.length;
while(len--) {
var service = netdata.services[len];
service.update();
- now = new Date().getTime();
+ now = Date.now();
service.next_run = now - (now % (service.update_every * 1000)) + (service.update_every * 1000);
}
}
// Set new file permissions
- umask(0002);
+ umask(0007);
// adjust my Out-Of-Memory score
oom_score_adj(1000);
#include "common.h"
-void rrd_stats_api_v1_chart(RRDSET *st, BUFFER *wb)
+void rrd_stats_api_v1_chart_with_data(RRDSET *st, BUFFER *wb, size_t *dimensions_count, size_t *memory_used)
{
pthread_rwlock_rdlock(&st->rwlock);
unsigned long memory = st->memsize;
- int c = 0;
+ size_t dimensions = 0;
RRDDIM *rd;
for(rd = st->dimensions; rd ; rd = rd->next) {
if(rd->flags & RRDDIM_FLAG_HIDDEN) continue;
buffer_sprintf(wb,
"%s"
"\t\t\t\t\"%s\": { \"name\": \"%s\" }"
- , c?",\n":""
+ , dimensions?",\n":""
, rd->id
, rd->name
);
- c++;
+ dimensions++;
}
+ if(dimensions_count) *dimensions_count += dimensions;
+ if(memory_used) *memory_used += memory;
+
buffer_strcat(wb, "\n\t\t\t},\n\t\t\t\"green\": ");
buffer_rrd_value(wb, st->green);
buffer_strcat(wb, ",\n\t\t\t\"red\": ");
pthread_rwlock_unlock(&st->rwlock);
}
+void rrd_stats_api_v1_chart(RRDSET *st, BUFFER *wb) {
+ rrd_stats_api_v1_chart_with_data(st, wb, NULL, NULL);
+}
+
void rrd_stats_api_v1_charts(BUFFER *wb)
{
- long c;
+ size_t c, dimensions = 0, memory = 0, alarms = 0;
RRDSET *st;
buffer_sprintf(wb, "{\n"
buffer_strcat(wb, "\n\t\t\"");
buffer_strcat(wb, st->id);
buffer_strcat(wb, "\": ");
- rrd_stats_api_v1_chart(st, wb);
+ rrd_stats_api_v1_chart_with_data(st, wb, &dimensions, &memory);
c++;
}
}
+
+ RRDCALC *rc;
+ for(rc = localhost.alarms; rc ; rc = rc->next) {
+ alarms++;
+ }
pthread_rwlock_unlock(&localhost.rrdset_root_rwlock);
- buffer_strcat(wb, "\n\t}\n}\n");
+ buffer_sprintf(wb, "\n\t}"
+ ",\n\t\"charts_count\": %zu"
+ ",\n\t\"dimensions_count\": %zu"
+ ",\n\t\"alarms_count\": %zu"
+ ",\n\t\"rrd_memory_bytes\": %zu"
+ "\n}\n"
+ , c
+ , dimensions
+ , alarms
+ , memory
+ );
}
int listen_port = LISTEN_PORT;
int web_server_mode = WEB_SERVER_MODE_MULTI_THREADED;
+static int shown_server_socket_error = 0;
+
#ifdef NETDATA_INTERNAL_CHECKS
static void log_allocations(void)
{
sock = socket(AF_INET, SOCK_STREAM, 0);
if(sock < 0) {
error("IPv4 socket() on ip '%s' port %d failed.", ip, port);
+ shown_server_socket_error = 1;
return -1;
}
int ret = inet_pton(AF_INET, ip, (void *)&name.sin_addr.s_addr);
if(ret != 1) {
error("Failed to convert IP '%s' to a valid IPv4 address.", ip);
+ shown_server_socket_error = 1;
close(sock);
return -1;
}
if(bind (sock, (struct sockaddr *) &name, sizeof (name)) < 0) {
close(sock);
error("IPv4 bind() on ip '%s' port %d failed.", ip, port);
+ shown_server_socket_error = 1;
return -1;
}
if(listen(sock, listen_backlog) < 0) {
close(sock);
- fatal("IPv4 listen() on ip '%s' port %d failed.", ip, port);
+ error("IPv4 listen() on ip '%s' port %d failed.", ip, port);
+ shown_server_socket_error = 1;
return -1;
}
sock = socket(AF_INET6, SOCK_STREAM, 0);
if (sock < 0) {
error("IPv6 socket() on ip '%s' port %d failed.", ip, port);
+ shown_server_socket_error = 1;
return -1;
}
int ret = inet_pton(AF_INET6, ip, (void *)&name.sin6_addr.s6_addr);
if(ret != 1) {
error("Failed to convert IP '%s' to a valid IPv6 address.", ip);
+ shown_server_socket_error = 1;
close(sock);
return -1;
}
if (bind (sock, (struct sockaddr *) &name, sizeof (name)) < 0) {
close(sock);
error("IPv6 bind() on ip '%s' port %d failed.", ip, port);
+ shown_server_socket_error = 1;
return -1;
}
if (listen(sock, listen_backlog) < 0) {
close(sock);
error("IPv6 listen() on ip '%s' port %d failed.", ip, port);
+ shown_server_socket_error = 1;
return -1;
}
static inline int add_listen_socket(int fd, const char *ip, int port) {
if(listen_fds_count >= MAX_LISTEN_FDS) {
error("Too many listening sockets. Failed to add listening socket at ip '%s' port %d", ip, port);
+ shown_server_socket_error = 1;
close(fd);
return -1;
}
}
int create_listen_sockets(void) {
+ shown_server_socket_error = 0;
+
listen_backlog = (int) config_get_number("global", "http port listen backlog", LISTEN_BACKLOG);
if(config_exists("global", "bind socket to IP") && !config_exists("global", "bind to"))
if(!listen_fds_count)
fatal("Cannot listen on any socket. Exiting...");
+ else if(shown_server_socket_error) {
+ size_t i;
+ for(i = 0; i < listen_fds_count ;i++)
+ info("Listen socket %s opened.", listen_fds_names[i]);
+ }
return (int)listen_fds_count;
}
dashboard_css: NETDATA.serverDefault + 'dashboard.css?v20161002-1',
background: '#FFFFFF',
foreground: '#000000',
- grid: '#DDDDDD',
- axis: '#CCCCCC',
+ grid: '#F0F0F0',
+ axis: '#F0F0F0',
colors: [ '#3366CC', '#DC3912', '#109618', '#FF9900', '#990099', '#DD4477',
'#3B3EAC', '#66AA00', '#0099C6', '#B82E2E', '#AAAA11', '#5574A6',
'#994499', '#22AA99', '#6633CC', '#E67300', '#316395', '#8B0707',
// rendering the chart that is panned or zoomed).
// Used with .current.global_pan_sync_time
- last_resized: new Date().getTime(), // the timestamp of the last resize request
+ last_resized: Date.now(), // the timestamp of the last resize request
last_page_scroll: 0, // the timestamp the last time the page was scrolled
console.log('welcome to NETDATA');
NETDATA.onresize = function() {
- NETDATA.options.last_resized = new Date().getTime();
+ NETDATA.options.last_resized = Date.now();
NETDATA.onscroll();
};
NETDATA.onscroll_updater = function() {
NETDATA.onscroll_updater_running = true;
NETDATA.onscroll_updater_count++;
- var start = new Date().getTime();
+ var start = Date.now();
var targets = NETDATA.options.targets;
var len = targets.length;
targets[len].isVisible();
}
- var end = new Date().getTime();
+ var end = Date.now();
// console.log('scroll No ' + NETDATA.onscroll_updater_count + ' calculation took ' + (end - start).toString() + ' ms');
if(NETDATA.options.current.async_on_scroll === false) {
NETDATA.onscroll = function() {
// console.log('onscroll');
- NETDATA.options.last_page_scroll = new Date().getTime();
+ NETDATA.options.last_page_scroll = Date.now();
NETDATA.options.auto_refresher_stop_until = 0;
if(NETDATA.options.targets === null) return;
NETDATA.error = function(code, msg) {
NETDATA.errorLast.code = code;
NETDATA.errorLast.message = msg;
- NETDATA.errorLast.datetime = new Date().getTime();
+ NETDATA.errorLast.datetime = Date.now();
console.log("ERROR " + code + ": " + NETDATA.errorCodes[code].message + ": " + msg);
if(this.master !== null && this.master !== state)
this.master.resetChart(true, true);
- var now = new Date().getTime();
+ var now = Date.now();
this.master = state;
this.seq = now;
this.force_after_ms = after;
if(NETDATA.chartDefaults.min_width !== null)
$(that.element).css('min-width', NETDATA.chartDefaults.min_width);
- that.tm.last_dom_created = new Date().getTime();
+ that.tm.last_dom_created = Date.now();
showLoading();
};
that.data_before = 0; // milliseconds - the last timestamp of the data
that.data_update_every = 0; // milliseconds - the frequency to update the data
- that.tm.last_initialized = new Date().getTime();
+ that.tm.last_initialized = Date.now();
createDOM();
that.setMode('auto');
showRendering();
that.element_chart.style.display = 'none';
if(that.element_legend !== null) that.element_legend.style.display = 'none';
- that.tm.last_hidden = new Date().getTime();
+ that.tm.last_hidden = Date.now();
// de-allocate data
// This works, but I not sure there are no corner cases somewhere
init();
}
else {
- that.tm.last_unhidden = new Date().getTime();
+ that.tm.last_unhidden = Date.now();
that.element_chart.style.display = '';
if(that.element_legend !== null) that.element_legend.style.display = '';
resizeChart();
maxMessageFontSize();
}
- that.tm.last_resized = new Date().getTime();
+ that.tm.last_resized = Date.now();
}
};
if(that.settings_id !== null)
NETDATA.localStorageSet('chart_heights.' + that.settings_id, h);
- var now = new Date().getTime();
+ var now = Date.now();
NETDATA.options.last_page_scroll = now;
NETDATA.options.auto_refresher_stop_until = now + NETDATA.options.current.stop_updates_while_resizing;
this.event_resize.chart_last_w = this.element.clientWidth;
this.event_resize.chart_last_h = this.element.clientHeight;
- var now = new Date().getTime();
+ var now = Date.now();
if(now - this.event_resize.last <= NETDATA.options.current.double_click_speed) {
// double click / double tap event
var noDataToShow = function() {
showMessageIcon('<i class="fa fa-warning"></i> empty');
that.legendUpdateDOM();
- that.tm.last_autorefreshed = new Date().getTime();
+ that.tm.last_autorefreshed = Date.now();
// that.data_update_every = 30 * 1000;
//that.element_chart.style.display = 'none';
//if(that.element_legend !== null) that.element_legend.style.display = 'none';
this.current.force_before_ms = null;
this.current.force_after_ms = null;
- this.tm.last_mode_switch = new Date().getTime();
+ this.tm.last_mode_switch = Date.now();
};
// ----------------------------------------------------------------------------------------------------------------
return;
if(typeof ms === 'number')
- NETDATA.globalSelectionSync.dont_sync_before = new Date().getTime() + ms;
+ NETDATA.globalSelectionSync.dont_sync_before = Date.now() + ms;
else
- NETDATA.globalSelectionSync.dont_sync_before = new Date().getTime() + NETDATA.options.current.sync_selection_delay;
+ NETDATA.globalSelectionSync.dont_sync_before = Date.now() + NETDATA.options.current.sync_selection_delay;
};
// can we globally apply selection sync?
if(NETDATA.options.current.sync_selection === false)
return false;
- if(NETDATA.globalSelectionSync.dont_sync_before > new Date().getTime())
+ if(NETDATA.globalSelectionSync.dont_sync_before > Date.now())
return false;
return true;
if(this.debug === true)
this.log(logme + 'ACCEPTING UPDATE: current/min duration: ' + (current_duration / 1000).toString() + '/' + (this.fixed_min_duration / 1000).toString() + ', wanted duration: ' + (wanted_duration / 1000).toString() + ', duration diff: ' + (Math.round(Math.abs(current_duration - wanted_duration) / 1000)).toString() + ', movement: ' + (movement / 1000).toString() + ', tolerance: ' + (tolerance / 1000).toString() + ', returning: ' + ret);
- this.current.force_update_at = new Date().getTime() + NETDATA.options.current.pan_and_zoom_delay;
+ this.current.force_update_at = Date.now() + NETDATA.options.current.pan_and_zoom_delay;
this.current.force_after_ms = after;
this.current.force_before_ms = before;
NETDATA.globalPanAndZoom.setMaster(this, after, before);
this.updates_since_last_unhide++;
this.updates_since_last_creation++;
- var started = new Date().getTime();
+ var started = Date.now();
// if the result is JSON, find the latest update-every
this.data_update_every = data.view_update_every * 1000;
NETDATA.globalSelectionSync.stop();
// update the performance counters
- var now = new Date().getTime();
+ var now = Date.now();
this.tm.last_updated = now;
// don't update last_autorefreshed if this chart is
if(nocache === false && this.tm.last_visible_check > NETDATA.options.last_page_scroll)
return this.___isVisible___;
- this.tm.last_visible_check = new Date().getTime();
+ this.tm.last_visible_check = Date.now();
var wh = window.innerHeight;
var x = this.element.getBoundingClientRect();
};
this.canBeAutoRefreshed = function() {
- var now = new Date().getTime();
+ var now = Date.now();
if(this.running === true) {
if(this.debug === true)
this.chart_url = chart.url;
this.data_update_every = chart.update_every * 1000;
this.data_points = Math.round(this.chartWidth() / this.chartPixelsPerPoint());
- this.tm.last_info_downloaded = new Date().getTime();
+ this.tm.last_info_downloaded = Date.now();
if(this.title === null)
this.title = chart.title;
};
NETDATA.parseDom = function(callback) {
- NETDATA.options.last_page_scroll = new Date().getTime();
+ NETDATA.options.last_page_scroll = Date.now();
NETDATA.options.updated_dom = false;
var targets = $('div[data-netdata]'); //.filter(':visible');
dygraph.updateOptions(options);
}
- state.dygraph_last_rendered = new Date().getTime();
+ state.dygraph_last_rendered = Date.now();
return true;
};
// the internal default of dygraphs
context.touchDirections = { x: true, y: false };
- state.dygraph_last_touch_start = new Date().getTime();
+ state.dygraph_last_touch_start = Date.now();
state.dygraph_last_touch_move = 0;
if(typeof event.touches[0].pageX === 'number')
state.dygraph_user_action = true;
Dygraph.defaultInteractionModel.touchmove(event, dygraph, context);
- state.dygraph_last_touch_move = new Date().getTime();
+ state.dygraph_last_touch_move = Date.now();
},
touchend: function(event, dygraph, context) {
if(NETDATA.options.debug.dygraph === true || state.debug === true)
}
// if it was double tap within double click time, reset the charts
- var now = new Date().getTime();
+ var now = Date.now();
if(typeof state.dygraph_last_touch_end !== 'undefined') {
if(state.dygraph_last_touch_move === 0) {
var dt = now - state.dygraph_last_touch_end;
state.dygraph_force_zoom = false;
state.dygraph_user_action = false;
- state.dygraph_last_rendered = new Date().getTime();
+ state.dygraph_last_rendered = Date.now();
if(typeof state.dygraph_instance.axes_[0].extremeRange !== 'undefined') {
state.__commonMin = self.data('common-min') || null;
NETDATA.registry.machines = {};
NETDATA.registry.machines_array = new Array();
- var now = new Date().getTime();
+ var now = Date.now();
var apu = person_urls;
var i = apu.length;
while(i--) {
html += mhead + shtml + '</div></div><hr role="separator"/>';
}
+ sidebar += '<li class="" style="padding-top:15px;"><a href="https://github.com/firehol/netdata/wiki/Add-more-charts-to-netdata" target="_blank"><i class="fa fa-plus" aria-hidden="true"></i> add more charts</a></li>';
+ sidebar += '<li class=""><a href="https://github.com/firehol/netdata/wiki/Add-more-alarms-to-netdata" target="_blank"><i class="fa fa-plus" aria-hidden="true"></i> add more alarms</a></li>';
+ sidebar += '<li class="" style="margin:20px;color:#666;"><small>netdata on <b>' + data.hostname.toString() + '</b>, collects every ' + ((data.update_every == 1)?'second':data.update_every.toString() + ' seconds') + ' <b>' + data.dimensions_count.toLocaleString() + '</b> metrics, presented as <b>' + data.charts_count.toLocaleString() + '</b> charts and monitored by <b>' + data.alarms_count.toLocaleString() + '</b> alarms, using ' + Math.round(data.rrd_memory_bytes / 1024 / 1024).toLocaleString() + ' MB of memory for ' + Math.round(data.history / 3600).toLocaleString() + ' ' + ((data.history == 3600)?'hour':'hours').toString() + ' of real-time history.</small></li>';
sidebar += '</ul>';
div.innerHTML = html;
document.getElementById('sidebar').innerHTML = sidebar;
}
// find the proper family of each alarm
- var now = new Date().getTime();
+ var now = Date.now();
var x;
var count_active = 0;
var count_all = 0;
function notifyForUpdate(force) {
versionLog('<p>checking for updates...</p>');
- var now = new Date().getTime();
+ var now = Date.now();
if(typeof force === 'undefined' || force !== true) {
var last = loadLocalStorage('last_update_check');
</div>
</body>
</html>
-<script type="text/javascript" src="dashboard.js?v20161112-1"></script>
+<script type="text/javascript" src="dashboard.js?v20161126-1"></script>
}
// is it too soon for a refresh?
- var now = new Date().getTime();
+ var now = Date.now();
if((now - mainchart.hiddenchart.last_updated) < (mainchart.update_every * 10 * 1000) || (now - mainchart.hiddenchart.last_updated) < (mainchart.hiddenchart.group * mainchart.hiddenchart.update_every * 1000)) {
if(typeof doNext == "function") doNext();
return;
}
mainchart.dashboard.draw(mainchart.control_data);
- mainchart.hiddenchart.last_updated = new Date().getTime();
+ mainchart.hiddenchart.last_updated = Date.now();
mainchart.hiddenchart.refreshCount++;
})
.always(function() {
$('.global_play_button').button('play');
// check if the thread died due to a javascript error
- var now = new Date().getTime();
+ var now = Date.now();
if((now - last_refresh) > 60000) {
// it died or never started
//mylog('It seems the refresh thread died. Restarting it.');
return;
}
- var now = new Date().getTime();
+ var now = Date.now();
if(now - last_refresh > 60000) {
mylog('Refresh thread died. Restarting it.');
renderChartCallback();
// never call it directly, or new javascript threads will be spawn
var timeout = null;
function renderChartCallback() {
- last_refresh = new Date().getTime();
+ last_refresh = Date.now();
if(!page_is_visible) {
timeout = setTimeout(triggerRefresh, CHARTS_CHECK_NO_FOCUS);
}
if(last_user_scroll) {
- var now = new Date().getTime();
+ var now = Date.now();
if((now - last_user_scroll) >= CHARTS_SCROLL_IDLE) {
last_user_scroll = 0;
mylog('Scrolling: resuming refresh...');
//mylog('triggerRefresh()');
if(!page_is_visible || (refresh_mode == REFRESH_PAUSED && mode != MODE_MAIN)) {
- last_refresh = new Date().getTime();
+ last_refresh = Date.now();
timeout = setTimeout(triggerRefresh, CHARTS_REFRESH_IDLE);
return;
}
var height = TARGET_THUMB_GRAPH_HEIGHT;
window.onscroll = function (e) {
- last_user_scroll = new Date().getTime();
+ last_user_scroll = Date.now();
mylog('Scrolling: detected');
}
if(chart.chart && chart.chart.getSelection()[0]) return false;
// is it too soon for a refresh?
- var now = new Date().getTime();
+ var now = Date.now();
if((now - chart.last_updated) < (chart.group * chart.update_every * 1000)) return false;
// is the chart in the visible area?
if(chart.chart) {
chart.chart.draw(chart.datatable, chart.chartOptions);
chart.refreshCount++;
- chart.last_updated = new Date().getTime();
+ chart.last_updated = Date.now();
}
else console.log('Cannot create chart for ' + chart.url);
})
chart.chart = null;
chart.refreshCount = 0;
showChartIsLoading(chart.div, chart.name, chart.chartOptions.width, chart.chartOptions.height, "failed to refresh");
- chart.last_updated = new Date().getTime();
+ chart.last_updated = Date.now();
})
.always(function() {
if(typeof doNext == "function") doNext();
if(!divisor) divisor = 2;
- var before = c.before?c.before:new Date().getTime() / 1000;
+ var before = c.before?c.before:Date.now() / 1000;
var after = c.after?c.after:c.first_entry_t;
var dt = before - after;