mirror of
https://github.com/valitydev/riak_test.git
synced 2024-11-06 00:25:22 +00:00
Verify cluster stats in SNMP
Update verify_snmp_repl test to prove that cluster stats are correctly recorded in SNMP.
This commit is contained in:
parent
dfcad14eba
commit
35cb49f002
@ -24,11 +24,17 @@
|
||||
-include_lib("eunit/include/eunit.hrl").
|
||||
-compile({parse_transform, rt_intercept_pt}).
|
||||
|
||||
-define(FIRST_CLUSTER, "cluster-1").
|
||||
-define(OTHER_CLUSTERS, ["cluster-2", "cluster-3"]).
|
||||
-define(CLUSTERS, [?FIRST_CLUSTER] ++ ?OTHER_CLUSTERS).
|
||||
|
||||
confirm() ->
|
||||
Clusters = make_clusters(["cluster-1", "cluster-2", "cluster-3"], 1),
|
||||
Clusters = make_clusters(?CLUSTERS, 1),
|
||||
[{_, Leader, _}|_] = Clusters,
|
||||
intercept_riak_snmp_stat_poller(Leader),
|
||||
wait_for_snmp_stat_poller().
|
||||
wait_for_snmp_stat_poller(),
|
||||
verify_snmp_cluster_stats(Clusters),
|
||||
pass.
|
||||
|
||||
make_clusters(Names, NodeCount) ->
|
||||
ClusterCount = length(Names),
|
||||
@ -107,3 +113,17 @@ enable_realtime([{_, Node, _}|OtherClusters]) ->
|
||||
end,
|
||||
OtherClusters).
|
||||
|
||||
%% snmpwalk gives the following output containing the OIDs we're interested in:
|
||||
%% SNMPv2-SMI::enterprises.31130.200.1.1.1.99.108.117.115.116.101.114.45.50 = STRING: "cluster-2"
|
||||
%% SNMPv2-SMI::enterprises.31130.200.1.1.1.99.108.117.115.116.101.114.45.51 = STRING: "cluster-3"
|
||||
-define(CLUSTER_OIDS,
|
||||
[[1,3,6,1,4,1,31130,200,1,1,1,99,108,117,115,116,101,114,45] ++ [Tail]
|
||||
|| Tail <- [50, 51]]).
|
||||
|
||||
verify_snmp_cluster_stats(Clusters) ->
|
||||
[{_Name, Leader, [_Nodes]} | _Rest] = Clusters,
|
||||
rpc:call(Leader, riak_core, wait_for_application, [snmp]),
|
||||
rpc:call(Leader, riak_core, wait_for_application, [riak_snmp]),
|
||||
ClusterJoins = rpc:call(Leader, snmpa, get, [snmp_master_agent, ?CLUSTER_OIDS]),
|
||||
?assertEqual(?OTHER_CLUSTERS, ClusterJoins).
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user