This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This quickie is for getting a dump of all nodes and whether they're active or not | |
#from a pool on an F5. Takes one arg, the IP of the F5 in question. | |
require 'yaml' | |
require 'openssl' | |
gem 'soap4r' | |
require 'xsd/qname' | |
require 'soap/wsdlDriver' | |
require 'net/ssh' | |
require 'net/http' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'win32ole' | |
#PUTS-ing Route table | |
ole = WIN32OLE.connect("winmgmts://") | |
query = "select * from Win32_IP4RouteTable" | |
puts "Network Address\t\tNetmask\t\tGateway Address\t\tMetric" | |
ole.ExecQuery(query).each do |route| | |
puts "#{route.Destination}\t\t#{route.Mask}\t\t#{route.NextHop}\t\t#{route.Metric1}" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action="/servers" class="new_server" id="new_server" method="post"><div style="margin:0;padding:0"><input name="authenticity_token" type="hidden" value="985c45f4eb511084ddee29d0cfc3e00c0405b410" /></div> | |
<p> | |
<label for="server_hostname">Hostname</label><br /> | |
<input id="server_hostname" name="server[hostname]" size="30" type="text" /> | |
</p> | |
<p> | |
<label for="server_ip_address">Ip address</label><br /> | |
<input id="server_ip_address" name="server[ip_address]" size="30" type="text" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#data_getter.rb | |
require 'server' | |
localhost = Server.new | |
#server.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
params = {'server[ip_address]' => localhost.ip_address, 'server[hostname]' => localhost.hostname, | |
'server[param_1]' => localhost.registry_user_base_dir, 'server[default_gateway]' => localhost.default_gateway, | |
'server[param_2]' => localhost.registry_sql_connect, 'server[netmask]' => localhost.netmask, 'server[route_table]' => | |
route_table, 'server[os]' => localhost.os, 'server[build_date]' => localhost.build_date, 'server[service_pack]' => | |
localhost.service_pack, 'server[subnet]' => localhost.subnet, 'server[persistent_route_table]' => persistent_route_table} | |
#old way | |
#x = Net::HTTP.post_form(URI.parse('http://report1.atbackup.local/servers/create'),params) | |
#new way |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RouteTable | |
attr_accessor :table | |
end | |
class ServersController < ApplicationController | |
# GET /servers | |
# GET /servers.xml | |
before_filter :login_required, :except => [:new, :edit, :create, :update] | |
protect_from_forgery :except => [:new, :edit, :create, :update] | |
def index | |
require 'will_paginate' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
url = URI.parse('http://report1.atbackup.local/servers/create') | |
req = Net::HTTP::Post.new(url.path) | |
req.content_type='text/xml' | |
req.body = "<?xml version='1.0' encoding='UTF-8'?><server><hostname>#{localhost.hostname}</hostname><netmask>#{localhost.netmask}</netmask></server>" | |
res = Net::HTTP.new(url.host, url.port).start{|http| http.request(req)} | |
puts res.code | |
puts res.body |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run_pulse_run | |
@id = params[:id] | |
@timeout = params[:timeout] | |
result = '' | |
#Adding a timeout on my end in hopes of keeping this page from crashing the mongrel | |
begin | |
status = Timeout::timeout(@timeout.to_i) do | |
#And adding a rescue for Mongrel timeouts, just to be safe | |
begin | |
result = PulseRunner.run_pulse_test(@id,@timeout) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This file is smtp_tls.rb | |
require "openssl" | |
require "net/smtp" | |
Net::SMTP.class_eval do | |
private | |
def do_start(helodomain, user, secret, authtype) | |
raise IOError, 'SMTP session already started' if @started | |
check_auth_args(user, secret) if user || secret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DataRepair | |
class DateValueArray | |
def self.fill_in_the_gaps(start_date,end_date,date_array,*value_array_temp) | |
date_array = date_array.reverse | |
value_array = [] | |
value_array_temp.each{|v|value_array << v.reverse} | |
dates,values = [],[] | |
val_index = 0 | |
num_of_values = ((Time.parse(end_date) - Time.parse(start_date)) / 86400).to_i + 1 | |
num_of_values.times do |i| |
OlderNewer