gnms 2.1.0 → 2.1.1
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/lib/cmd_parse.rb +9 -8
- data/lib/config_global.rb +19 -8
- data/lib/gui/config_window.rb +55 -21
- data/lib/gui/node_host_property.rb +277 -243
- data/lib/gui/node_host_view.rb +15 -11
- data/lib/main.rb +8 -3
- data/lib/monitor/client/snmp/snmp.rb +11 -5
- data/lib/monitor/server/snmp/snmptrap_server.rb +1 -1
- data/lib/node.rb +1 -1
- data/lib/node_listener.rb +182 -16
- data/lib/version.rb +1 -1
- metadata +3 -2
data/lib/cmd_parse.rb
CHANGED
@@ -62,21 +62,22 @@ def get_system_infor()
|
|
62
62
|
end
|
63
63
|
|
64
64
|
#
|
65
|
-
#
|
65
|
+
# download mac manufacturer list
|
66
66
|
#
|
67
67
|
def get_mac_manufacturer_list()
|
68
|
-
|
69
|
-
if ! mac_manufacturer_list_exist?()
|
68
|
+
if !mac_manufacturer_list_exist?()
|
70
69
|
ieee_addr="standards.ieee.org"
|
71
70
|
ieee_url="/develop/regauth/oui/oui.txt"
|
72
71
|
local_file_path="#{CONF_DIR}"
|
73
72
|
local_file_name="oui.txt"
|
74
|
-
|
73
|
+
if RUBY_VERSION.match("^1\.8")
|
74
|
+
Net::HTTP.version_1_1
|
75
|
+
end
|
75
76
|
tf=Tempfile.new(local_file_name)
|
76
77
|
begin
|
77
78
|
Net::HTTP.start(ieee_addr, 80) do |http|
|
78
79
|
response,=http.get(ieee_url)
|
79
|
-
response.body.each do |str|
|
80
|
+
response.body.split("\n").each do |str|
|
80
81
|
str.chomp
|
81
82
|
if str.match('base\s16')
|
82
83
|
#line syntax is 'XXXXXX (base 16) name'
|
@@ -87,7 +88,7 @@ def get_mac_manufacturer_list()
|
|
87
88
|
end
|
88
89
|
end
|
89
90
|
rescue Exception => msg
|
90
|
-
|
91
|
+
$log.error(msg.backtrace.join("\n"))
|
91
92
|
tf.close(true)
|
92
93
|
return -1
|
93
94
|
end
|
@@ -418,7 +419,7 @@ end
|
|
418
419
|
# verify if jmx ref threshold value is ok
|
419
420
|
#
|
420
421
|
def test_monitored_jmx(ip)
|
421
|
-
$log.
|
422
|
+
$log.debug "cmd_parse test_monitored_jmx #{ip}"
|
422
423
|
if $host[ip] && ($host[ip].jmx_monitoring.size() > 0)
|
423
424
|
max_severity=UNKNOWN
|
424
425
|
begin
|
@@ -574,7 +575,7 @@ end
|
|
574
575
|
#
|
575
576
|
# Return all host seems to be up (responding to icmp) from a given range IP addr
|
576
577
|
def range_remote_ping(ip_begin, ip_end)
|
577
|
-
puts "in range_remote_ping"
|
578
|
+
#puts "in range_remote_ping"
|
578
579
|
result=[]
|
579
580
|
if $config.nmap_path == ""
|
580
581
|
return result
|
data/lib/config_global.rb
CHANGED
@@ -27,7 +27,7 @@ DEFAULT_SOUND_FILE = "Just beep"
|
|
27
27
|
attr_reader :default_width, :default_height, :default_map, :show_label, :noshow_fqdn, :show_tooltips, :confirm_delete, :confirm_quit, :log_level
|
28
28
|
attr_reader :read_community, :write_community, :snmp_version, :snmp_port, :snmp_timeout, :snmp_retry, :mail_server_addr, :mail_server_port, :sms_device, :im_login, :im_password, :irc_server, :irc_port, :irc_channel
|
29
29
|
attr_accessor :level
|
30
|
-
attr_reader :
|
30
|
+
attr_reader :active_find_node_state, :active_find_node_delay, :passive_find_node_state, :passive_find_node_delay, :mac_state, :mac_delay, :mac_lock, :mac_manufacturer, :syslog_mon, :syslog_port, :snmptrap_mon, :snmptrap_port, :snmptrap_community
|
31
31
|
attr_reader :node_resolving, :node_resolving_delay
|
32
32
|
attr_reader :port_mon, :port_mon_delay, :snmp_mon, :snmp_mon_delay, :wmi_mon, :wmi_mon_delay, :custom_mon, :custom_mon_delay, :jmx_mon, :jmx_mon_delay
|
33
33
|
attr_reader :ping_path, :nmap_path, :ssh_path, :telnet_path, :browser_path, :vncviewer_path, :rdesktop_path, :xterm_path, :nmblookup_path, :xprobe_path, :wmic_path
|
@@ -86,7 +86,7 @@ def read_config_yaml()
|
|
86
86
|
$log.fatal("Error reading configuration file #{GLOBAL_CONF_FILE}")
|
87
87
|
exit()
|
88
88
|
end
|
89
|
-
|
89
|
+
begin
|
90
90
|
@default_width = db["general"]["default_width"]
|
91
91
|
@default_height = db["general"]["default_height"]
|
92
92
|
@default_map = db["general"]["default_map"]
|
@@ -130,8 +130,10 @@ def read_config_yaml()
|
|
130
130
|
@sms_num_by_level = db["notification"]["sms_num"]
|
131
131
|
@im_dest_by_level = db["notification"]["im_dest"]
|
132
132
|
|
133
|
-
@
|
134
|
-
@
|
133
|
+
@active_find_node_state = db["scan"]["active_find_node"]["state"]
|
134
|
+
@active_find_node_delay = db["scan"]["active_find_node"]["delay"]
|
135
|
+
@passive_find_node_state = db["scan"]["passive_find_node"]["state"]
|
136
|
+
@passive_find_node_delay = db["scan"]["passive_find_node"]["delay"]
|
135
137
|
@mac_state = db["scan"]["mac"]["state"]
|
136
138
|
@mac_delay = db["scan"]["mac"]["delay"]
|
137
139
|
@mac_lock = db["scan"]["mac"]["lock"]
|
@@ -172,6 +174,10 @@ def read_config_yaml()
|
|
172
174
|
@label_bg = db["colors"]["label_bg"]
|
173
175
|
@rgb = db["colors"]["rgb"]
|
174
176
|
@image_path = db["colors"]["image_path"]
|
177
|
+
rescue
|
178
|
+
$log.error("Conf reset as issues found when loading configuration file at #{GLOBAL_CONF_FILE}")
|
179
|
+
init_config_var()
|
180
|
+
end
|
175
181
|
else
|
176
182
|
init_config_var()
|
177
183
|
end
|
@@ -233,10 +239,14 @@ notification = {
|
|
233
239
|
}
|
234
240
|
|
235
241
|
scan = {
|
236
|
-
'
|
237
|
-
'state' => @
|
238
|
-
'delay' => @
|
242
|
+
'active_find_node' => {
|
243
|
+
'state' => @active_find_node_state,
|
244
|
+
'delay' => @active_find_node_delay.to_i,
|
239
245
|
},
|
246
|
+
'passive_find_node' => {
|
247
|
+
'state' => @passive_find_node_state,
|
248
|
+
'delay' => @passive_find_node_delay.to_i,
|
249
|
+
},
|
240
250
|
'mac' => {
|
241
251
|
'state' => @mac_state,
|
242
252
|
'delay' => @mac_delay.to_i,
|
@@ -385,7 +395,8 @@ def initialize ()
|
|
385
395
|
@wmi_mon_delay = "60"
|
386
396
|
@custom_mon_delay = "60"
|
387
397
|
@jmx_mon_delay = "60"
|
388
|
-
@
|
398
|
+
@active_find_node_delay = "300"
|
399
|
+
@passive_find_node_delay = "300"
|
389
400
|
@node_resolving = true
|
390
401
|
@node_resolving_delay = "120"
|
391
402
|
@mac_delay = "60"
|
data/lib/gui/config_window.rb
CHANGED
@@ -61,10 +61,14 @@ def save_config_yaml()
|
|
61
61
|
}
|
62
62
|
|
63
63
|
scan = {
|
64
|
-
'
|
64
|
+
'active_find_node' => {
|
65
65
|
'state' => @button_bp.active?,
|
66
66
|
'delay' => @entry_delay_bp.text.to_i,
|
67
67
|
},
|
68
|
+
'passive_find_node' => {
|
69
|
+
'state' => @button_passive_fn.active?,
|
70
|
+
'delay' => @entry_delay_passive_fn.text.to_i,
|
71
|
+
},
|
68
72
|
'mac' => {
|
69
73
|
'state' => @button_macf.active?,
|
70
74
|
'delay' => @entry_delay_macf.text.to_i,
|
@@ -1020,26 +1024,25 @@ end
|
|
1020
1024
|
vbox_frame.show
|
1021
1025
|
frame = Gtk::Frame::new("Active")
|
1022
1026
|
frame.border_width=10
|
1023
|
-
#frame.set_size_request(200, 150)
|
1024
1027
|
frame.show
|
1025
1028
|
vbox_frame.add frame
|
1026
1029
|
table = Gtk::Table.new(5,2,false)
|
1027
1030
|
table.show
|
1028
1031
|
frame.add table
|
1029
1032
|
|
1030
|
-
#find
|
1033
|
+
#find nodes using broadcast ping, and port scanning
|
1031
1034
|
@button_bp = Gtk::CheckButton.new "Find new nodes delay (in s)"
|
1032
1035
|
@button_bp.set_size_request 10,-1
|
1033
|
-
@button_bp.set_active @config.
|
1036
|
+
@button_bp.set_active @config.active_find_node_state
|
1034
1037
|
@button_bp.show
|
1035
1038
|
|
1036
1039
|
@entry_delay_bp = Gtk::Entry.new
|
1037
1040
|
@entry_delay_bp.show
|
1038
1041
|
@entry_delay_bp.set_size_request 5,-1
|
1039
|
-
if @config.
|
1042
|
+
if @config.active_find_node_delay == "" || @config.active_find_node_delay == nil
|
1040
1043
|
@entry_delay_bp.set_text "300"
|
1041
1044
|
else
|
1042
|
-
@entry_delay_bp.set_text @config.
|
1045
|
+
@entry_delay_bp.set_text @config.active_find_node_delay.to_s
|
1043
1046
|
end
|
1044
1047
|
@entry_delay_bp.set_sensitive @button_bp.active?
|
1045
1048
|
|
@@ -1087,8 +1090,8 @@ end
|
|
1087
1090
|
@button_macm_dl = Gtk::Button.new("Download MAC manufacturer")
|
1088
1091
|
@button_macm_dl.signal_connect("clicked"){
|
1089
1092
|
Thread.start {
|
1090
|
-
|
1091
|
-
|
1093
|
+
@button_macm_dl.label="Processing OUIs from IEEE"
|
1094
|
+
Gtk.thread_protect do
|
1092
1095
|
if get_mac_manufacturer_list() == 0
|
1093
1096
|
@button_macm.set_sensitive(true) unless !@button_macm
|
1094
1097
|
@button_macm.set_active @config.mac_manufacturer unless !@button_macm
|
@@ -1235,16 +1238,39 @@ end
|
|
1235
1238
|
table.attach(@button_jmx,0,1,12,13)
|
1236
1239
|
table.attach(@entry_delay_jmx,1,2,12,13)
|
1237
1240
|
|
1238
|
-
#passive monitoring
|
1239
|
-
|
1241
|
+
#passive monitoring
|
1242
|
+
|
1240
1243
|
frame_passive = Gtk::Frame::new("Passive")
|
1241
1244
|
frame_passive.border_width=10
|
1242
1245
|
frame_passive.show
|
1243
1246
|
vbox_frame.add frame_passive
|
1244
|
-
table_passive = Gtk::Table.new(
|
1247
|
+
table_passive = Gtk::Table.new(4,2,false)
|
1245
1248
|
table_passive.show
|
1246
1249
|
frame_passive.add table_passive
|
1247
1250
|
|
1251
|
+
#find nodes using sniffing
|
1252
|
+
@button_passive_fn = Gtk::CheckButton.new "Find new nodes delay (in s)"
|
1253
|
+
@button_passive_fn.set_size_request 10,-1
|
1254
|
+
@button_passive_fn.set_active @config.passive_find_node_state
|
1255
|
+
@button_passive_fn.show
|
1256
|
+
|
1257
|
+
@entry_delay_passive_fn = Gtk::Entry.new
|
1258
|
+
@entry_delay_passive_fn.show
|
1259
|
+
@entry_delay_passive_fn.set_size_request 5,-1
|
1260
|
+
if @config.passive_find_node_delay == "" || @config.passive_find_node_delay == nil
|
1261
|
+
@entry_delay_passive_fn.set_text "300"
|
1262
|
+
else
|
1263
|
+
@entry_delay_passive_fn.set_text @config.passive_find_node_delay.to_s
|
1264
|
+
end
|
1265
|
+
@entry_delay_passive_fn.set_sensitive @button_passive_fn.active?
|
1266
|
+
|
1267
|
+
@button_passive_fn.signal_connect("toggled") {
|
1268
|
+
@entry_delay_passive_fn.set_sensitive @button_passive_fn.active?
|
1269
|
+
}
|
1270
|
+
|
1271
|
+
table_passive.attach(@button_passive_fn,0,1,0,1)
|
1272
|
+
table_passive.attach(@entry_delay_passive_fn,1,2,0,1)
|
1273
|
+
|
1248
1274
|
@button_syslog_daemon = Gtk::CheckButton.new "Syslog server port"
|
1249
1275
|
@button_syslog_daemon.set_active @config.syslog_mon
|
1250
1276
|
@button_syslog_daemon.show
|
@@ -1264,8 +1290,8 @@ end
|
|
1264
1290
|
@entry_syslog_daemon_port.set_sensitive @button_syslog_daemon.active?
|
1265
1291
|
}
|
1266
1292
|
|
1267
|
-
table_passive.attach(@button_syslog_daemon,0,1,
|
1268
|
-
table_passive.attach(@entry_syslog_daemon_port,1,2,
|
1293
|
+
table_passive.attach(@button_syslog_daemon,0,1,1,2)
|
1294
|
+
table_passive.attach(@entry_syslog_daemon_port,1,2,1,2)
|
1269
1295
|
|
1270
1296
|
@button_snmptrap_daemon = Gtk::CheckButton.new "SNMP Trap server port"
|
1271
1297
|
@button_snmptrap_daemon.set_active @config.snmptrap_mon
|
@@ -1301,10 +1327,10 @@ end
|
|
1301
1327
|
@entry_snmptrap_daemon_community.set_sensitive @button_snmptrap_daemon.active?
|
1302
1328
|
}
|
1303
1329
|
|
1304
|
-
table_passive.attach(@button_snmptrap_daemon,0,1,
|
1305
|
-
table_passive.attach(@entry_snmptrap_daemon_port,1,2,
|
1306
|
-
table_passive.attach(label_snmptrap_daemon_community,0,1,
|
1307
|
-
table_passive.attach(@entry_snmptrap_daemon_community,1,2,
|
1330
|
+
table_passive.attach(@button_snmptrap_daemon,0,1,2,3)
|
1331
|
+
table_passive.attach(@entry_snmptrap_daemon_port,1,2,2,3)
|
1332
|
+
table_passive.attach(label_snmptrap_daemon_community,0,1,3,4)
|
1333
|
+
table_passive.attach(@entry_snmptrap_daemon_community,1,2,3,4)
|
1308
1334
|
|
1309
1335
|
hbox = Gtk::HBox.new(FALSE, 1)
|
1310
1336
|
hbox.add Gtk::Image.new(Gtk::Stock::EXECUTE, Gtk::IconSize::MENU)
|
@@ -1834,7 +1860,8 @@ button.signal_connect("clicked") do
|
|
1834
1860
|
old_wmi_mon=@config.wmi_mon
|
1835
1861
|
old_jmx_mon=@config.jmx_mon
|
1836
1862
|
old_custom_mon=@config.custom_mon
|
1837
|
-
|
1863
|
+
old_active_find_node_state=@config.active_find_node_state
|
1864
|
+
old_passive_find_node_state=@config.passive_find_node_state
|
1838
1865
|
old_mac_state=@config.mac_state
|
1839
1866
|
old_node_resolving=@config.node_resolving
|
1840
1867
|
old_syslog_mon=@config.syslog_mon
|
@@ -1932,17 +1959,24 @@ button.signal_connect("clicked") do
|
|
1932
1959
|
del_monitoring_thread("JMX monitoring")
|
1933
1960
|
end
|
1934
1961
|
end
|
1935
|
-
if
|
1962
|
+
if old_active_find_node_state != @button_bp.active?
|
1936
1963
|
if @button_bp.active?
|
1937
1964
|
add_monitoring_thread("Local ping", t_find_local_segment_pinging())
|
1938
|
-
add_monitoring_thread("Local sniffing", t_find_local_segment_sniffing())
|
1939
1965
|
add_monitoring_thread("Remote ping", t_find_remote_new_host())
|
1940
1966
|
else
|
1941
1967
|
del_monitoring_thread("Local ping")
|
1942
|
-
del_monitoring_thread("Local sniffing")
|
1943
1968
|
del_monitoring_thread("Remote ping")
|
1944
1969
|
end
|
1945
1970
|
end
|
1971
|
+
if old_passive_find_node_state != @button_passive_fn.active?
|
1972
|
+
if @button_passive_fn.active?
|
1973
|
+
add_monitoring_thread("Local sniffing", t_find_local_segment_sniffing())
|
1974
|
+
add_monitoring_thread("SSDP query", t_find_ssdp_discovery())
|
1975
|
+
else
|
1976
|
+
del_monitoring_thread("Local sniffing")
|
1977
|
+
del_monitoring_thread("SSDP query")
|
1978
|
+
end
|
1979
|
+
end
|
1946
1980
|
if old_mac_state != @button_macf.active?
|
1947
1981
|
if @button_macf.active?
|
1948
1982
|
add_monitoring_thread("Find mac",tmacip())
|
@@ -45,7 +45,7 @@ end
|
|
45
45
|
severity=nil
|
46
46
|
|
47
47
|
addportwin=Gtk::Window.new
|
48
|
-
|
48
|
+
addportwin.set_icon("#{PIXMAP_PATH}/logo_icon.png")
|
49
49
|
if mode
|
50
50
|
if @treeview.selection.selected == nil
|
51
51
|
return
|
@@ -233,26 +233,26 @@ end
|
|
233
233
|
|
234
234
|
end
|
235
235
|
|
236
|
-
def add_monitored_snmp(mode=nil)
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
236
|
+
def add_monitored_snmp(mode=nil)
|
237
|
+
oidref=nil
|
238
|
+
operator=nil
|
239
|
+
threshold=nil
|
240
|
+
severity=nil
|
241
241
|
|
242
242
|
addsnmpwin=Gtk::Window.new
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
243
|
+
addsnmpwin.set_icon("#{PIXMAP_PATH}/logo_icon.png")
|
244
|
+
if mode
|
245
|
+
if @snmpview.selection.selected == nil
|
246
|
+
return
|
247
|
+
end
|
248
|
+
title="Edit monitored SNMP OID"
|
249
|
+
iter=@snmpview.selection.selected
|
250
|
+
oidref=iter[1]
|
251
|
+
operator=iter[2]
|
252
|
+
threshold=iter[3]
|
253
|
+
severity=iter[4]
|
254
|
+
else
|
255
|
+
title="Add monitored SNMP OID"
|
256
256
|
end
|
257
257
|
|
258
258
|
addsnmpwin.set_title(title)
|
@@ -261,7 +261,7 @@ def add_monitored_snmp(mode=nil)
|
|
261
261
|
|
262
262
|
addsnmpwin.signal_connect("key_press_event") {|w,e|
|
263
263
|
if e.keyval == Gdk::Keyval::GDK_Escape
|
264
|
-
|
264
|
+
addsnmpwin.destroy
|
265
265
|
end
|
266
266
|
}
|
267
267
|
|
@@ -279,56 +279,56 @@ def add_monitored_snmp(mode=nil)
|
|
279
279
|
table = Gtk::Table.new(4,2,false)
|
280
280
|
table.show
|
281
281
|
|
282
|
-
|
282
|
+
label_oidref = Gtk::Label.new "OID Ref"
|
283
283
|
label_oidref.show
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
284
|
+
entry_oidref = Gtk::ComboBox.new
|
285
|
+
OIDRef::get_oid_refs_name().each {|oid|
|
286
|
+
entry_oidref.append_text(oid)
|
287
|
+
}
|
288
|
+
if oidref
|
289
|
+
ind = OIDRef::get_oid_refs_name().index(oidref)
|
290
|
+
entry_oidref.set_active(ind) if ind
|
291
|
+
else
|
292
|
+
entry_oidref.set_active(0)
|
293
|
+
end
|
294
|
+
entry_oidref.set_size_request(150,-1)
|
295
|
+
entry_oidref.show
|
296
|
+
bbox=Gtk::HButtonBox.new
|
297
|
+
bbox.show
|
298
|
+
bbox.add entry_oidref
|
299
299
|
table.attach(label_oidref,0,1,0,1)
|
300
300
|
table.attach(bbox,1,2,0,1)
|
301
301
|
|
302
|
-
|
302
|
+
label_operator = Gtk::Label.new "Operator"
|
303
303
|
label_operator.show
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
304
|
+
entry_operator = Gtk::ComboBox.new
|
305
|
+
SnmpMonitoring::TESTOP.each {|ope|
|
306
|
+
entry_operator.append_text(ope)
|
307
|
+
}
|
308
|
+
if operator
|
309
|
+
ind = SnmpMonitoring::TESTOP.index(operator)
|
310
|
+
entry_operator.set_active(ind) if ind
|
311
|
+
else
|
312
|
+
entry_operator.set_active(0)
|
313
|
+
end
|
314
314
|
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
315
|
+
entry_operator.set_size_request(150,-1)
|
316
|
+
entry_operator.show
|
317
|
+
bbox=Gtk::HButtonBox.new
|
318
|
+
bbox.show
|
319
|
+
bbox.add entry_operator
|
320
320
|
table.attach(label_operator,0,1,1,2)
|
321
321
|
table.attach(bbox,1,2,1,2)
|
322
322
|
|
323
|
-
|
324
|
-
|
323
|
+
entry_threshold = Gtk::Entry.new
|
324
|
+
entry_threshold.set_text(threshold) unless threshold==nil
|
325
325
|
label_threshold = Gtk::Label.new "Threshold"
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
326
|
+
label_threshold.show
|
327
|
+
entry_threshold.set_size_request(150,-1)
|
328
|
+
entry_threshold.show
|
329
|
+
bbox=Gtk::HButtonBox.new
|
330
|
+
bbox.show
|
331
|
+
bbox.add entry_threshold
|
332
332
|
table.attach(label_threshold,0,1,2,3)
|
333
333
|
table.attach(bbox,1,2,2,3)
|
334
334
|
|
@@ -338,109 +338,109 @@ def add_monitored_snmp(mode=nil)
|
|
338
338
|
$status[0..3].each {|sev|
|
339
339
|
entry_sev.append_text(sev)
|
340
340
|
}
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
341
|
+
entry_sev.signal_connect("changed") {
|
342
|
+
entry_sev.child.set_background_gdk(@color_style[entry_sev.active])
|
343
|
+
}
|
344
|
+
ind = 0
|
345
|
+
if severity
|
346
346
|
ind = $status[0..3].index(severity)
|
347
347
|
entry_sev.set_active(ind) if ind
|
348
|
-
|
349
|
-
entry_sev.set_active(ind)
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
348
|
+
else
|
349
|
+
entry_sev.set_active(ind)
|
350
|
+
end
|
351
|
+
entry_sev.child.set_background_gdk(@color_style[ind])
|
352
|
+
|
353
|
+
entry_sev.set_size_request(150,-1)
|
354
|
+
entry_sev.show
|
355
|
+
bbox=Gtk::HButtonBox.new
|
356
|
+
bbox.show
|
357
|
+
bbox.add entry_sev
|
358
358
|
table.attach(label_sev,0,1,3,4)
|
359
359
|
table.attach(bbox,1,2,3,4)
|
360
360
|
|
361
361
|
ok_button = Gtk::Button.new(Gtk::Stock::OK)
|
362
362
|
ok_button.show
|
363
363
|
ok_button.signal_connect("clicked") {
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
364
|
+
if mode
|
365
|
+
#here we just modify this service
|
366
|
+
iter=@snmpview.selection.selected
|
367
|
+
iter[1] = entry_oidref.active_text
|
368
|
+
iter[2] = entry_operator.active_text
|
369
|
+
iter[3] = entry_threshold.text
|
370
|
+
iter[4] = entry_sev.active_text
|
371
|
+
addsnmpwin.destroy()
|
372
|
+
else
|
373
|
+
if isInteger(entry_threshold.text)
|
374
|
+
#need to test if already exists
|
375
|
+
error_detected=0
|
376
|
+
@snmpview.model.each {|model, path, iter|
|
377
|
+
if "#{iter[1]}" == "#{entry_oidref.active_text}"
|
378
|
+
error_detected=1
|
379
|
+
break
|
380
|
+
end
|
381
|
+
}
|
382
|
+
if error_detected == 0
|
383
|
+
iter=@snmpview.model.append
|
384
|
+
iter[0] = 1
|
385
|
+
iter[1] = entry_oidref.active_text
|
386
|
+
iter[2] = entry_operator.active_text
|
387
|
+
iter[3] = entry_threshold.text
|
388
|
+
iter[4] = entry_sev.active_text
|
389
|
+
addsnmpwin.destroy()
|
390
|
+
else
|
391
|
+
errorEntry(addsnmpwin, "OID Ref already set")
|
392
|
+
end
|
393
|
+
else
|
394
|
+
errorEntry(addsnmpwin, "Threshold #{entry_threshold.text} need to be an integer")
|
395
|
+
end
|
396
|
+
end
|
397
397
|
}
|
398
398
|
|
399
399
|
cancel_button = Gtk::Button.new(Gtk::Stock::CANCEL)
|
400
400
|
cancel_button.show
|
401
401
|
cancel_button.signal_connect("clicked") {
|
402
|
-
|
402
|
+
addsnmpwin.destroy
|
403
403
|
}
|
404
404
|
|
405
|
-
|
406
|
-
|
407
|
-
|
405
|
+
bbox =Gtk::HBox::new(FALSE, 10)
|
406
|
+
bbox.border_width=10
|
407
|
+
bbox.show
|
408
408
|
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
409
|
+
ok_button.set_flags(Gtk::Widget::CAN_DEFAULT)
|
410
|
+
bbox.pack_start(ok_button, TRUE, TRUE, 0)
|
411
|
+
cancel_button.set_flags(Gtk::Widget::CAN_DEFAULT)
|
412
|
+
bbox.pack_start(cancel_button, TRUE, TRUE, 0)
|
413
413
|
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
414
|
+
vbox.add(table)
|
415
|
+
separator = Gtk::HSeparator::new()
|
416
|
+
separator.show
|
417
|
+
vbox_root.pack_start(separator, FALSE, TRUE, 0)
|
418
|
+
vbox_root.pack_start(bbox, FALSE, TRUE, 0)
|
419
419
|
|
420
420
|
addsnmpwin.show
|
421
|
-
end
|
421
|
+
end
|
422
422
|
|
423
423
|
|
424
|
-
def add_monitored_wmi(mode=nil)
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
424
|
+
def add_monitored_wmi(mode=nil)
|
425
|
+
wmiref=nil
|
426
|
+
operator=nil
|
427
|
+
value=nil
|
428
|
+
severity=nil
|
429
429
|
|
430
430
|
addwmiwin=Gtk::Window.new
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
431
|
+
addwmiwin.set_icon("#{PIXMAP_PATH}/logo_icon.png")
|
432
|
+
if mode
|
433
|
+
if @wmiview.selection.selected == nil
|
434
|
+
return
|
435
|
+
end
|
436
|
+
title="Edit monitored WMI Ref"
|
437
|
+
iter=@wmiview.selection.selected
|
438
|
+
wmiref=iter[1]
|
439
|
+
operator=iter[2]
|
440
|
+
value=iter[3]
|
441
|
+
severity=iter[4]
|
442
|
+
else
|
443
|
+
title="Add monitored WMI Ref"
|
444
444
|
end
|
445
445
|
|
446
446
|
addwmiwin.set_title(title)
|
@@ -449,7 +449,7 @@ def add_monitored_wmi(mode=nil)
|
|
449
449
|
|
450
450
|
addwmiwin.signal_connect("key_press_event") {|w,e|
|
451
451
|
if e.keyval == Gdk::Keyval::GDK_Escape
|
452
|
-
|
452
|
+
addwmiwin.destroy
|
453
453
|
end
|
454
454
|
}
|
455
455
|
|
@@ -471,13 +471,13 @@ def add_monitored_wmi(mode=nil)
|
|
471
471
|
label_wmiref.show
|
472
472
|
entry_wmiref = Gtk::ComboBox.new
|
473
473
|
WMIRef::get_wmi_refs_name().each {|ref|
|
474
|
-
|
474
|
+
entry_wmiref.append_text(ref)
|
475
475
|
}
|
476
476
|
if wmiref
|
477
|
-
|
478
|
-
|
477
|
+
ind = WMIRef::get_wmi_refs_name().index(wmiref)
|
478
|
+
entry_wmiref.set_active(ind) if ind
|
479
479
|
else
|
480
|
-
|
480
|
+
entry_wmiref.set_active(0)
|
481
481
|
end
|
482
482
|
entry_wmiref.set_size_request(150, -1)
|
483
483
|
entry_wmiref.show
|
@@ -487,125 +487,125 @@ def add_monitored_wmi(mode=nil)
|
|
487
487
|
table.attach(label_wmiref,0,1,0,1)
|
488
488
|
table.attach(bbox,1,2,0,1)
|
489
489
|
|
490
|
-
|
490
|
+
label_operator = Gtk::Label.new "Operator"
|
491
491
|
label_operator.show
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
492
|
+
entry_operator = Gtk::ComboBox.new
|
493
|
+
WmiMonitoring::TESTOP.each {|ope|
|
494
|
+
entry_operator.append_text(ope)
|
495
|
+
}
|
496
|
+
if operator
|
497
|
+
ind = WmiMonitoring::TESTOP.index(operator)
|
498
|
+
entry_operator.set_active(ind) if ind
|
499
|
+
else
|
500
|
+
entry_operator.set_active(0)
|
501
|
+
end
|
502
502
|
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
503
|
+
entry_operator.set_size_request(150, -1)
|
504
|
+
entry_operator.show
|
505
|
+
bbox=Gtk::HButtonBox.new
|
506
|
+
bbox.show
|
507
|
+
bbox.add entry_operator
|
508
508
|
table.attach(label_operator,0,1,1,2)
|
509
509
|
table.attach(bbox,1,2,1,2)
|
510
510
|
|
511
|
-
|
512
|
-
|
511
|
+
entry_value = Gtk::Entry.new
|
512
|
+
entry_value.set_text(value) unless value==nil
|
513
513
|
label_value = Gtk::Label.new "Value"
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
514
|
+
label_value.show
|
515
|
+
entry_value.set_size_request(150, -1)
|
516
|
+
entry_value.show
|
517
|
+
bbox=Gtk::HButtonBox.new
|
518
|
+
bbox.show
|
519
|
+
bbox.add entry_value
|
520
520
|
table.attach(label_value,0,1,2,3)
|
521
521
|
table.attach(bbox,1,2,2,3)
|
522
522
|
|
523
|
-
|
523
|
+
label_sev = Gtk::Label.new "Severity"
|
524
524
|
label_sev.show
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
525
|
+
entry_sev = Gtk::ComboBox.new
|
526
|
+
$status[0..3].each {|sev|
|
527
|
+
entry_sev.append_text(sev)
|
528
|
+
}
|
529
|
+
entry_sev.signal_connect("changed") {
|
530
|
+
entry_sev.child.set_background_gdk(@color_style[entry_sev.active])
|
531
|
+
}
|
532
|
+
ind = 0
|
533
|
+
if severity
|
534
534
|
ind = $status[0..3].index(severity)
|
535
535
|
entry_sev.set_active(ind) if ind
|
536
|
-
|
537
|
-
entry_sev.set_active(ind)
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
536
|
+
else
|
537
|
+
entry_sev.set_active(ind)
|
538
|
+
end
|
539
|
+
entry_sev.child.set_background_gdk(@color_style[ind])
|
540
|
+
entry_sev.set_size_request(150, -1)
|
541
|
+
entry_sev.show
|
542
|
+
bbox=Gtk::HButtonBox.new
|
543
|
+
bbox.show
|
544
|
+
bbox.add entry_sev
|
545
545
|
table.attach(label_sev,0,1,3,4)
|
546
546
|
table.attach(bbox,1,2,3,4)
|
547
547
|
|
548
548
|
ok_button = Gtk::Button.new(Gtk::Stock::OK)
|
549
549
|
ok_button.show
|
550
550
|
ok_button.signal_connect("clicked") {
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
551
|
+
if mode
|
552
|
+
#here we just modify this service
|
553
|
+
iter=@wmiview.selection.selected
|
554
|
+
iter[1] = entry_wmiref.active_text
|
555
|
+
iter[2] = entry_operator.active_text
|
556
|
+
iter[3] = entry_value.text
|
557
|
+
iter[4] = entry_sev.active_text
|
558
|
+
addwmiwin.destroy()
|
559
|
+
else
|
560
|
+
if entry_value.text != ""
|
561
|
+
#need to test if already exists
|
562
|
+
error_detected=0
|
563
|
+
@wmiview.model.each {|model, path, iter|
|
564
|
+
if "#{iter[1]}" == "#{entry_wmiref.active_text}"
|
565
|
+
error_detected=1
|
566
|
+
break
|
567
|
+
end
|
568
|
+
}
|
569
|
+
if error_detected == 0
|
570
|
+
iter=@wmiview.model.append
|
571
|
+
iter[0] = 1
|
572
|
+
iter[1] = entry_wmiref.active_text
|
573
|
+
iter[2] = entry_operator.active_text
|
574
|
+
iter[3] = entry_value.text
|
575
|
+
iter[4] = entry_sev.active_text
|
576
|
+
addwmiwin.destroy()
|
577
|
+
else
|
578
|
+
errorEntry(addwmiwin, "WMI Ref already set")
|
579
|
+
end
|
580
|
+
else
|
581
|
+
errorEntry(addwmiwin, "WMI Ref, you must set a value")
|
582
|
+
end
|
583
|
+
end
|
584
584
|
}
|
585
585
|
|
586
586
|
cancel_button = Gtk::Button.new(Gtk::Stock::CANCEL)
|
587
587
|
cancel_button.show
|
588
588
|
cancel_button.signal_connect("clicked") {
|
589
|
-
|
589
|
+
addwmiwin.destroy
|
590
590
|
}
|
591
591
|
|
592
|
-
|
593
|
-
|
594
|
-
|
592
|
+
bbox =Gtk::HBox::new(FALSE, 10)
|
593
|
+
bbox.border_width=10
|
594
|
+
bbox.show
|
595
595
|
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
596
|
+
ok_button.set_flags(Gtk::Widget::CAN_DEFAULT)
|
597
|
+
bbox.pack_start(ok_button, TRUE, TRUE, 0)
|
598
|
+
cancel_button.set_flags(Gtk::Widget::CAN_DEFAULT)
|
599
|
+
bbox.pack_start(cancel_button, TRUE, TRUE, 0)
|
600
600
|
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
601
|
+
vbox.add(table)
|
602
|
+
separator = Gtk::HSeparator::new()
|
603
|
+
separator.show
|
604
|
+
vbox_root.pack_start(separator, FALSE, TRUE, 0)
|
605
|
+
vbox_root.pack_start(bbox, FALSE, TRUE, 0)
|
606
606
|
|
607
607
|
addwmiwin.show
|
608
|
-
end
|
608
|
+
end
|
609
609
|
|
610
610
|
def add_monitored_jmx(node, mode=nil)
|
611
611
|
jmxref=nil
|
@@ -615,7 +615,7 @@ def add_monitored_jmx(node, mode=nil)
|
|
615
615
|
jmxattr_h=Hash.new
|
616
616
|
|
617
617
|
addjmxwin=Gtk::Window.new
|
618
|
-
|
618
|
+
addjmxwin.set_icon("#{PIXMAP_PATH}/logo_icon.png")
|
619
619
|
if mode
|
620
620
|
if @jmxview.selection.selected == nil
|
621
621
|
return
|
@@ -1022,6 +1022,7 @@ def add_monitored_snmptrap(mode=nil)
|
|
1022
1022
|
end
|
1023
1023
|
|
1024
1024
|
addsnmptrapwin=Gtk::Window.new
|
1025
|
+
addsnmptrapwin.set_icon("#{PIXMAP_PATH}/logo_icon.png")
|
1025
1026
|
addsnmptrapwin.set_title(title)
|
1026
1027
|
addsnmptrapwin.set_size_request(340, -1)
|
1027
1028
|
addsnmptrapwin.set_modal(true)
|
@@ -1170,6 +1171,7 @@ def add_monitored_syslog(mode=nil)
|
|
1170
1171
|
end
|
1171
1172
|
|
1172
1173
|
addsyslogwin=Gtk::Window.new
|
1174
|
+
addsyslogwin.set_icon("#{PIXMAP_PATH}/logo_icon.png")
|
1173
1175
|
addsyslogwin.set_title(title)
|
1174
1176
|
addsyslogwin.set_size_request(340, -1)
|
1175
1177
|
addsyslogwin.set_modal(true)
|
@@ -1407,8 +1409,10 @@ def fill_port_list(node)
|
|
1407
1409
|
end
|
1408
1410
|
end
|
1409
1411
|
|
1410
|
-
|
1411
|
-
|
1412
|
+
#
|
1413
|
+
# scan all ports
|
1414
|
+
#
|
1415
|
+
def scan_ports_now(node)
|
1412
1416
|
@scan_port_th=Thread.new {
|
1413
1417
|
labelwait=Gtk::Label.new("Waiting scanning ports ...")
|
1414
1418
|
labelwait.show
|
@@ -1425,6 +1429,28 @@ def scan_port_now(node)
|
|
1425
1429
|
}
|
1426
1430
|
end
|
1427
1431
|
|
1432
|
+
#
|
1433
|
+
# scan only one port
|
1434
|
+
#
|
1435
|
+
def scan_port_now(node)
|
1436
|
+
if @treeview.selection.selected != nil
|
1437
|
+
iter = @treeview.selection.selected
|
1438
|
+
proto = iter[1]
|
1439
|
+
port = iter[2]
|
1440
|
+
msgbody = "#{proto.upcase}/#{port} seems down"
|
1441
|
+
#check if port is up
|
1442
|
+
if scan_port(node.ip, proto, port) == 1
|
1443
|
+
msgbody = "#{proto.upcase}/#{port} seems up"
|
1444
|
+
end
|
1445
|
+
dialog = Gtk::MessageDialog.new(@window, Gtk::Dialog::MODAL,
|
1446
|
+
Gtk::MessageDialog::INFO,
|
1447
|
+
Gtk::MessageDialog::BUTTONS_OK,
|
1448
|
+
msgbody)
|
1449
|
+
dialog.set_icon("#{PIXMAP_PATH}/logo_icon.png")
|
1450
|
+
dialog.signal_connect('response') { dialog.destroy }
|
1451
|
+
dialog.show
|
1452
|
+
end
|
1453
|
+
end
|
1428
1454
|
|
1429
1455
|
###############################################################
|
1430
1456
|
def initialize (node)
|
@@ -2634,13 +2660,20 @@ eval IO.read("#{GNMSLIB}"+'/gui/sub/account_frame.rb')
|
|
2634
2660
|
item_edit_serv.signal_connect("activate") { edit_monitored_service() }
|
2635
2661
|
menu_port.append(item_edit_serv)
|
2636
2662
|
|
2637
|
-
scan_port_serv = Gtk::ImageMenuItem.new("
|
2663
|
+
scan_port_serv = Gtk::ImageMenuItem.new("Test service")
|
2638
2664
|
image_scan_port_serv = Gtk::Image.new()
|
2639
|
-
image_scan_port_serv.set_stock(Gtk::Stock::
|
2665
|
+
image_scan_port_serv.set_stock(Gtk::Stock::DIALOG_QUESTION)
|
2640
2666
|
scan_port_serv.set_image(image_scan_port_serv)
|
2641
2667
|
scan_port_serv.signal_connect("activate") { scan_port_now(node) }
|
2642
2668
|
menu_port.append(scan_port_serv)
|
2643
2669
|
|
2670
|
+
scan_ports_serv = Gtk::ImageMenuItem.new("Scan all ports")
|
2671
|
+
image_scan_ports_serv = Gtk::Image.new()
|
2672
|
+
image_scan_ports_serv.set_stock(Gtk::Stock::REFRESH)
|
2673
|
+
scan_ports_serv.set_image(image_scan_ports_serv)
|
2674
|
+
scan_ports_serv.signal_connect("activate") { scan_ports_now(node) }
|
2675
|
+
menu_port.append(scan_ports_serv)
|
2676
|
+
|
2644
2677
|
item_sw_serv = Gtk::MenuItem.new("Switch selection")
|
2645
2678
|
item_sw_serv.signal_connect("activate") { toggle_select_port() }
|
2646
2679
|
menu_port.append(item_sw_serv)
|
@@ -2657,15 +2690,16 @@ eval IO.read("#{GNMSLIB}"+'/gui/sub/account_frame.rb')
|
|
2657
2690
|
if @treeview.selection.selected==nil
|
2658
2691
|
item_edit_serv.set_sensitive(false)
|
2659
2692
|
item_del_serv.set_sensitive(false)
|
2660
|
-
|
2693
|
+
scan_port_serv.set_sensitive(false)
|
2661
2694
|
else
|
2662
2695
|
item_edit_serv.set_sensitive(true)
|
2663
2696
|
item_del_serv.set_sensitive(true)
|
2697
|
+
scan_port_serv.set_sensitive(true)
|
2664
2698
|
end
|
2665
2699
|
if $config.nmap_vers.to_f() == 0.0
|
2666
|
-
|
2700
|
+
scan_ports_serv.set_sensitive(false)
|
2667
2701
|
else
|
2668
|
-
|
2702
|
+
scan_ports_serv.set_sensitive(true)
|
2669
2703
|
end
|
2670
2704
|
menu_port.popup(nil, nil, event.button, event.time)
|
2671
2705
|
elsif (@treeview.selection.selected!=nil) && (event.event_type == Gdk::Event::BUTTON2_PRESS)
|