58 | | defProperty('source1', "switch1-egtest7", "ID of a resource") |
59 | | defProperty('theSender1', "nodeb-egtest7", "ID of a resource") |
60 | | defProperty('theSender2', "nodec-egtest7", "ID of a resource") |
61 | | defProperty('theSender3', "noded-egtest7", "ID of a resource") |
62 | | defProperty('theSender4', "nodea-egtest7", "ID of a resource") |
63 | | defProperty('theSender5', "nodee-egtest7", "ID of a resource") |
64 | | defProperty('theReceiver', "nodef-egtest7", "ID of a resource") |
| 58 | defProperty('source1', "switch1-testextend", "ID of a resource") |
| 59 | defProperty('theSender1', "nodeb-testextend", "ID of a resource") |
| 60 | defProperty('theSender2', "nodec-testextend", "ID of a resource") |
| 61 | defProperty('theSender3', "noded-testextend", "ID of a resource") |
| 62 | defProperty('theSender4', "nodea-testextend", "ID of a resource") |
| 63 | defProperty('theSender5', "nodee-testextend", "ID of a resource") |
| 64 | defProperty('theReceiver', "nodef-testextend", "ID of a resource") |
| 65 | |
| 66 | defProperty('sinkaddr11', '192.168.1.6', "Ping destination address") |
| 67 | peak_list = [] |
| 68 | count =0 |
| 86 | defApplication('ping') do |app| |
| 87 | app.description = 'Simple Definition for the ping-oml2 application' |
| 88 | # Define the path to the binary executable for this application |
| 89 | app.binary_path = '/usr/local/bin/ping-oml2' |
| 90 | # Define the configurable parameters for this application |
| 91 | # For example if target is set to foo.com and count is set to 2, then the |
| 92 | # application will be started with the command line: |
| 93 | # /usr/bin/ping-oml2 -a foo.com -c 2 |
| 94 | app.defProperty('target', 'Address to ping', '-a', {:type => :string}) |
| 95 | app.defProperty('count', 'Number of times to ping', '-c', {:type => :integer}) |
| 96 | # Define the OML2 measurement point that this application provides. |
| 97 | # Here we have only one measurement point (MP) named 'ping'. Each measurement |
| 98 | # sample from this MP will be composed of a 4-tuples (addr,ttl,rtt,rtt_unit) |
| 99 | app.defMeasurement('ping') do |m| |
| 100 | m.defMetric('remote',:string) |
| 101 | m.defMetric('ttl',:uint32) |
| 102 | m.defMetric('rtt',:double) |
| 103 | m.defMetric('rtt_unit',:string) |
| 104 | end |
| 105 | end |
| 106 | |
| 107 | |
| 189 | defEvent(:MY_EVENT, every: 0.5) do |
| 190 | # Query for some measurements... |
| 191 | # returns an array where each element is a hash representing a row from the DB |
| 192 | query = ms('wrapper_ofthroughput').select { [ :srcaddr] } |
| 193 | data = defQuery(query) |
| 194 | |
| 195 | |
| 196 | triggered = false |
| 197 | if !data.nil? && !(last_row = data.pop).nil? # Make sure we have some data |
| 198 | next if peak_list.include?(last_row[:srcaddr]) # Do nothing if we have seen this sample before |
| 199 | if !peak_list.include?(last_row[:srcaddr]) |
| 200 | peak_list << last_row[:srcaddr] # record that sample, so we dont trigger on it again |
| 201 | #count+=1 |
| 202 | end |
| 203 | if peak_list.size >= 1 |
| 204 | |
| 205 | triggered = true |
| 206 | end |
| 207 | end |
| 208 | triggered |
| 209 | end |
| 210 | onEvent :MY_EVENT do |
| 211 | group('Source4').startApplications |
| 212 | end |
| 213 | |