reviving router script
This commit is contained in:
parent
718ac49380
commit
00363ab593
@ -1 +1 @@
|
|||||||
kWMtIi3IHxSV75Xtf7kRJSM+8cCmvB2N6HJmxfV3l0sohubB+jVUA6CWFTZLreNDcoUVqrFWENR1DfLaGuNdqDw0CUG57kdEOYa46fvMa1Yaj6Al/+Addhhj9sWkcobdh3B2sscNr7PGdbV7qQcJmeCImGbun4JQT90KWXmlN85r+kQxmfmMa45GDLJxvF30q3vzMCuiLgjzsGMDhrk5ATM9AhY8t2/9I//hRvr9iLh6q9/T3eHg73zK+cK061LuaQa/+kSrM6xFqxWgLfmq3Nv0V/tnO4B0Uoi2vHVd9fMULqMrXT/Bm1NiDORTqk4zCCgOi66DOcH8/NmDM7mQ6auOgOdlDhzQL8kKrgqIkv37PZrziWytJCxIURF9z/cm7WYZJ2XS0gD6eeJVwUebwvQ6sS/fbCzvpqI9NSWuoTsmlsLka1z7db/mOSyAN78yI2/NOvHxHWQyf4EUzBwECEZxDudvUr53EcO/9548ddiRfeHJfC4=--6JQb4Y1C34ivZuSd--so4IMeWrDmTUIArcBnK7sQ==
|
2y/5tU0gB2v2W4oOQ1B7tybO8ceNl2PE0RZRyA0u3Sr1HGBCCpQD/L5WDVzxONy+NORzkpQr5eXXFiPzGRDdn0Sgtg8nW6rxqilvCCsvDg98PVmYaphGVCPPPCTQ1xwvJ1nzq79OF7NdioyC2Wyeuzr7zZUVs1NnFXosWxkcEZnFD678JogshjpNxIPo+JXl+e4CUVajhS+sKC6EjEwlefbhzVhbD6xb5p0MF0AJJwinEYFOrpmTymiC6s2NSdxm4nskZ08vil6y+P8gbZJNW+PZXSr2spvrBVlkCkUmSIRUCVnwebbAea+BJodZki8pd/cdadEbPfB+Dj1h4cPltK+NOzKq9Skql6/XNTDwu4cVslple/uLg7rxXiUGc87RD1Q+NRGX6agYLlVCHcnQw2V9HBTZVUQzXAOnWcJUsZC77x/NvDKb7g==--miQp8YhBkpEPZ3Nn--U5RkdQC7kQAbkjieKLZ/yA==
|
@ -1,22 +1,25 @@
|
|||||||
---
|
---
|
||||||
10.20.20.32:
|
|
||||||
:machine: TP-Link Archer C50 v4
|
|
||||||
:host_name: 5_b_sky2_ap
|
|
||||||
10.20.20.33:
|
10.20.20.33:
|
||||||
:machine: Asus RT-AC51U
|
:machine: Asus RT-AC51U
|
||||||
:host_name: 5_a_korfu_ap
|
:host_name: 5_a_korfu_ap
|
||||||
|
10.20.20.34:
|
||||||
|
:machine: Asus RT-AC51U
|
||||||
|
:host_name: 2_d_5_ap
|
||||||
10.20.20.37:
|
10.20.20.37:
|
||||||
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
:host_name: 1_hall_ap
|
:host_name: 1_hall_ap
|
||||||
10.20.20.40:
|
10.20.20.40:
|
||||||
:machine: Asus RT-AC51U
|
:machine: Asus RT-AC51U
|
||||||
:host_name: 1_sulka_rack_ap
|
:host_name: 1_sulka_rack_ap
|
||||||
|
10.20.20.41:
|
||||||
|
:machine: Asus RT-AC51U
|
||||||
|
:host_name: 2_d_2_ap
|
||||||
10.20.20.42:
|
10.20.20.42:
|
||||||
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
:host_name: 4_a_1_ap
|
:host_name: 4_a_2_ap
|
||||||
10.20.20.43:
|
10.20.20.43:
|
||||||
:machine: TP-Link TL-WR841N v14
|
:machine: TP-Link TL-WR841N v14
|
||||||
:host_name: 5_a_rt_ap
|
:host_name: 2_d_15
|
||||||
10.20.20.44:
|
10.20.20.44:
|
||||||
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
:host_name: 2_a_4_ap
|
:host_name: 2_a_4_ap
|
||||||
@ -37,31 +40,19 @@
|
|||||||
:host_name: 3_c_cowork_xi_ap
|
:host_name: 3_c_cowork_xi_ap
|
||||||
10.20.20.50:
|
10.20.20.50:
|
||||||
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
:host_name: 1_a_karhun_ap
|
:host_name: 1_a_1_ap_vanha
|
||||||
10.20.20.51:
|
10.20.20.51:
|
||||||
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
:host_name: 1_a_skaapi_ap
|
:host_name: 1_a_2_ap_vanha
|
||||||
10.20.20.52:
|
|
||||||
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
|
||||||
:host_name: 1_a_kanslia_ap
|
|
||||||
10.20.20.53:
|
10.20.20.53:
|
||||||
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
:host_name: 1_k_shop_ap
|
:host_name: 1_k_shop_ap
|
||||||
10.20.20.54:
|
|
||||||
:machine: TP-Link Archer C50 v4
|
|
||||||
:host_name: 5_a_mandala_ap
|
|
||||||
10.20.20.55:
|
|
||||||
:machine: TP-Link TL-WR841N v14
|
|
||||||
:host_name: 4_a_rack_switch
|
|
||||||
10.20.20.56:
|
10.20.20.56:
|
||||||
:machine: TP-Link TL-WR841N v14
|
:machine: TP-Link TL-WR841N v14
|
||||||
:host_name: 2_d_7_ap
|
:host_name: 0_cellar_switch_cumulus
|
||||||
10.20.20.57:
|
10.20.20.57:
|
||||||
:machine: TP-Link TL-WR841N v14
|
:machine: TP-Link TL-WR841N v14
|
||||||
:host_name: 3_c_cowork_wr_ap
|
:host_name: 3_c_cowork_wr_ap
|
||||||
10.20.20.58:
|
|
||||||
:machine: TP-Link TL-WR841N v14
|
|
||||||
:host_name: 2_d_5_ap
|
|
||||||
10.20.20.59:
|
10.20.20.59:
|
||||||
:machine: TP-Link TL-WR841N v14
|
:machine: TP-Link TL-WR841N v14
|
||||||
:host_name: 3_c_309_ap
|
:host_name: 3_c_309_ap
|
||||||
@ -95,9 +86,6 @@
|
|||||||
10.20.20.69:
|
10.20.20.69:
|
||||||
:machine: TP-Link TL-WR841N v14
|
:machine: TP-Link TL-WR841N v14
|
||||||
:host_name: 2_makers_216_ap
|
:host_name: 2_makers_216_ap
|
||||||
10.20.20.71:
|
|
||||||
:machine: TP-Link TL-WR841N v14
|
|
||||||
:host_name: 2_d_2_ap
|
|
||||||
10.20.20.72:
|
10.20.20.72:
|
||||||
:machine: TP-Link TL-WR841N v14
|
:machine: TP-Link TL-WR841N v14
|
||||||
:host_name: 1_b_110_ap
|
:host_name: 1_b_110_ap
|
||||||
@ -110,3 +98,90 @@
|
|||||||
10.20.20.76:
|
10.20.20.76:
|
||||||
:machine: TP-Link TL-WR841N v14
|
:machine: TP-Link TL-WR841N v14
|
||||||
:host_name: 3_c_back_right_ap
|
:host_name: 3_c_back_right_ap
|
||||||
|
10.20.20.80:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 1_sulka_storage
|
||||||
|
10.20.20.84:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 2_d_7_ap
|
||||||
|
10.20.20.85:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 5_a_rt_ap
|
||||||
|
10.20.20.87:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 4_a_1_ap
|
||||||
|
10.20.20.88:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 4_a_3_ap
|
||||||
|
10.20.20.92:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 2_b_1_ap
|
||||||
|
10.20.20.93:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 2_b_2_ap
|
||||||
|
10.20.20.94:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 2_b_3_ap
|
||||||
|
10.20.20.95:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 2_b_4_ap
|
||||||
|
10.20.20.96:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 2b_5_ap
|
||||||
|
10.20.20.98:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 3_b_1_ap
|
||||||
|
10.20.20.99:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 3_b_3_ap
|
||||||
|
10.20.20.100:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 3_b_4_ap
|
||||||
|
10.20.20.101:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 3_b_5_ap
|
||||||
|
10.20.20.102:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 1_a_5_ap_vanha
|
||||||
|
10.20.20.103:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 3_b_2_ap
|
||||||
|
10.20.20.104:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 3_a_1_ap
|
||||||
|
10.20.20.105:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 1_a_4_ap_vanha
|
||||||
|
10.20.20.106:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 1_a_3_ap_vanha
|
||||||
|
10.20.20.107:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 3_a_5_ap
|
||||||
|
10.20.20.108:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 3_a_4_ap
|
||||||
|
10.20.20.109:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 3_a_3_ap
|
||||||
|
10.20.20.110:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 3_a_2_ap
|
||||||
|
10.20.20.112:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 2_c_1_ap
|
||||||
|
10.20.20.113:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 4_a_5_ap
|
||||||
|
10.20.20.114:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 4_a_4_ap
|
||||||
|
10.20.20.115:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 2_c_5_ap
|
||||||
|
10.20.20.116:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 2_c_4_ap
|
||||||
|
10.20.20.117:
|
||||||
|
:machine: Xiaomi Mi Router 4A Gigabit Edition
|
||||||
|
:host_name: 2_c_3_ap
|
||||||
|
@ -4,22 +4,23 @@ require "net/ssh"
|
|||||||
class Routers
|
class Routers
|
||||||
|
|
||||||
@@start_address = "10.20.20."
|
@@start_address = "10.20.20."
|
||||||
@@start_at = 20
|
@@start_at = 32
|
||||||
@@stop_at = 85
|
@@stop_at = 130
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@at = @@start_at
|
@at = @@start_at
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# full ip address, ie start_address + @at
|
||||||
def at
|
def at
|
||||||
@@start_address + @at.to_s
|
@@start_address + @at.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
# print info for each ip
|
# print info for each ip
|
||||||
def print( info )
|
def print( info = nil)
|
||||||
info = "host_name" unless info
|
|
||||||
each_router do |ip , connection|
|
each_router do |ip , connection|
|
||||||
message = send(info.to_sym , connection)
|
message = host_name( connection)
|
||||||
|
message += " " + send(info.to_sym , connection).to_s if info
|
||||||
puts "#{ip} = #{message}"
|
puts "#{ip} = #{message}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -78,6 +79,11 @@ class Routers
|
|||||||
connection.exec!( "uci get system.@system[0].hostname").strip
|
connection.exec!( "uci get system.@system[0].hostname").strip
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# check if cron
|
||||||
|
def get_cron(connection)
|
||||||
|
connection.exec!( "cat /etc/crontabs/root" ).strip
|
||||||
|
end
|
||||||
|
|
||||||
# get the admin name, ie the dhcp name of the admin interface
|
# get the admin name, ie the dhcp name of the admin interface
|
||||||
def admin_name(connection)
|
def admin_name(connection)
|
||||||
connection.exec!( "uci get network.admin.hostname").strip
|
connection.exec!( "uci get network.admin.hostname").strip
|
||||||
@ -96,9 +102,6 @@ class Routers
|
|||||||
nets.lines.collect{|line| line.split("=").last.strip}#.join(",")
|
nets.lines.collect{|line| line.split("=").last.strip}#.join(",")
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_info(connection)
|
|
||||||
{machine: machine(connection) , host_name: admin_name(connection)}
|
|
||||||
end
|
|
||||||
# takes a block and yields ip and connection to
|
# takes a block and yields ip and connection to
|
||||||
# every succesful connection
|
# every succesful connection
|
||||||
def ips(live_only = true)
|
def ips(live_only = true)
|
||||||
|
Loading…
Reference in New Issue
Block a user