diff options
author | Kristian Lyngstol <kristian@bohemians.org> | 2016-11-11 15:39:26 +0100 |
---|---|---|
committer | Kristian Lyngstol <kristian@bohemians.org> | 2016-11-11 15:39:26 +0100 |
commit | 179ee8ee548e9eac057a02dc6f626b5c27803fd3 (patch) | |
tree | 6ac44c56249debdc36251b490e63ac42a393246f | |
parent | a611aeff3cf50c3cdd56d76a66e7795df57b375e (diff) |
Various build-tweaks and cache tweaks
- mibs are moved to data/, update gitignore
- Adjust cache for switches and switches-management to improve
responsiveness when adding new content.
- Ensure mibs are correctly loaded if the data directory doesn't exist
- Add a small timer to the startup of ping collector/snmp to avoid
starting before graphite.
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | build/storage-schemas.conf | 6 | ||||
-rwxr-xr-x | build/test/snmpfetch-misc.sh | 1 | ||||
-rwxr-xr-x | collectors/ping.pl | 2 | ||||
-rwxr-xr-x | collectors/snmpfetchng.pl | 2 | ||||
-rwxr-xr-x | web/api/public/switches | 3 | ||||
-rwxr-xr-x | web/api/read/switches-management | 3 |
7 files changed, 13 insertions, 6 deletions
@@ -1,2 +1,2 @@ .*.swp -mibs/ +data/ diff --git a/build/storage-schemas.conf b/build/storage-schemas.conf index 3623365..695ec0e 100644 --- a/build/storage-schemas.conf +++ b/build/storage-schemas.conf @@ -12,10 +12,10 @@ pattern = ^carbon\. retentions = 60:90d [ping] -pattern = ping.* +pattern = ^ping\. retentions = 1s:1d, 1m:20d -[default_1min_for_1day] +[default_1min_for_14day] pattern = .* -retentions = 60s:1d +retentions = 1m:14d diff --git a/build/test/snmpfetch-misc.sh b/build/test/snmpfetch-misc.sh index 0453c59..973e932 100755 --- a/build/test/snmpfetch-misc.sh +++ b/build/test/snmpfetch-misc.sh @@ -1,5 +1,6 @@ #!/bin/bash service snmpd start +mkdir -p /opt/gondul/data cd /opt/gondul/data if [ ! -d mibs ]; then ../extras/tools/get_mibs.sh diff --git a/collectors/ping.pl b/collectors/ping.pl index 689efd4..6cb3bb5 100755 --- a/collectors/ping.pl +++ b/collectors/ping.pl @@ -21,6 +21,8 @@ my $lq = $dbh->prepare("SELECT linknet,addr1,addr2 FROM linknets WHERE addr1 is my $last = time(); my $target = 0.7; +# Hack to avoid starting the collector before graphite is up. +sleep(5); my $sock = IO::Socket::IP->new( PeerHost => "$nms::config::graphite_host:$nms::config::graphite_port", Timeout => 20, diff --git a/collectors/snmpfetchng.pl b/collectors/snmpfetchng.pl index ab91e14..7c62ed3 100755 --- a/collectors/snmpfetchng.pl +++ b/collectors/snmpfetchng.pl @@ -56,6 +56,8 @@ sub mylog printf STDERR "[%s] %s\n", $time, $msg; } +# Hack to avoid starting the collector before graphite is up. +sleep(5); my $sock = IO::Socket::IP->new( PeerHost => "$nms::config::graphite_host:$nms::config::graphite_port", Timeout => 20, diff --git a/web/api/public/switches b/web/api/public/switches index ce95e5f..5528789 100755 --- a/web/api/public/switches +++ b/web/api/public/switches @@ -10,7 +10,8 @@ use strict; use warnings; use Data::Dumper; -$nms::web::cc{'max-age'} = "60"; +$nms::web::cc{'max-age'} = "5"; +$nms::web::cc{'stale-while-revalidate'} = "30"; my $q2 = $nms::web::dbh->prepare('select switch,sysname,tags,distro_name,placement,mgmt_v4_addr,mgmt_v6_addr,mgmt_v4_gw,mgmt_v6_gw,mgmt_vlan,traffic_vlan,last_config_fetch,current_mac,poll_frequency,community,last_updated,switchtype from switches where placement is not null'); diff --git a/web/api/read/switches-management b/web/api/read/switches-management index 8d899b7..33fc6ab 100755 --- a/web/api/read/switches-management +++ b/web/api/read/switches-management @@ -10,7 +10,8 @@ use strict; use warnings; use Data::Dumper; -$nms::web::cc{'max-age'} = "60"; +$nms::web::cc{'max-age'} = "5"; +$nms::web::cc{'stale-while-revalidate'} = "30"; my $q2 = $nms::web::dbh->prepare('select sysname,mgmt_v4_addr,subnet4,subnet6,mgmt_v6_addr,mgmt_v4_gw,mgmt_v6_gw,mgmt_vlan,traffic_vlan,last_config_fetch,current_mac,poll_frequency,last_updated,distro_phy_port,community from switches where placement is not null'); |