gnms 2.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of gnms might be problematic. Click here for more details.
- data/LICENSE +459 -0
- data/README +29 -0
- data/bin/gnms +11 -0
- data/gnms.gemspec +70 -0
- data/lib/cmd_parse.rb +747 -0
- data/lib/config_global.rb +414 -0
- data/lib/contact.rb +171 -0
- data/lib/external/crypt/blowfish-tables.rb +190 -0
- data/lib/external/crypt/blowfish.rb +110 -0
- data/lib/external/crypt/cbc.rb +123 -0
- data/lib/external/crypt/stringxor.rb +27 -0
- data/lib/external/fog.rb +41 -0
- data/lib/external/jjmx.rb +45 -0
- data/lib/external/sms.rb +282 -0
- data/lib/external/xmpp4r-simple.rb +497 -0
- data/lib/format.rb +85 -0
- data/lib/gnms.rb +329 -0
- data/lib/gui/about_window.rb +177 -0
- data/lib/gui/adddelnode.rb +799 -0
- data/lib/gui/base_window.rb +789 -0
- data/lib/gui/canvas_map.rb +498 -0
- data/lib/gui/charts/gruff.rb +51 -0
- data/lib/gui/color_macro.rb +145 -0
- data/lib/gui/config_window.rb +2151 -0
- data/lib/gui/custom_plugin_window.rb +90 -0
- data/lib/gui/debug_window.rb +46 -0
- data/lib/gui/event_window.rb +469 -0
- data/lib/gui/find_node_window.rb +438 -0
- data/lib/gui/help_window.rb +47 -0
- data/lib/gui/ipcalculator.rb +147 -0
- data/lib/gui/jmx_ref_window.rb +309 -0
- data/lib/gui/link_view.rb +46 -0
- data/lib/gui/mib_browser.rb +585 -0
- data/lib/gui/node_host_property.rb +3712 -0
- data/lib/gui/node_host_view.rb +270 -0
- data/lib/gui/node_network_property.rb +1059 -0
- data/lib/gui/node_network_view.rb +186 -0
- data/lib/gui/node_view.rb +672 -0
- data/lib/gui/oid_ref_window.rb +288 -0
- data/lib/gui/snmptrap_ref_window.rb +288 -0
- data/lib/gui/sub/account_frame.rb +196 -0
- data/lib/gui/sub/contact_frame.rb +519 -0
- data/lib/gui/syslog_ref_window.rb +288 -0
- data/lib/gui/treenode_window.rb +320 -0
- data/lib/gui/update_window.rb +124 -0
- data/lib/gui/widgets.rb +169 -0
- data/lib/gui/wmi_ref_window.rb +286 -0
- data/lib/interface.rb +16 -0
- data/lib/ipcalc.rb +266 -0
- data/lib/link.rb +45 -0
- data/lib/main.rb +1091 -0
- data/lib/monitor/client/custom/custom_monitoring.rb +40 -0
- data/lib/monitor/client/jmx/jmx_attr_monitoring.rb +36 -0
- data/lib/monitor/client/jmx/jmx_monitoring.rb +83 -0
- data/lib/monitor/client/jmx/jmx_ref.rb +114 -0
- data/lib/monitor/client/snmp/mibs/SNMPv2-MIB.txt +854 -0
- data/lib/monitor/client/snmp/mibs/SNMPv2-SMI.txt +344 -0
- data/lib/monitor/client/snmp/oid_ref.rb +141 -0
- data/lib/monitor/client/snmp/snmp.rb +178 -0
- data/lib/monitor/client/snmp/snmp_monitoring.rb +58 -0
- data/lib/monitor/client/wmi/wmi.rb +139 -0
- data/lib/monitor/client/wmi/wmi_monitoring.rb +60 -0
- data/lib/monitor/client/wmi/wmi_ref.rb +141 -0
- data/lib/monitor/custom_plugin.rb +50 -0
- data/lib/monitor/server/msg_buffer.rb +39 -0
- data/lib/monitor/server/snmp/snmptrap_analyzer.rb +81 -0
- data/lib/monitor/server/snmp/snmptrap_capture.rb +26 -0
- data/lib/monitor/server/snmp/snmptrap_monitoring.rb +32 -0
- data/lib/monitor/server/snmp/snmptrap_ref.rb +135 -0
- data/lib/monitor/server/snmp/snmptrap_server.rb +50 -0
- data/lib/monitor/server/syslog/syslog_analyzer.rb +141 -0
- data/lib/monitor/server/syslog/syslog_capture.rb +28 -0
- data/lib/monitor/server/syslog/syslog_monitoring.rb +32 -0
- data/lib/monitor/server/syslog/syslog_ref.rb +136 -0
- data/lib/monitor/server/syslog/syslog_server.rb +43 -0
- data/lib/node.rb +1020 -0
- data/lib/node_db.rb +2668 -0
- data/lib/node_host.rb +215 -0
- data/lib/node_listener.rb +639 -0
- data/lib/node_network.rb +269 -0
- data/lib/node_property.rb +39 -0
- data/lib/notify/alarm.rb +247 -0
- data/lib/notify/irc_bot.rb +167 -0
- data/lib/notify/xmpp_bot.rb +107 -0
- data/lib/service.rb +36 -0
- data/lib/version.rb +8 -0
- data/pixmap/bg/map_bg.jpg +0 -0
- data/pixmap/bg/map_bg2.jpg +0 -0
- data/pixmap/logo.jpg +0 -0
- data/pixmap/logo_icon.png +0 -0
- data/pixmap/os/3com.png +0 -0
- data/pixmap/os/aix.gif +0 -0
- data/pixmap/os/amiga.png +0 -0
- data/pixmap/os/beos.png +0 -0
- data/pixmap/os/cisco.png +0 -0
- data/pixmap/os/freebsd.png +0 -0
- data/pixmap/os/hp.png +0 -0
- data/pixmap/os/hurd.gif +0 -0
- data/pixmap/os/irix.gif +0 -0
- data/pixmap/os/linux.png +0 -0
- data/pixmap/os/mac.png +0 -0
- data/pixmap/os/netbsd.gif +0 -0
- data/pixmap/os/netware.png +0 -0
- data/pixmap/os/openbsd.png +0 -0
- data/pixmap/os/os2warp.gif +0 -0
- data/pixmap/os/qnx.gif +0 -0
- data/pixmap/os/sco.gif +0 -0
- data/pixmap/os/sgi.xpm +111 -0
- data/pixmap/os/solaris.gif +0 -0
- data/pixmap/os/unix.gif +0 -0
- data/pixmap/os/unknown.png +0 -0
- data/pixmap/os/vms.xpm +345 -0
- data/pixmap/os/windows.png +0 -0
- data/pixmap/type/cloud.png +0 -0
- data/pixmap/type/device.png +0 -0
- data/pixmap/type/firewall.png +0 -0
- data/pixmap/type/gateway.png +0 -0
- data/pixmap/type/home.png +0 -0
- data/pixmap/type/host.png +0 -0
- data/pixmap/type/network.png +0 -0
- data/pixmap/type/printer.png +0 -0
- data/pixmap/type/router.png +0 -0
- data/pixmap/type/server.png +0 -0
- data/pixmap/type/switch.png +0 -0
- data/pixmap/type/vm.png +0 -0
- data/plugins/Defaultme.rb +7 -0
- data/plugins/DnsCheck.rb +46 -0
- data/plugins/FooMonitor.rb +26 -0
- data/plugins/HttpVirtualHostMonitor.rb +43 -0
- data/plugins/MysqlShowStatusMonitor.rb +64 -0
- data/plugins/PgsqlPercentConnectionMonitor.rb +72 -0
- data/plugins/SshCpuLoadMonitor.rb +85 -0
- data/plugins/SshDiskMonitor.rb +69 -0
- data/plugins/SshFgtAvExpiredMonitor.rb +75 -0
- data/plugins/SshPercentUsedRamMonitor.rb +74 -0
- data/plugins/TelnetCpuLoadMonitor.rb +69 -0
- data/plugins/example1.rb +15 -0
- data/plugins/example2.rb +7 -0
- data/sound/beep.wav +0 -0
- metadata +378 -0
@@ -0,0 +1,438 @@
|
|
1
|
+
#
|
2
|
+
# module to find host
|
3
|
+
#
|
4
|
+
|
5
|
+
require "#{GNMSLIB}"+'/gui/widgets.rb'
|
6
|
+
|
7
|
+
def findnodewin()
|
8
|
+
|
9
|
+
win_title="Find node"
|
10
|
+
|
11
|
+
node_type=["Host", "Network", "Any"]
|
12
|
+
search_host=["IP", "Status", "Mac", "Dns name", "Netbios name", "Description", "Type","OS" ]
|
13
|
+
search_network=["IP", "Status", "Name", "Dns domain", "Netbios domain", "Description", "Type","OS" ]
|
14
|
+
search_any=["IP", "Status","Dns name","Netbios name", "Description", "Type","OS"]
|
15
|
+
|
16
|
+
win = Gtk::Window.new
|
17
|
+
win.set_transient_for($win)
|
18
|
+
win.set_title win_title
|
19
|
+
win.set_size_request(600,415)
|
20
|
+
|
21
|
+
vbox_root=Gtk::VBox.new
|
22
|
+
vbox_root.show
|
23
|
+
win.add vbox_root
|
24
|
+
|
25
|
+
|
26
|
+
frame = Gtk::Frame::new
|
27
|
+
frame.border_width=10
|
28
|
+
frame.show
|
29
|
+
vbox_root.add frame
|
30
|
+
|
31
|
+
vbox_frame=Gtk::VBox.new
|
32
|
+
vbox_frame.show
|
33
|
+
frame.add vbox_frame
|
34
|
+
|
35
|
+
hhbox_root=Gtk::HBox.new
|
36
|
+
hhbox_root.set_size_request(-1,10)
|
37
|
+
hhbox_root.show
|
38
|
+
hhbox = Gtk::HBox.new
|
39
|
+
hhbox.show
|
40
|
+
hhbox_root.add hhbox
|
41
|
+
|
42
|
+
vbox_frame.add hhbox_root
|
43
|
+
|
44
|
+
node_type_combo = Gtk::ComboBox.new
|
45
|
+
node_type_combo.set_size_request(60,-1)
|
46
|
+
node_type.each do |val|
|
47
|
+
node_type_combo.append_text(val)
|
48
|
+
end
|
49
|
+
node_type_combo.set_active(0)
|
50
|
+
node_type_combo.show
|
51
|
+
hhbox.add node_type_combo
|
52
|
+
|
53
|
+
type_choice = Gtk::ComboBox.new()
|
54
|
+
type_choice.set_size_request(100,-1)
|
55
|
+
search_host.each do |shost|
|
56
|
+
type_choice.append_text(shost)
|
57
|
+
end
|
58
|
+
type_choice.set_active(0)
|
59
|
+
type_choice.show
|
60
|
+
hhbox.add type_choice
|
61
|
+
|
62
|
+
entry_glb=Gtk::Entry.new
|
63
|
+
interfaces_table = local_interface()
|
64
|
+
if interfaces_table.size > 0
|
65
|
+
ip_of_first_interface = interfaces_table[0][0]
|
66
|
+
entry_glb.set_text ip_of_first_interface
|
67
|
+
end
|
68
|
+
entry_glb.show
|
69
|
+
hhbox.add entry_glb
|
70
|
+
|
71
|
+
vvbox=Gtk::VButtonBox.new
|
72
|
+
vvbox.show
|
73
|
+
hhbox_root.add vvbox
|
74
|
+
button_find=Gtk::Button.new(Gtk::Stock::FIND)
|
75
|
+
button_find.set_flags(Gtk::Widget::CAN_DEFAULT)
|
76
|
+
button_find.show
|
77
|
+
vvbox.add button_find
|
78
|
+
|
79
|
+
entry_glb.signal_connect("key_press_event") {|w,e|
|
80
|
+
if e.keyval == Gdk::Keyval::GDK_Return
|
81
|
+
button_find.clicked
|
82
|
+
end
|
83
|
+
}
|
84
|
+
|
85
|
+
clist = Gtk::CList::new(search_host)
|
86
|
+
clist.show
|
87
|
+
clist.set_size_request 500,280
|
88
|
+
scroll = Gtk::ScrolledWindow.new(nil, nil)
|
89
|
+
scroll.border_width=2
|
90
|
+
scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
91
|
+
vbox_frame.pack_start(scroll, true, true, 0)
|
92
|
+
scroll.show
|
93
|
+
scroll.add(clist)
|
94
|
+
|
95
|
+
|
96
|
+
bbox =Gtk::HBox::new(FALSE, 10)
|
97
|
+
bbox.border_width=10
|
98
|
+
bbox.show
|
99
|
+
|
100
|
+
button_clear=Gtk::Button.new(Gtk::Stock::CLEAR)
|
101
|
+
button_clear.show
|
102
|
+
button_close=Gtk::Button.new(Gtk::Stock::CLOSE)
|
103
|
+
button_close.show
|
104
|
+
|
105
|
+
button_clear.set_flags(Gtk::Widget::CAN_DEFAULT)
|
106
|
+
bbox.pack_start(button_clear, TRUE, TRUE, 0)
|
107
|
+
button_close.set_flags(Gtk::Widget::CAN_DEFAULT)
|
108
|
+
bbox.pack_start(button_close, TRUE, TRUE, 0)
|
109
|
+
|
110
|
+
separator = Gtk::HSeparator::new()
|
111
|
+
separator.show
|
112
|
+
vbox_root.pack_start(separator, FALSE, TRUE, 0)
|
113
|
+
vbox_root.pack_start(bbox, FALSE, TRUE, 0)
|
114
|
+
|
115
|
+
|
116
|
+
clist.signal_connect("cursor-changed") { |s, event|
|
117
|
+
iter = s.selection.selected
|
118
|
+
ip=s.model.get_value(iter,1)
|
119
|
+
if $network.has_key?(ip)
|
120
|
+
set_map($network[ip].map)
|
121
|
+
$network[ip].node_view.select()
|
122
|
+
else
|
123
|
+
if $host[ip] != nil
|
124
|
+
set_map($host[ip].map)
|
125
|
+
$host[ip].node_view.select()
|
126
|
+
end
|
127
|
+
end
|
128
|
+
}
|
129
|
+
win.show
|
130
|
+
|
131
|
+
button_close.signal_connect("clicked") {
|
132
|
+
win.destroy
|
133
|
+
}
|
134
|
+
|
135
|
+
button_clear.signal_connect("clicked") {
|
136
|
+
clist.clear
|
137
|
+
win.set_title win_title
|
138
|
+
}
|
139
|
+
|
140
|
+
button_find.signal_connect("clicked") {
|
141
|
+
clist.clear
|
142
|
+
nb_node_find=0
|
143
|
+
|
144
|
+
node_list=nil
|
145
|
+
type=node_type_combo.active_text
|
146
|
+
if type=="Network"
|
147
|
+
node_list=$network
|
148
|
+
elsif type=="Host"
|
149
|
+
node_list=$host
|
150
|
+
else
|
151
|
+
#any type
|
152
|
+
node_list=$host.merge($network)
|
153
|
+
end
|
154
|
+
|
155
|
+
case type_choice.active_text
|
156
|
+
when "IP" then
|
157
|
+
node_list.each_key {|ip|
|
158
|
+
if entry_glb.text==""
|
159
|
+
if ip==""
|
160
|
+
if type == "Any"
|
161
|
+
#remove MAC addr from host or name from network result array
|
162
|
+
array_without_mac=node_list[ip].to_t
|
163
|
+
array_without_mac.delete_at(2)
|
164
|
+
clist.append(array_without_mac)
|
165
|
+
else
|
166
|
+
clist.append(node_list[ip].to_t)
|
167
|
+
end
|
168
|
+
nb_node_find+=1
|
169
|
+
end
|
170
|
+
elsif ip.index(entry_glb.text) != nil
|
171
|
+
if type == "Any"
|
172
|
+
array_without_mac=node_list[ip].to_t
|
173
|
+
array_without_mac.delete_at(2)
|
174
|
+
clist.append(array_without_mac)
|
175
|
+
else
|
176
|
+
clist.append(node_list[ip].to_t)
|
177
|
+
end
|
178
|
+
nb_node_find+=1
|
179
|
+
end
|
180
|
+
}
|
181
|
+
when "Mac" then
|
182
|
+
node_list.each_key {|ip|
|
183
|
+
if entry_glb.text==""
|
184
|
+
if (node_list[ip].mac!=nil) && (node_list[ip].mac==Node::NOARP_PROPERTY)
|
185
|
+
clist.append(node_list[ip].to_t)
|
186
|
+
nb_node_find+=1
|
187
|
+
end
|
188
|
+
elsif (node_list[ip].mac!=nil) && (node_list[ip].mac.index(entry_glb.text.upcase)!=nil)
|
189
|
+
clist.append(node_list[ip].to_t)
|
190
|
+
nb_node_find+=1
|
191
|
+
end
|
192
|
+
}
|
193
|
+
when "Name" then
|
194
|
+
node_list.each_key {|ip|
|
195
|
+
if entry_glb.text==""
|
196
|
+
if node_list[ip].name==Node::NONAME_PROPERTY
|
197
|
+
clist.append(node_list[ip].to_t)
|
198
|
+
nb_node_find+=1
|
199
|
+
end
|
200
|
+
elsif node_list[ip].name.index(entry_glb.text) != nil
|
201
|
+
clist.append(node_list[ip].to_t)
|
202
|
+
nb_node_find+=1
|
203
|
+
end
|
204
|
+
}
|
205
|
+
when "Dns name" then
|
206
|
+
node_list.each_key {|ip|
|
207
|
+
if entry_glb.text==""
|
208
|
+
if node_list[ip].dns_name==Node::NONAME_PROPERTY
|
209
|
+
if type == "Any"
|
210
|
+
#remove MAC addr from host or name from network result array
|
211
|
+
array_without_mac=node_list[ip].to_t
|
212
|
+
array_without_mac.delete_at(2)
|
213
|
+
clist.append(array_without_mac)
|
214
|
+
else
|
215
|
+
clist.append(node_list[ip].to_t)
|
216
|
+
end
|
217
|
+
nb_node_find+=1
|
218
|
+
end
|
219
|
+
elsif node_list[ip].dns_name.index(entry_glb.text) != nil
|
220
|
+
if type == "Any"
|
221
|
+
#remove MAC addr from host or name from network result array
|
222
|
+
array_without_mac=node_list[ip].to_t
|
223
|
+
array_without_mac.delete_at(2)
|
224
|
+
clist.append(array_without_mac)
|
225
|
+
else
|
226
|
+
clist.append(node_list[ip].to_t)
|
227
|
+
end
|
228
|
+
nb_node_find+=1
|
229
|
+
end
|
230
|
+
}
|
231
|
+
when "Dns domain" then
|
232
|
+
node_list.each_key {|ip|
|
233
|
+
if entry_glb.text==""
|
234
|
+
if node_list[ip].dns_domain==Node::NONAME_PROPERTY
|
235
|
+
clist.append(node_list[ip].to_t)
|
236
|
+
nb_node_find+=1
|
237
|
+
end
|
238
|
+
elsif node_list[ip].dns_domain.index(entry_glb.text) != nil
|
239
|
+
clist.append(node_list[ip].to_t)
|
240
|
+
nb_node_find+=1
|
241
|
+
end
|
242
|
+
}
|
243
|
+
when "Netbios name" then
|
244
|
+
node_list.each_key {|ip|
|
245
|
+
if entry_glb.text==""
|
246
|
+
if node_list[ip].netbios_name==Node::NONAME_PROPERTY
|
247
|
+
if type == "Any"
|
248
|
+
#remove MAC addr from host or name from network result array
|
249
|
+
array_without_mac=node_list[ip].to_t
|
250
|
+
array_without_mac.delete_at(2)
|
251
|
+
clist.append(array_without_mac)
|
252
|
+
else
|
253
|
+
clist.append(node_list[ip].to_t)
|
254
|
+
end
|
255
|
+
nb_node_find+=1
|
256
|
+
end
|
257
|
+
elsif node_list[ip].netbios_name.index(entry_glb.text) != nil
|
258
|
+
if type == "Any"
|
259
|
+
#remove MAC addr from host or name from network result array
|
260
|
+
array_without_mac=node_list[ip].to_t
|
261
|
+
array_without_mac.delete_at(2)
|
262
|
+
clist.append(array_without_mac)
|
263
|
+
else
|
264
|
+
clist.append(node_list[ip].to_t)
|
265
|
+
end
|
266
|
+
nb_node_find+=1
|
267
|
+
end
|
268
|
+
}
|
269
|
+
when "Netbios domain" then
|
270
|
+
node_list.each_key {|ip|
|
271
|
+
if entry_glb.text==""
|
272
|
+
if node_list[ip].netbios_domain==Node::NONAME_PROPERTY
|
273
|
+
clist.append(node_list[ip].to_t)
|
274
|
+
nb_node_find+=1
|
275
|
+
end
|
276
|
+
elsif node_list[ip].netbios_domain.index(entry_glb.text) != nil
|
277
|
+
clist.append(node_list[ip].to_t)
|
278
|
+
nb_node_find+=1
|
279
|
+
end
|
280
|
+
}
|
281
|
+
when "Status" then
|
282
|
+
node_list.each_key {|ip|
|
283
|
+
if $status[$status_value.index(node_list[ip].status)] == entry_glb.active_text
|
284
|
+
if type == "Any"
|
285
|
+
#remove MAC addr from host or name from network result array
|
286
|
+
array_without_mac=node_list[ip].to_t
|
287
|
+
array_without_mac.delete_at(2)
|
288
|
+
clist.append(array_without_mac)
|
289
|
+
else
|
290
|
+
clist.append(node_list[ip].to_t)
|
291
|
+
end
|
292
|
+
nb_node_find+=1
|
293
|
+
end
|
294
|
+
}
|
295
|
+
when "Description" then
|
296
|
+
node_list.each_key {|ip|
|
297
|
+
if entry_glb.text==""
|
298
|
+
if node_list[ip].description==Node::NODESCR_PROPERTY
|
299
|
+
if type == "Any"
|
300
|
+
#remove MAC addr from host or name from network result array
|
301
|
+
array_without_mac=node_list[ip].to_t
|
302
|
+
array_without_mac.delete_at(2)
|
303
|
+
clist.append(array_without_mac)
|
304
|
+
else
|
305
|
+
clist.append(node_list[ip].to_t)
|
306
|
+
end
|
307
|
+
nb_node_find+=1
|
308
|
+
end
|
309
|
+
elsif node_list[ip].description.index(entry_glb.text) != nil
|
310
|
+
if type == "Any"
|
311
|
+
#remove MAC addr from host or name from network result array
|
312
|
+
array_without_mac=node_list[ip].to_t
|
313
|
+
array_without_mac.delete_at(2)
|
314
|
+
clist.append(array_without_mac)
|
315
|
+
else
|
316
|
+
clist.append(node_list[ip].to_t)
|
317
|
+
end
|
318
|
+
nb_node_find+=1
|
319
|
+
end
|
320
|
+
}
|
321
|
+
when "Type" then
|
322
|
+
node_list.each_key {|ip|
|
323
|
+
if node_list[ip].type == entry_glb.active_text
|
324
|
+
if type == "Any"
|
325
|
+
#remove MAC addr from host or name from network result array
|
326
|
+
array_without_mac=node_list[ip].to_t
|
327
|
+
array_without_mac.delete_at(2)
|
328
|
+
clist.append(array_without_mac)
|
329
|
+
else
|
330
|
+
clist.append(node_list[ip].to_t)
|
331
|
+
end
|
332
|
+
nb_node_find+=1
|
333
|
+
end
|
334
|
+
}
|
335
|
+
when "OS" then
|
336
|
+
node_list.each_key {|ip|
|
337
|
+
if node_list[ip].os == entry_glb.active_text
|
338
|
+
if type == "Any"
|
339
|
+
#remove MAC addr from host or name from network result array
|
340
|
+
array_without_mac=node_list[ip].to_t
|
341
|
+
array_without_mac.delete_at(2)
|
342
|
+
clist.append(array_without_mac)
|
343
|
+
else
|
344
|
+
clist.append(node_list[ip].to_t)
|
345
|
+
end
|
346
|
+
nb_node_find+=1
|
347
|
+
end
|
348
|
+
}
|
349
|
+
end
|
350
|
+
|
351
|
+
win.set_title(win_title+" - #{nb_node_find} result(s)")
|
352
|
+
|
353
|
+
}
|
354
|
+
|
355
|
+
win.signal_connect("key_press_event") {|w,e|
|
356
|
+
if e.keyval == Gdk::Keyval::GDK_Escape
|
357
|
+
win.destroy
|
358
|
+
end
|
359
|
+
}
|
360
|
+
|
361
|
+
node_type_combo.signal_connect("changed") {|entry|
|
362
|
+
case entry.active_text
|
363
|
+
when "Host" then
|
364
|
+
search_network.each do |sh|
|
365
|
+
type_choice.remove_text(0)
|
366
|
+
end
|
367
|
+
search_host.each do |sh|
|
368
|
+
type_choice.append_text(sh)
|
369
|
+
end
|
370
|
+
type_choice.set_active(0)
|
371
|
+
clist.changed_all_column_name(search_host)
|
372
|
+
when "Network" then
|
373
|
+
search_host.each do |sh|
|
374
|
+
type_choice.remove_text(0)
|
375
|
+
end
|
376
|
+
|
377
|
+
search_network.each do |sn|
|
378
|
+
type_choice.append_text(sn)
|
379
|
+
end
|
380
|
+
type_choice.set_active(0)
|
381
|
+
clist.changed_all_column_name(search_network)
|
382
|
+
else
|
383
|
+
#host & network have same number of entry in array type
|
384
|
+
search_host.each do |sh|
|
385
|
+
type_choice.remove_text(0)
|
386
|
+
end
|
387
|
+
|
388
|
+
search_any.each do |sn|
|
389
|
+
type_choice.append_text(sn)
|
390
|
+
end
|
391
|
+
type_choice.set_active(0)
|
392
|
+
clist.changed_all_column_name(search_any)
|
393
|
+
end
|
394
|
+
clist.clear
|
395
|
+
win.set_title win_title
|
396
|
+
}
|
397
|
+
|
398
|
+
type_choice.signal_connect("changed") {|cbox|
|
399
|
+
case cbox.active_text
|
400
|
+
when "Type" then
|
401
|
+
entry_glb.hide
|
402
|
+
entry_glb.destroy
|
403
|
+
entry_glb=Gtk::ComboBox.new
|
404
|
+
$type.each do |t|
|
405
|
+
entry_glb.append_text(t)
|
406
|
+
end
|
407
|
+
entry_glb.set_active(0)
|
408
|
+
entry_glb.show
|
409
|
+
hhbox.add entry_glb
|
410
|
+
when "OS" then
|
411
|
+
entry_glb.hide
|
412
|
+
entry_glb.destroy
|
413
|
+
entry_glb=Gtk::ComboBox.new
|
414
|
+
$os.each do |os|
|
415
|
+
entry_glb.append_text(os)
|
416
|
+
end
|
417
|
+
entry_glb.set_active(0)
|
418
|
+
entry_glb.show
|
419
|
+
hhbox.add entry_glb
|
420
|
+
when "Status" then
|
421
|
+
entry_glb.hide
|
422
|
+
entry_glb.destroy
|
423
|
+
entry_glb=Gtk::ComboBox.new
|
424
|
+
$status.each do |st|
|
425
|
+
entry_glb.append_text(st)
|
426
|
+
end
|
427
|
+
entry_glb.set_active(0)
|
428
|
+
entry_glb.show
|
429
|
+
hhbox.add entry_glb
|
430
|
+
else
|
431
|
+
entry_glb.hide
|
432
|
+
entry_glb.destroy
|
433
|
+
entry_glb=Gtk::Entry.new
|
434
|
+
entry_glb.show
|
435
|
+
hhbox.add entry_glb
|
436
|
+
end
|
437
|
+
}
|
438
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#
|
2
|
+
# provide help window
|
3
|
+
#
|
4
|
+
#
|
5
|
+
|
6
|
+
def help_window
|
7
|
+
window = Gtk::Window.new
|
8
|
+
window.set_size_request(500,300)
|
9
|
+
window.set_title "Help"
|
10
|
+
icon_name="./pixmap/logo_icon.png"
|
11
|
+
Gtk::Window.set_default_icon(icon_name)
|
12
|
+
window.show
|
13
|
+
|
14
|
+
vbox = Gtk::VBox.new
|
15
|
+
vbox.show
|
16
|
+
window.add vbox
|
17
|
+
|
18
|
+
text = Gtk::TextView.new
|
19
|
+
text.cursor_visible=false
|
20
|
+
text.set_size_request(350,300)
|
21
|
+
text.set_editable(false)
|
22
|
+
text.show
|
23
|
+
|
24
|
+
scrolled_window = Gtk::ScrolledWindow.new(nil, nil)
|
25
|
+
scrolled_window.border_width=2
|
26
|
+
scrolled_window.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_ALWAYS)
|
27
|
+
|
28
|
+
vbox.pack_start(scrolled_window, true, true, 0)
|
29
|
+
scrolled_window.show
|
30
|
+
scrolled_window.add(text)
|
31
|
+
|
32
|
+
text.grab_focus
|
33
|
+
|
34
|
+
if FileTest.exist?"README"
|
35
|
+
fic = File.new("README",'r')
|
36
|
+
tlign = fic.readlines
|
37
|
+
fic.close
|
38
|
+
text.buffer.insert_at_cursor(tlign.to_s)
|
39
|
+
else
|
40
|
+
text.buffer.insert_at_cursor("Error: Could not find README file")
|
41
|
+
end
|
42
|
+
window.signal_connect("key_press_event") {|w,e|
|
43
|
+
if e.keyval == Gdk::Keyval::GDK_Escape
|
44
|
+
window.destroy
|
45
|
+
end
|
46
|
+
}
|
47
|
+
end
|