Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require_relative 'my_db.rb'
- clients = [
- {name: 'OS-client1', id: '1'},
- {name: 'OS-client2', id: '2'},
- {name: 'OS-client3', id: '3'},
- {name: 'OS-client4', id: '4'},
- ]
- SCHEDULER.every '30s', :first_in => 0 do |job|
- clients.each do |client|
- begin
- db = MyDb.conn
- sql = "SELECT computerid FROM Computers WHERE LastContact < DATE_ADD(NOW(),Interval -120 Second) AND OS LIKE '%Server%' AND clientid = `#{client[:id]}`"
- results = db.query(sql)
- current_client[:name] = results.count
- send_event(client[:name], { value: current_client[:name] } )
- end
- db.close
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement