diff options
-rw-r--r-- | ansible/playbook-test.yml | 2 | ||||
-rw-r--r-- | build/carbon.conf | 351 | ||||
-rw-r--r-- | build/storage-schemas.conf | 21 | ||||
-rw-r--r-- | build/test/gondul-graphite-test.Dockerfile | 2 | ||||
-rwxr-xr-x | collectors/ping.pl | 19 | ||||
-rw-r--r-- | extras/misc/varnish.vcl | 18 | ||||
-rwxr-xr-x | include/config.pm | 2 | ||||
-rw-r--r-- | web/js/nms-info-box.js | 25 |
8 files changed, 431 insertions, 9 deletions
diff --git a/ansible/playbook-test.yml b/ansible/playbook-test.yml index bf8a735..f9e19c1 100644 --- a/ansible/playbook-test.yml +++ b/ansible/playbook-test.yml @@ -16,7 +16,7 @@ ports: [] - name: "gondul-collector-test" volumes: [ "{{ pwd.stdout }}/:/opt/gondul" ] - links: [ "gondul-db-test:db" ] + links: [ "gondul-db-test:db", "gondul-graphite-test:graphite" ] ports: [] - name: "gondul-front-test" volumes: [ "{{ pwd.stdout }}/:/opt/gondul" ] diff --git a/build/carbon.conf b/build/carbon.conf new file mode 100644 index 0000000..e93ca58 --- /dev/null +++ b/build/carbon.conf @@ -0,0 +1,351 @@ +[cache] +# Configure carbon directories. +# +# OS environment variables can be used to tell carbon where graphite is +# installed, where to read configuration from and where to write data. +# +# GRAPHITE_ROOT - Root directory of the graphite installation. +# Defaults to ../ +# GRAPHITE_CONF_DIR - Configuration directory (where this file lives). +# Defaults to $GRAPHITE_ROOT/conf/ +# GRAPHITE_STORAGE_DIR - Storage directory for whipser/rrd/log/pid files. +# Defaults to $GRAPHITE_ROOT/storage/ +# +# To change other directory paths, add settings to this file. The following +# configuration variables are available with these default values: +# + +STORAGE_DIR = /var/lib/graphite/ +CONF_DIR = /etc/carbon/ +LOG_DIR = /var/log/carbon/ +PID_DIR = /var/run/ + +LOCAL_DATA_DIR = /var/lib/graphite/whisper/ + +# Enable daily log rotation. If disabled, a kill -HUP can be used after a manual rotate +ENABLE_LOGROTATION = False + +# Specify the user to drop privileges to +# If this is blank carbon runs as the user that invokes it +# This user must have write access to the local data directory +USER = _graphite +# +# NOTE: The above settings must be set under [relay] and [aggregator] +# to take effect for those daemons as well + +# Limit the size of the cache to avoid swapping or becoming CPU bound. +# Sorts and serving cache queries gets more expensive as the cache grows. +# Use the value "inf" (infinity) for an unlimited cache size. +MAX_CACHE_SIZE = inf + +# Limits the number of whisper update_many() calls per second, which effectively +# means the number of write requests sent to the disk. This is intended to +# prevent over-utilizing the disk and thus starving the rest of the system. +# When the rate of required updates exceeds this, then carbon's caching will +# take effect and increase the overall throughput accordingly. +MAX_UPDATES_PER_SECOND = 500 + +# If defined, this changes the MAX_UPDATES_PER_SECOND in Carbon when a +# stop/shutdown is initiated. This helps when MAX_UPDATES_PER_SECOND is +# relatively low and carbon has cached a lot of updates; it enables the carbon +# daemon to shutdown more quickly. +# MAX_UPDATES_PER_SECOND_ON_SHUTDOWN = 1000 + +# Softly limits the number of whisper files that get created each minute. +# Setting this value low (like at 50) is a good way to ensure your graphite +# system will not be adversely impacted when a bunch of new metrics are +# sent to it. The trade off is that it will take much longer for those metrics' +# database files to all get created and thus longer until the data becomes usable. +# Setting this value high (like "inf" for infinity) will cause graphite to create +# the files quickly but at the risk of slowing I/O down considerably for a while. +MAX_CREATES_PER_MINUTE = 50 + +LINE_RECEIVER_INTERFACE = 0.0.0.0 +LINE_RECEIVER_PORT = 2003 + +# Set this to True to enable the UDP listener. By default this is off +# because it is very common to run multiple carbon daemons and managing +# another (rarely used) port for every carbon instance is not fun. +ENABLE_UDP_LISTENER = True +UDP_RECEIVER_INTERFACE = 0.0.0.0 +UDP_RECEIVER_PORT = 2003 + +PICKLE_RECEIVER_INTERFACE = 0.0.0.0 +PICKLE_RECEIVER_PORT = 2004 + +# Set to false to disable logging of successful connections +LOG_LISTENER_CONNECTIONS = True + +# Per security concerns outlined in Bug #817247 the pickle receiver +# will use a more secure and slightly less efficient unpickler. +# Set this to True to revert to the old-fashioned insecure unpickler. +USE_INSECURE_UNPICKLER = False + +CACHE_QUERY_INTERFACE = 0.0.0.0 +CACHE_QUERY_PORT = 7002 + +# Set this to False to drop datapoints received after the cache +# reaches MAX_CACHE_SIZE. If this is True (the default) then sockets +# over which metrics are received will temporarily stop accepting +# data until the cache size falls below 95% MAX_CACHE_SIZE. +USE_FLOW_CONTROL = True + +# By default, carbon-cache will log every whisper update and cache hit. This can be excessive and +# degrade performance if logging on the same volume as the whisper data is stored. +LOG_UPDATES = False +LOG_CACHE_HITS = False +LOG_CACHE_QUEUE_SORTS = True + +# The thread that writes metrics to disk can use on of the following strategies +# determining the order in which metrics are removed from cache and flushed to +# disk. The default option preserves the same behavior as has been historically +# available in version 0.9.10. +# +# sorted - All metrics in the cache will be counted and an ordered list of +# them will be sorted according to the number of datapoints in the cache at the +# moment of the list's creation. Metrics will then be flushed from the cache to +# disk in that order. +# +# max - The writer thread will always pop and flush the metric from cache +# that has the most datapoints. This will give a strong flush preference to +# frequently updated metrics and will also reduce random file-io. Infrequently +# updated metrics may only ever be persisted to disk at daemon shutdown if +# there are a large number of metrics which receive very frequent updates OR if +# disk i/o is very slow. +# +# naive - Metrics will be flushed from the cache to disk in an unordered +# fashion. This strategy may be desirable in situations where the storage for +# whisper files is solid state, CPU resources are very limited or deference to +# the OS's i/o scheduler is expected to compensate for the random write +# pattern. +# +CACHE_WRITE_STRATEGY = sorted + +# On some systems it is desirable for whisper to write synchronously. +# Set this option to True if you'd like to try this. Basically it will +# shift the onus of buffering writes from the kernel into carbon's cache. +WHISPER_AUTOFLUSH = False + +# By default new Whisper files are created pre-allocated with the data region +# filled with zeros to prevent fragmentation and speed up contiguous reads and +# writes (which are common). Enabling this option will cause Whisper to create +# the file sparsely instead. Enabling this option may allow a large increase of +# MAX_CREATES_PER_MINUTE but may have longer term performance implications +# depending on the underlying storage configuration. +# WHISPER_SPARSE_CREATE = False + +# Only beneficial on linux filesystems that support the fallocate system call. +# It maintains the benefits of contiguous reads/writes, but with a potentially +# much faster creation speed, by allowing the kernel to handle the block +# allocation and zero-ing. Enabling this option may allow a large increase of +# MAX_CREATES_PER_MINUTE. If enabled on an OS or filesystem that is unsupported +# this option will gracefully fallback to standard POSIX file access methods. +WHISPER_FALLOCATE_CREATE = True + +# Enabling this option will cause Whisper to lock each Whisper file it writes +# to with an exclusive lock (LOCK_EX, see: man 2 flock). This is useful when +# multiple carbon-cache daemons are writing to the same files +# WHISPER_LOCK_WRITES = False + +# Set this to True to enable whitelisting and blacklisting of metrics in +# CONF_DIR/whitelist and CONF_DIR/blacklist. If the whitelist is missing or +# empty, all metrics will pass through +# USE_WHITELIST = False + +# By default, carbon itself will log statistics (such as a count, +# metricsReceived) with the top level prefix of 'carbon' at an interval of 60 +# seconds. Set CARBON_METRIC_INTERVAL to 0 to disable instrumentation +# CARBON_METRIC_PREFIX = carbon +# CARBON_METRIC_INTERVAL = 60 + +# Enable AMQP if you want to receve metrics using an amqp broker +# ENABLE_AMQP = False + +# Verbose means a line will be logged for every metric received +# useful for testing +# AMQP_VERBOSE = False + +# AMQP_HOST = localhost +# AMQP_PORT = 5672 +# AMQP_VHOST = / +# AMQP_USER = guest +# AMQP_PASSWORD = guest +# AMQP_EXCHANGE = graphite +# AMQP_METRIC_NAME_IN_BODY = False + +# The manhole interface allows you to SSH into the carbon daemon +# and get a python interpreter. BE CAREFUL WITH THIS! If you do +# something like time.sleep() in the interpreter, the whole process +# will sleep! This is *extremely* helpful in debugging, assuming +# you are familiar with the code. If you are not, please don't +# mess with this, you are asking for trouble :) +# +# ENABLE_MANHOLE = False +# MANHOLE_INTERFACE = 127.0.0.1 +# MANHOLE_PORT = 7222 +# MANHOLE_USER = admin +# MANHOLE_PUBLIC_KEY = ssh-rsa AAAAB3NzaC1yc2EAAAABiwAaAIEAoxN0sv/e4eZCPpi3N3KYvyzRaBaMeS2RsOQ/cDuKv11dlNzVeiyc3RFmCv5Rjwn/lQ79y0zyHxw67qLyhQ/kDzINc4cY41ivuQXm2tPmgvexdrBv5nsfEpjs3gLZfJnyvlcVyWK/lId8WUvEWSWHTzsbtmXAF2raJMdgLTbQ8wE= + +# Patterns for all of the metrics this machine will store. Read more at +# http://en.wikipedia.org/wiki/Advanced_Message_Queuing_Protocol#Bindings +# +# Example: store all sales, linux servers, and utilization metrics +# BIND_PATTERNS = sales.#, servers.linux.#, #.utilization +# +# Example: store everything +# BIND_PATTERNS = # + +# To configure special settings for the carbon-cache instance 'b', uncomment this: +#[cache:b] +#LINE_RECEIVER_PORT = 2103 +#PICKLE_RECEIVER_PORT = 2104 +#CACHE_QUERY_PORT = 7102 +# and any other settings you want to customize, defaults are inherited +# from [carbon] section. +# You can then specify the --instance=b option to manage this instance + + + +[relay] +LINE_RECEIVER_INTERFACE = 0.0.0.0 +LINE_RECEIVER_PORT = 2013 +PICKLE_RECEIVER_INTERFACE = 0.0.0.0 +PICKLE_RECEIVER_PORT = 2014 + +# Set to false to disable logging of successful connections +LOG_LISTENER_CONNECTIONS = True + +# Carbon-relay has several options for metric routing controlled by RELAY_METHOD +# +# Use relay-rules.conf to route metrics to destinations based on pattern rules +#RELAY_METHOD = rules +# +# Use consistent-hashing for even distribution of metrics between destinations +#RELAY_METHOD = consistent-hashing +# +# Use consistent-hashing but take into account an aggregation-rules.conf shared +# by downstream carbon-aggregator daemons. This will ensure that all metrics +# that map to a given aggregation rule are sent to the same carbon-aggregator +# instance. +# Enable this for carbon-relays that send to a group of carbon-aggregators +#RELAY_METHOD = aggregated-consistent-hashing +RELAY_METHOD = rules + +# If you use consistent-hashing you can add redundancy by replicating every +# datapoint to more than one machine. +REPLICATION_FACTOR = 1 + +# This is a list of carbon daemons we will send any relayed or +# generated metrics to. The default provided would send to a single +# carbon-cache instance on the default port. However if you +# use multiple carbon-cache instances then it would look like this: +# +# DESTINATIONS = 127.0.0.1:2004:a, 127.0.0.1:2104:b +# +# The general form is IP:PORT:INSTANCE where the :INSTANCE part is +# optional and refers to the "None" instance if omitted. +# +# Note that if the destinations are all carbon-caches then this should +# exactly match the webapp's CARBONLINK_HOSTS setting in terms of +# instances listed (order matters!). +# +# If using RELAY_METHOD = rules, all destinations used in relay-rules.conf +# must be defined in this list +DESTINATIONS = 127.0.0.1:2004 + +# This defines the maximum "message size" between carbon daemons. +# You shouldn't need to tune this unless you really know what you're doing. +MAX_DATAPOINTS_PER_MESSAGE = 500 +MAX_QUEUE_SIZE = 10000 + +# Set this to False to drop datapoints when any send queue (sending datapoints +# to a downstream carbon daemon) hits MAX_QUEUE_SIZE. If this is True (the +# default) then sockets over which metrics are received will temporarily stop accepting +# data until the send queues fall below 80% MAX_QUEUE_SIZE. +USE_FLOW_CONTROL = True + +# Set this to True to enable whitelisting and blacklisting of metrics in +# CONF_DIR/whitelist and CONF_DIR/blacklist. If the whitelist is missing or +# empty, all metrics will pass through +# USE_WHITELIST = False + +# By default, carbon itself will log statistics (such as a count, +# metricsReceived) with the top level prefix of 'carbon' at an interval of 60 +# seconds. Set CARBON_METRIC_INTERVAL to 0 to disable instrumentation +# CARBON_METRIC_PREFIX = carbon +# CARBON_METRIC_INTERVAL = 60 + + +[aggregator] +LINE_RECEIVER_INTERFACE = 0.0.0.0 +LINE_RECEIVER_PORT = 2023 + +PICKLE_RECEIVER_INTERFACE = 0.0.0.0 +PICKLE_RECEIVER_PORT = 2024 + +# Set to false to disable logging of successful connections +LOG_LISTENER_CONNECTIONS = True + +# If set true, metric received will be forwarded to DESTINATIONS in addition to +# the output of the aggregation rules. If set false the carbon-aggregator will +# only ever send the output of aggregation. +FORWARD_ALL = True + +# This is a list of carbon daemons we will send any relayed or +# generated metrics to. The default provided would send to a single +# carbon-cache instance on the default port. However if you +# use multiple carbon-cache instances then it would look like this: +# +# DESTINATIONS = 127.0.0.1:2004:a, 127.0.0.1:2104:b +# +# The format is comma-delimited IP:PORT:INSTANCE where the :INSTANCE part is +# optional and refers to the "None" instance if omitted. +# +# Note that if the destinations are all carbon-caches then this should +# exactly match the webapp's CARBONLINK_HOSTS setting in terms of +# instances listed (order matters!). +DESTINATIONS = 127.0.0.1:2004 + +# If you want to add redundancy to your data by replicating every +# datapoint to more than one machine, increase this. +REPLICATION_FACTOR = 1 + +# This is the maximum number of datapoints that can be queued up +# for a single destination. Once this limit is hit, we will +# stop accepting new data if USE_FLOW_CONTROL is True, otherwise +# we will drop any subsequently received datapoints. +MAX_QUEUE_SIZE = 10000 + +# Set this to False to drop datapoints when any send queue (sending datapoints +# to a downstream carbon daemon) hits MAX_QUEUE_SIZE. If this is True (the +# default) then sockets over which metrics are received will temporarily stop accepting +# data until the send queues fall below 80% MAX_QUEUE_SIZE. +USE_FLOW_CONTROL = True + +# This defines the maximum "message size" between carbon daemons. +# You shouldn't need to tune this unless you really know what you're doing. +MAX_DATAPOINTS_PER_MESSAGE = 500 + +# This defines how many datapoints the aggregator remembers for +# each metric. Aggregation only happens for datapoints that fall in +# the past MAX_AGGREGATION_INTERVALS * intervalSize seconds. +MAX_AGGREGATION_INTERVALS = 5 + +# By default (WRITE_BACK_FREQUENCY = 0), carbon-aggregator will write back +# aggregated data points once every rule.frequency seconds, on a per-rule basis. +# Set this (WRITE_BACK_FREQUENCY = N) to write back all aggregated data points +# every N seconds, independent of rule frequency. This is useful, for example, +# to be able to query partially aggregated metrics from carbon-cache without +# having to first wait rule.frequency seconds. +# WRITE_BACK_FREQUENCY = 0 + +# Set this to True to enable whitelisting and blacklisting of metrics in +# CONF_DIR/whitelist and CONF_DIR/blacklist. If the whitelist is missing or +# empty, all metrics will pass through +# USE_WHITELIST = False + +# By default, carbon itself will log statistics (such as a count, +# metricsReceived) with the top level prefix of 'carbon' at an interval of 60 +# seconds. Set CARBON_METRIC_INTERVAL to 0 to disable instrumentation +# CARBON_METRIC_PREFIX = carbon +# CARBON_METRIC_INTERVAL = 60 diff --git a/build/storage-schemas.conf b/build/storage-schemas.conf new file mode 100644 index 0000000..3623365 --- /dev/null +++ b/build/storage-schemas.conf @@ -0,0 +1,21 @@ +# Schema definitions for Whisper files. Entries are scanned in order, +# and first match wins. This file is scanned for changes every 60 seconds. +# +# [name] +# pattern = regex +# retentions = timePerPoint:timeToStore, timePerPoint:timeToStore, ... + +# Carbon's internal metrics. This entry should match what is specified in +# CARBON_METRIC_PREFIX and CARBON_METRIC_INTERVAL settings +[carbon] +pattern = ^carbon\. +retentions = 60:90d + +[ping] +pattern = ping.* +retentions = 1s:1d, 1m:20d + +[default_1min_for_1day] +pattern = .* +retentions = 60s:1d + diff --git a/build/test/gondul-graphite-test.Dockerfile b/build/test/gondul-graphite-test.Dockerfile index 5ac187e..d16efba 100644 --- a/build/test/gondul-graphite-test.Dockerfile +++ b/build/test/gondul-graphite-test.Dockerfile @@ -7,6 +7,8 @@ RUN a2dissite 000-default RUN a2enmod wsgi RUN sed -i 's/false/true/g' /etc/default/graphite-carbon ADD build/test/dummy-graphite.start /dummy-graphite.start +ADD build/storage-schemas.conf /etc/carbon/ +ADD build/carbon.conf /etc/carbon/ EXPOSE 80 EXPOSE 2003 CMD /dummy-graphite.start diff --git a/collectors/ping.pl b/collectors/ping.pl index ff4efce..689efd4 100755 --- a/collectors/ping.pl +++ b/collectors/ping.pl @@ -6,6 +6,7 @@ use Net::Oping; use strict; use warnings; use Data::Dumper; +use IO::Socket::IP; use lib '/opt/gondul/include'; use nms; @@ -15,11 +16,17 @@ my $dbh = nms::db_connect(); $dbh->{AutoCommit} = 0; $dbh->{RaiseError} = 1; -my $q = $dbh->prepare("SELECT switch,host(mgmt_v4_addr) as ip,host(mgmt_v6_addr) as secondary_ip FROM switches WHERE mgmt_v4_addr is not null or mgmt_v6_addr is not null ORDER BY random();"); +my $q = $dbh->prepare("SELECT switch,sysname,host(mgmt_v4_addr) as ip,host(mgmt_v6_addr) as secondary_ip FROM switches WHERE mgmt_v4_addr is not null or mgmt_v6_addr is not null ORDER BY random();"); my $lq = $dbh->prepare("SELECT linknet,addr1,addr2 FROM linknets WHERE addr1 is not null and addr2 is not null;"); my $last = time(); my $target = 0.7; +my $sock = IO::Socket::IP->new( + PeerHost => "$nms::config::graphite_host:$nms::config::graphite_port", + Timeout => 20, + ) or die "Cannot connect - $@"; + + $sock->blocking( 0 ); while (1) { my $now = time(); my $elapsed = ($now - $last); @@ -34,10 +41,13 @@ while (1) { $q->execute; my %ip_to_switch = (); my %secondary_ip_to_switch = (); + my %sw_to_sysname = (); my $affected = 0; while (my $ref = $q->fetchrow_hashref) { $affected++; my $switch = $ref->{'switch'}; + my $sysname = $ref->{'sysname'}; + $sw_to_sysname{$switch} = $sysname; my $ip = $ref->{'ip'}; if (defined($ip) ) { @@ -63,8 +73,10 @@ while (1) { $dbh->do('COPY ping (switch, latency_ms) FROM STDIN'); # date is implicitly now. my $drops = 0; + my $now_graphite = time(); while (my ($ip, $latency) = each %$result) { my $switch = $ip_to_switch{$ip}; + my $sysname = $sw_to_sysname{$switch}; if (!defined($switch)) { next; } @@ -72,9 +84,12 @@ while (1) { if (!defined($latency)) { $drops += $dropped{$ip}; } + print $sock "ping.$sysname.ipv4 " . ($latency || "NaN") . " $now_graphite\n"; $latency //= "\\N"; $dbh->pg_putcopydata("$switch\t$latency\n"); } + + if ($drops > 0) { print "$drops "; } @@ -84,7 +99,9 @@ while (1) { while (my ($ip, $latency) = each %$result) { my $switch = $secondary_ip_to_switch{$ip}; next if (!defined($switch)); + my $sysname = $sw_to_sysname{$switch}; + print $sock "ping.$sysname.ipv6 " . ($latency || "NaN") . " $now_graphite\n"; $latency //= "\\N"; $dbh->pg_putcopydata("$switch\t$latency\n"); } diff --git a/extras/misc/varnish.vcl b/extras/misc/varnish.vcl index 492f001..b10a640 100644 --- a/extras/misc/varnish.vcl +++ b/extras/misc/varnish.vcl @@ -7,6 +7,11 @@ backend default { .port = "80"; } +backend graphite { + .host = "gondul-graphite"; + .port = "80"; +} + sub vcl_recv { if (req.url ~ "^/where" || req.url ~ "^/location") { set req.url = "/api/public/location"; @@ -27,6 +32,10 @@ sub vcl_recv { return (pass); } + if (req.url ~ "/render") { + set req.backend_hint = graphite; + } + # Brukes ikke. Cookies er for nubs. unset req.http.Cookie; @@ -48,6 +57,15 @@ sub vcl_backend_response { if (beresp.http.x-ban) { ban("obj.http.x-url ~ " + beresp.http.x-ban); } + if (bereq.url ~ "/render") { + # Graphite claims "no-cache", which is dumb. + # Let's blindly cache for 5+10s. Which is 10000 times better. + set beresp.http.Cache-Control = "max-age=5s"; + unset beresp.http.Pragma; + set beresp.uncacheable = false; + set beresp.grace = 10s; + set beresp.ttl = 5s; + } if (beresp.status != 200) { set beresp.uncacheable = false; set beresp.ttl = 5s; diff --git a/include/config.pm b/include/config.pm index aabeb44..2a65c94 100755 --- a/include/config.pm +++ b/include/config.pm @@ -8,6 +8,8 @@ our $db_name = "nms"; our $db_host = "db"; our $db_username = "nms"; our $db_password = "risbrod"; +our $graphite_host = "graphite"; +our $graphite_port = "2003"; # Max SNMP polls to fire off at the same time. our $snmp_max = 20; diff --git a/web/js/nms-info-box.js b/web/js/nms-info-box.js index 8b5c18e..2da96f4 100644 --- a/web/js/nms-info-box.js +++ b/web/js/nms-info-box.js @@ -475,11 +475,11 @@ var nmsInfoPanel = function nmsInfoPanel(name,id) { if(!this.me) return; this.me.remove(); + this.removeHandlers(); this.sw = false; this.container = false; this.me = false; this.id = false; - this.removeHandlers(); }; //Method for loading new data and triggering a _render if needed @@ -507,12 +507,14 @@ var nmsInfoPanel = function nmsInfoPanel(name,id) { targetFunction = "refresh"; nmsData.addHandler(dataType,this.id,(this[targetFunction]).bind(this),"handler-"+dataType); this.handlers.push(dataType); + console.log("Pushing " + this.id + " handler"); }; //Method for removing all handlers we have registered this.removeHandlers = function () { for(var i in this.handlers) { nmsData.unregisterHandler(this.handlers[i],this.id); + console.log("Nuking " + this.handlers[i] + " / " + this.id + " handler"); } }; @@ -610,7 +612,7 @@ var switchPortsPanel = function () { var img = document.createElement("img"); var i = "totals"; var zoomTime = 86400; - img.src = 'http://monitor.dx16.sorlanet.net/graph--start%3D-' + zoomTime + '%20--end%3D-60%20--width%3D530%20--height%3D100%20--rigid%20--slope-mode%20DEF%3Ab%3D%2F' + this.sw + '%2F' + i + '.rrd%3Atraffic_in%3AAVERAGE%20DEF%3Ac%3D%2F' + this.sw + '%2F' + i + '.rrd%3Atraffic_out%3AAVERAGE%20CDEF%3Acdefb%3Db%2C8%2C*%20CDEF%3Acdefg%3Dc%2C8%2C*%20AREA%3Acdefb%2300CF0033%20LINE1%3Acdefb%2300CF00FF%20AREA%3Acdefg%23002A9733%20LINE1%3Acdefg%23002A97FF'; + img.src = '/render/?from=-5min&target=ping.' + this.sw + '.ipv4' ; domObj.appendChild(img); var intxt = document.createElement("div"); intxt.innerHTML = "In "; @@ -686,7 +688,7 @@ var switchPortsPanel = function () { var i = obj; var zoomTime = 86400; i = i.replace(/\//g , ""); - img.src = 'http://monitor.dx16.sorlanet.net/graph--start%3D-' + zoomTime + '%20--end%3D-60%20--width%3D530%20--height%3D150%20--rigid%20--slope-mode%20DEF%3Ab%3D%2F' + this.sw + '%2F' + i + '.rrd%3Atraffic_in%3AAVERAGE%20DEF%3Ac%3D%2F' + this.sw + '%2F' + i + '.rrd%3Atraffic_out%3AAVERAGE%20CDEF%3Acdefb%3Db%2C8%2C*%20CDEF%3Acdefg%3Dc%2C8%2C*%20AREA%3Acdefb%2300CF0033%20LINE1%3Acdefb%2300CF00FF%20AREA%3Acdefg%23002A9733%20LINE1%3Acdefg%23002A97FF'; + img.src = '/render/?from=-5min&target=ping.' + this.sw + '.ipv4' ; panelBodyObj.appendChild(img); var nowin = parseInt(snmpJson[obj].ifHCInOctets); var nowout = parseInt(snmpJson[obj].ifHCOutOctets); @@ -755,7 +757,7 @@ var switchDetailsPanel = function() { }; nmsInfoBox.addPanelType("switchDetails",switchDetailsPanel); var switchGraphsPanel = function() { - nmsInfoPanel.call(this,"switchDetails"); + nmsInfoPanel.call(this,"graphs"); this.refresh = function(reason) { var swi = []; var swm = []; @@ -776,7 +778,7 @@ var switchGraphsPanel = function() { var totalHead = document.createElement("h3"); totalHead.innerHTML = device + " total"; var total = document.createElement("img"); - total.src = 'http://monitor.dx16.sorlanet.net/graph--start%3D-' + zoomTime +'%20--end%3D-60%20--width%3D530%20--height%3D150%20--rigid%20--slope-mode%20DEF%3Ab%3D%2F' + device + '%2Ftotals.rrd%3Atraffic_in%3AAVERAGE%20DEF%3Ac%3D%2F' + device + '%2Ftotals.rrd%3Atraffic_out%3AAVERAGE%20CDEF%3Acdefb%3Db%2C8%2C*%20CDEF%3Acdefg%3Dc%2C8%2C*%20AREA%3Acdefb%2300CF0033%20LINE1%3Acdefb%2300CF00FF%20AREA%3Acdefg%23002A9733%20LINE1%3Acdefg%23002A97FF'; + total.src = '/render/?from=-5min&target=ping.' + device + '.ipv4' ; topel.appendChild(totalHead); topel.appendChild(total); for (var ii in interfaces) { @@ -789,7 +791,7 @@ var switchGraphsPanel = function() { } head.innerHTML = device + " - " + i; i = i.replace(/\//g , ""); - img.src = 'http://monitor.dx16.sorlanet.net/graph--start%3D-' + zoomTime + '%20--end%3D-60%20--width%3D530%20--height%3D150%20--rigid%20--slope-mode%20DEF%3Ab%3D%2F' + device + '%2F' + i + '.rrd%3Atraffic_in%3AAVERAGE%20DEF%3Ac%3D%2F' + device + '%2F' + i + '.rrd%3Atraffic_out%3AAVERAGE%20CDEF%3Acdefb%3Db%2C8%2C*%20CDEF%3Acdefg%3Dc%2C8%2C*%20AREA%3Acdefb%2300CF0033%20LINE1%3Acdefb%2300CF00FF%20AREA%3Acdefg%23002A9733%20LINE1%3Acdefg%23002A97FF'; + total.src = '/render/?from=-5min&target=ping.' + this.sw + '.ipv4' ; topel.appendChild(head); topel.appendChild(img); } @@ -1118,6 +1120,11 @@ var switchSummaryPanel = function() { }; this.refresh = function(reason) { var content = []; + if (this.sw == false) { + console.log("ugh, cleanup failed?"); + return; + } + var topper = document.createElement("div"); for ( var h in handlers ) { if (handlers[h].getInfo != undefined) { var tmp = handlers[h].getInfo(this.sw); @@ -1137,8 +1144,12 @@ var switchSummaryPanel = function() { contentCleaned.push(content[i]); } var table = nmsInfoBox._makeTable(contentCleaned); + var latency = document.createElement("img"); + latency.src = '/render/?height=200&width=600&from=-5min&vTitle=Latenc&hideLegend=true&target=movingAverage(ping.' + this.sw + '.ipv4,10)' ; + topper.appendChild(latency); + topper.appendChild(table); - this._render(table); + this._render(topper); }; }; nmsInfoBox.setLegendPick = function(tag,id) { |