gnms 2.1.0.rc2 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/gnms.gemspec +6 -6
- data/lib/cmd_parse.rb +64 -68
- data/lib/config_global.rb +7 -7
- data/lib/format.rb +17 -0
- data/lib/gnms.rb +8 -9
- data/lib/gui/adddelnode.rb +108 -9
- data/lib/gui/base_window.rb +12 -10
- data/lib/gui/config_window.rb +9 -15
- data/lib/gui/help_window.rb +4 -4
- data/lib/gui/ipcalculator.rb +1 -1
- data/lib/gui/node_host_property.rb +15 -10
- data/lib/gui/update_window.rb +4 -1
- data/lib/main.rb +70 -3
- data/lib/monitor/client/snmp/snmp.rb +7 -1
- data/lib/node.rb +5 -2
- data/lib/node_listener.rb +266 -105
- data/plugins/FooMonitor.rb +3 -0
- data/plugins/HttpVirtualHostMonitor.rb +1 -1
- data/plugins/MysqlShowStatusMonitor.rb +4 -1
- data/plugins/PgsqlPercentConnectionMonitor.rb +3 -0
- data/plugins/SshDiskMonitor.rb +3 -0
- data/plugins/SshFgtAvExpiredMonitor.rb +3 -0
- data/plugins/SshPercentUsedRamMonitor.rb +3 -0
- metadata +174 -181
data/lib/node.rb
CHANGED
|
@@ -578,10 +578,13 @@ class Node
|
|
|
578
578
|
# get severity associated to a given proto/port
|
|
579
579
|
#
|
|
580
580
|
def get_service_sev(protocol, port)
|
|
581
|
-
|
|
581
|
+
serv = @service[service_key(protocol, port)]
|
|
582
|
+
if serv.nil?
|
|
583
|
+
return 0
|
|
584
|
+
end
|
|
585
|
+
return serv.severity
|
|
582
586
|
end
|
|
583
587
|
|
|
584
|
-
|
|
585
588
|
def add_wmi_monitoring(state, wmiref_name, op, val, sev, status=nil)
|
|
586
589
|
if @wmi_monitoring[wmiref_name] == nil
|
|
587
590
|
if WMIRef::wmi_ref_exist?(wmiref_name)
|
data/lib/node_listener.rb
CHANGED
|
@@ -291,7 +291,9 @@ def tresolvip()
|
|
|
291
291
|
$host[ip].change_label()
|
|
292
292
|
end
|
|
293
293
|
rescue Resolv::ResolvError
|
|
294
|
-
|
|
294
|
+
$log.debug("tresolvip: can't find dns name for address #{ip}");
|
|
295
|
+
rescue Errno::ENETUNREACH
|
|
296
|
+
$log.error("tresolvip: network is unreachable");
|
|
295
297
|
end
|
|
296
298
|
}
|
|
297
299
|
sleep(5)
|
|
@@ -312,26 +314,166 @@ end
|
|
|
312
314
|
# read arp, route, interface from a snmp host
|
|
313
315
|
|
|
314
316
|
def tresolvesnmp()
|
|
315
|
-
|
|
316
|
-
|
|
317
|
+
Thread.start {
|
|
318
|
+
while $config.node_resolving
|
|
319
|
+
$log.debug("in tresolvesnmp every #{$config.node_resolving_delay.to_i} second")
|
|
320
|
+
sleep($config.node_resolving_delay.to_i) #wait before all window are maps
|
|
321
|
+
ip_table=$host.keys
|
|
322
|
+
for ip in ip_table
|
|
323
|
+
if !$config.node_resolving
|
|
324
|
+
break
|
|
325
|
+
end
|
|
326
|
+
node = $host[ip]
|
|
327
|
+
if node and (!defined?($in_confirm_exit_window) || ($in_confirm_exit_window == false))
|
|
328
|
+
#code here
|
|
329
|
+
community_pub = $config.read_community
|
|
330
|
+
community_priv = $config.write_community
|
|
331
|
+
if node.get_account_id("snmp")
|
|
332
|
+
community_pub, community_priv = node.get_account_id("snmp")
|
|
333
|
+
end
|
|
317
334
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
+
new_node = Struct.new(:ip, :mac, :netmask, :status)
|
|
336
|
+
new_node_array = Array.new
|
|
337
|
+
|
|
338
|
+
begin
|
|
339
|
+
new_node_array.clear
|
|
340
|
+
SNMP::Manager.open(:Host => ip, :Community => community_pub, :Version => get_snmp_version(node.get_default_inherit_snmp_version()), :Port => node.get_default_inherit_snmp_port().to_i, :Timeout => node.get_default_inherit_snmp_timeout().to_i, :Retries => node.get_default_inherit_snmp_retry().to_i) do |manager|
|
|
341
|
+
|
|
342
|
+
#extract ip addr from interfaces
|
|
343
|
+
ip_addr_t = Array.new
|
|
344
|
+
interface_netmask_h = Hash.new
|
|
345
|
+
manager.walk("1.3.6.1.2.1.4.20.1.1") {|vb|
|
|
346
|
+
ip_addr_t.push vb.value.to_s
|
|
347
|
+
}
|
|
348
|
+
ip_addr_t.each {|ip|
|
|
349
|
+
interface_id = nil
|
|
350
|
+
netmask_addr = nil
|
|
351
|
+
mac_addr = nil
|
|
352
|
+
#unknown status
|
|
353
|
+
status = 4
|
|
354
|
+
#get interface id
|
|
355
|
+
response = manager.get("1.3.6.1.2.1.4.20.1.2.#{ip}")
|
|
356
|
+
response.each_varbind {|vb|
|
|
357
|
+
interface_id = vb.value.to_i
|
|
358
|
+
}
|
|
359
|
+
#extract mac addr for these interfaces based on ifPhysAddress
|
|
360
|
+
response = manager.get("1.3.6.1.2.1.2.2.1.6.#{interface_id}")
|
|
361
|
+
response.each_varbind {|vb|
|
|
362
|
+
mac_addr = vb.value.unpack('H*').join.scan(/.{2}|.+/).join(":")
|
|
363
|
+
}
|
|
364
|
+
#extract interface status
|
|
365
|
+
response = manager.get("1.3.6.1.2.1.2.2.1.8.#{interface_id}")
|
|
366
|
+
response.each_varbind {|vb|
|
|
367
|
+
status = vb.value.to_i
|
|
368
|
+
}
|
|
369
|
+
#get netmask
|
|
370
|
+
response = manager.get("1.3.6.1.2.1.4.20.1.3.#{ip}")
|
|
371
|
+
response.each_varbind {|vb|
|
|
372
|
+
netmask_addr = vb.value.to_s
|
|
373
|
+
}
|
|
374
|
+
interface_netmask_h[interface_id] = netmask_addr unless interface_id.nil?
|
|
375
|
+
if mac_addr.nil? or mac_addr.empty? or (mac_addr == NILMAC)
|
|
376
|
+
mac_addr = Node::NOARP_PROPERTY
|
|
377
|
+
end
|
|
378
|
+
#print ip, " ", mac_addr, " ", netmask_addr, " ", interface_id, "\n"
|
|
379
|
+
new_node_array.push new_node.new(ip, mac_addr, netmask_addr, status)
|
|
380
|
+
}
|
|
381
|
+
#propagate the search if requested
|
|
382
|
+
if $config.find_node_state
|
|
383
|
+
status = 4
|
|
384
|
+
manager.walk("1.3.6.1.2.1.4.22.1.2") { |vb|
|
|
385
|
+
#remove mib header and extract interface id and ip
|
|
386
|
+
ip_from_mib = vb.name.to_s.match(/^.+\.(\d+)\.(\d+\.\d+\.\d+\.\d+)$/)
|
|
387
|
+
interface_id = $1.to_i
|
|
388
|
+
ip_from_mib = $2.to_s
|
|
389
|
+
mac_from_mib = vb.value.unpack('H*').join.scan(/.{2}|.+/).join(":")
|
|
390
|
+
|
|
391
|
+
mask = DEFAULT_CLASS_C_NETMASK
|
|
392
|
+
if (interface_id >=0) and interface_netmask_h[interface_id]
|
|
393
|
+
mask = interface_netmask_h[interface_id]
|
|
394
|
+
end
|
|
395
|
+
#print ip_from_mib," ",mac_from_mib," ", mask, "\n"
|
|
396
|
+
new_node_array.push new_node.new(ip_from_mib, mac_from_mib, mask, status)
|
|
397
|
+
}
|
|
398
|
+
end
|
|
399
|
+
|
|
400
|
+
new_node_array.each {|nnode|
|
|
401
|
+
if isValidIPv4(nnode.ip) and (nnode.mac != NILMAC) and isValidMac(nnode.mac)
|
|
402
|
+
if $host[nnode.ip]
|
|
403
|
+
#node already exists, check the mac
|
|
404
|
+
if $host[nnode.ip].mac != Node::NOARP_PROPERTY
|
|
405
|
+
if $host[nnode.ip].mac != nnode.mac
|
|
406
|
+
$event_win.add_event(EventWindow::AVAIL_EVENT_TYPE, "WARN", $host[nnode.ip], "Hardware MAC@ collision, find #{nnode.mac}")
|
|
407
|
+
end
|
|
408
|
+
else
|
|
409
|
+
#mac is not set for this node at this point, so adding it
|
|
410
|
+
$host[nnode.ip].mac = nnode.mac
|
|
411
|
+
#ifOperStatus = The current operational state of the interface
|
|
412
|
+
#Values
|
|
413
|
+
#1 : up
|
|
414
|
+
#2 : down
|
|
415
|
+
#3 : testing
|
|
416
|
+
#4 : unknown
|
|
417
|
+
#5 : dormant
|
|
418
|
+
#6 : notPresent
|
|
419
|
+
#7 : lowerLayerDown
|
|
420
|
+
if nnode.status == 1
|
|
421
|
+
$host[nnode.ip].set_avail_severity(NORMAL)
|
|
422
|
+
elsif nnode.status == 2
|
|
423
|
+
$host[nnode.ip].set_avail_severity(CRITICAL)
|
|
424
|
+
end
|
|
425
|
+
end
|
|
426
|
+
else
|
|
427
|
+
if !$config.visible() and !in_exception_list(nnode.ip)
|
|
428
|
+
#node is not existing
|
|
429
|
+
if ($network_map_always == 1) and isValidIPv4($network_map_result) and !$network.has_key?($network_map_result)
|
|
430
|
+
$network_map_always = 0
|
|
431
|
+
$network_map_result = nil
|
|
432
|
+
end
|
|
433
|
+
if $network_map_always == 0
|
|
434
|
+
choose_network_map(nnode.ip)
|
|
435
|
+
while $network_map_result.nil?
|
|
436
|
+
sleep(2)
|
|
437
|
+
end
|
|
438
|
+
end
|
|
439
|
+
if !$network_map_result.nil? and !$network_map_result.empty?
|
|
440
|
+
if isValidIPv4($network_map_result)
|
|
441
|
+
map = $network_map_result
|
|
442
|
+
if $network.has_key?(map)
|
|
443
|
+
#mask depends on the interface where we found this node ip
|
|
444
|
+
if nnode.status == 1
|
|
445
|
+
addhostentry(nnode.ip, nnode.netmask, map, nnode.mac, NORMAL)
|
|
446
|
+
elsif nnode.status == 2
|
|
447
|
+
addhostentry(nnode.ip, nnode.netmask, map, nnode.mac, CRITICAL)
|
|
448
|
+
else
|
|
449
|
+
addhostentry(nnode.ip, nnode.netmask, map, nnode.mac)
|
|
450
|
+
end
|
|
451
|
+
sleep(2)
|
|
452
|
+
end
|
|
453
|
+
else
|
|
454
|
+
add_node_def_exception_list(nnode.ip)
|
|
455
|
+
end
|
|
456
|
+
end
|
|
457
|
+
if $network_map_always == 0
|
|
458
|
+
$network_map_result = nil
|
|
459
|
+
end
|
|
460
|
+
end
|
|
461
|
+
end
|
|
462
|
+
end
|
|
463
|
+
}
|
|
464
|
+
end #new_node_array
|
|
465
|
+
rescue SNMP::RequestTimeout
|
|
466
|
+
$log.debug("tresolvesnmp: request timeout to #{ip} port: #{node.get_default_inherit_snmp_port().to_i} community: #{community_pub} snmp_version: #{get_snmp_version(node.get_default_inherit_snmp_version())}")
|
|
467
|
+
rescue Errno::ENETUNREACH
|
|
468
|
+
$log.error("tresolvesnmp: network is unreachable")
|
|
469
|
+
rescue Exception => msg
|
|
470
|
+
$log.error("tresolvesnmp: #{msg}\n#{msg.backtrace.join("\n")}")
|
|
471
|
+
end
|
|
472
|
+
end
|
|
473
|
+
sleep($config.node_resolving_delay.to_i)
|
|
474
|
+
end
|
|
475
|
+
end
|
|
476
|
+
}
|
|
335
477
|
end
|
|
336
478
|
|
|
337
479
|
#
|
|
@@ -371,7 +513,7 @@ def tmacip ()
|
|
|
371
513
|
if res != ""
|
|
372
514
|
if $host[ip] && $host[ip].mac != res && $host[ip].status != CRITICAL
|
|
373
515
|
$host[ip].set_avail_severity(MINOR)
|
|
374
|
-
$event_win.add_event(EventWindow::AVAIL_EVENT_TYPE, "WARN", $host[ip], "
|
|
516
|
+
$event_win.add_event(EventWindow::AVAIL_EVENT_TYPE, "WARN", $host[ip], "Hardware MAC@ changed")
|
|
375
517
|
else
|
|
376
518
|
if $host[ip].status == MINOR
|
|
377
519
|
$host[ip].set_avail_severity(CRITICAL)
|
|
@@ -408,11 +550,11 @@ end
|
|
|
408
550
|
|
|
409
551
|
def t_find_remote_new_host ()
|
|
410
552
|
Thread.start {
|
|
411
|
-
while $config.
|
|
412
|
-
sleep($config.
|
|
553
|
+
while $config.find_node_state
|
|
554
|
+
sleep($config.find_node_delay.to_i)
|
|
413
555
|
$log.debug("in t_find_remote_new_host")
|
|
414
556
|
$network.each_value {|node|
|
|
415
|
-
if !$config.
|
|
557
|
+
if !$config.find_node_state
|
|
416
558
|
break
|
|
417
559
|
end
|
|
418
560
|
if node.ip != ROOTMAPADDR
|
|
@@ -426,7 +568,7 @@ def t_find_remote_new_host ()
|
|
|
426
568
|
end
|
|
427
569
|
end
|
|
428
570
|
}
|
|
429
|
-
sleep($config.
|
|
571
|
+
sleep($config.find_node_delay.to_i)
|
|
430
572
|
end
|
|
431
573
|
}
|
|
432
574
|
end
|
|
@@ -451,42 +593,48 @@ end
|
|
|
451
593
|
# listen for new host in local network (broadcast)
|
|
452
594
|
#
|
|
453
595
|
def t_find_local_segment_pinging()
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
596
|
+
Thread.start {
|
|
597
|
+
while $config.find_node_state
|
|
598
|
+
sleep($config.find_node_delay.to_i)
|
|
599
|
+
if !defined?($in_confirm_exit_window) || ($in_confirm_exit_window == false)
|
|
600
|
+
mask=local_mask()
|
|
601
|
+
mask = DEFAULT_CLASS_C_NETMASK if !mask
|
|
602
|
+
for ip in broadcast_ping
|
|
603
|
+
#puts "t_find_local_segment_pinging #{ip} #{mask}"
|
|
604
|
+
#test if network was removed during the time
|
|
605
|
+
if ($network_map_always == 1) and isValidIPv4($network_map_result) and !$network.has_key?($network_map_result)
|
|
606
|
+
$network_map_always = 0
|
|
607
|
+
$network_map_result = nil
|
|
608
|
+
end
|
|
609
|
+
if $host and $host[ip].nil?
|
|
610
|
+
if !$config.visible() and !in_exception_list(ip)
|
|
611
|
+
if $network_map_always == 0
|
|
612
|
+
choose_network_map(ip, IPCalc.get_network_addr(ip, mask))
|
|
613
|
+
while $network_map_result.nil?
|
|
614
|
+
sleep(2)
|
|
615
|
+
end
|
|
616
|
+
end
|
|
617
|
+
if !$network_map_result.nil? and !$network_map_result.empty?
|
|
618
|
+
if isValidIPv4($network_map_result)
|
|
619
|
+
map = $network_map_result
|
|
620
|
+
if $network.has_key?(map)
|
|
621
|
+
addhostentry(ip, mask, map)
|
|
622
|
+
sleep(2)
|
|
623
|
+
end
|
|
624
|
+
else
|
|
625
|
+
add_node_def_exception_list(ip)
|
|
626
|
+
end
|
|
627
|
+
end
|
|
628
|
+
if $network_map_always == 0
|
|
629
|
+
$network_map_result = nil
|
|
630
|
+
end
|
|
631
|
+
end
|
|
632
|
+
end
|
|
633
|
+
end
|
|
634
|
+
end
|
|
635
|
+
sleep($config.find_node_delay.to_i)
|
|
636
|
+
end
|
|
637
|
+
}
|
|
490
638
|
end
|
|
491
639
|
|
|
492
640
|
#
|
|
@@ -508,7 +656,7 @@ def t_find_local_segment_sniffing()
|
|
|
508
656
|
if iface
|
|
509
657
|
Thread.start {
|
|
510
658
|
cap = PacketFu::Capture.new(:iface => iface, :start => false)
|
|
511
|
-
begin
|
|
659
|
+
begin
|
|
512
660
|
cap.bpf(:filter => 'not ip')
|
|
513
661
|
rescue
|
|
514
662
|
$log.info("Can't set the bpf filter for sniff packets")
|
|
@@ -517,70 +665,77 @@ def t_find_local_segment_sniffing()
|
|
|
517
665
|
loop do
|
|
518
666
|
cap.stream.each do |p|
|
|
519
667
|
pkt = PacketFu::Packet.parse p
|
|
520
|
-
|
|
668
|
+
if $config.find_node_state and !$config.visible()
|
|
521
669
|
if pkt.is_arp?
|
|
522
|
-
|
|
523
|
-
|
|
670
|
+
#check if it's ethernet and arp reply
|
|
671
|
+
if pkt.arp_hw == 1 and pkt.arp_opcode == 2
|
|
524
672
|
ip_mac_t = Array.new
|
|
525
673
|
ip_mac_t.push([pkt.arp_saddr_ip, pkt.arp_saddr_mac])
|
|
526
674
|
ip_mac_t.push([pkt.arp_daddr_ip, pkt.arp_daddr_mac])
|
|
527
675
|
ip_mac_t.each {|ip, mac|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
676
|
+
$log.debug("t_find_local_segment_sniffing: ARP reply founds ip=#{ip} mac=#{mac}")
|
|
677
|
+
if isValidIPv4(ip) and !exist_host(ip) and !in_exception_list(ip)
|
|
678
|
+
if $network_map_always == 0
|
|
679
|
+
choose_network_map(ip)
|
|
680
|
+
while $network_map_result.nil?
|
|
681
|
+
sleep(2)
|
|
682
|
+
end
|
|
534
683
|
end
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
684
|
+
if !$network_map_result.nil? and !$network_map_result.empty?
|
|
685
|
+
if isValidIPv4($network_map_result)
|
|
686
|
+
map = $network_map_result
|
|
687
|
+
if $network.has_key?(map)
|
|
688
|
+
addhostentry(ip, 24, map)
|
|
689
|
+
sleep(2)
|
|
690
|
+
if $host[ip]
|
|
691
|
+
$host[ip].mac = mac
|
|
692
|
+
end
|
|
693
|
+
end
|
|
694
|
+
else
|
|
695
|
+
add_node_def_exception_list(ip)
|
|
696
|
+
end
|
|
697
|
+
end
|
|
698
|
+
if $network_map_always == 0
|
|
699
|
+
$network_map_result = nil
|
|
544
700
|
end
|
|
545
701
|
end
|
|
546
|
-
if $network_map_always == 0
|
|
547
|
-
$network_map_result = nil
|
|
548
|
-
end
|
|
549
|
-
end
|
|
550
702
|
}
|
|
551
|
-
|
|
703
|
+
end
|
|
552
704
|
end
|
|
553
705
|
begin
|
|
554
|
-
|
|
706
|
+
if pkt.is_lldp?
|
|
555
707
|
$log.debug("t_find_local_segment_sniffing: LLDP founds ip=#{pkt.lldp_address} mac=#{pkt.lldp_saddr_mac}")
|
|
556
|
-
if (pkt.lldp_address_type_readable == "IPv4") and isValidIPv4(pkt.lldp_address) and !exist_host(pkt.lldp_address)
|
|
557
|
-
puts pkt.lldp_address
|
|
708
|
+
if (pkt.lldp_address_type_readable == "IPv4") and isValidIPv4(pkt.lldp_address) and !exist_host(pkt.lldp_address) and !in_exception_list(pkt.lldp_address)
|
|
558
709
|
if $network_map_always == 0
|
|
559
710
|
choose_network_map(pkt.lldp_address)
|
|
560
711
|
while $network_map_result.nil?
|
|
561
|
-
|
|
712
|
+
sleep(2)
|
|
562
713
|
end
|
|
563
714
|
end
|
|
564
715
|
if !$network_map_result.nil? and !$network_map_result.empty?
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
$host[pkt.lldp_address]
|
|
571
|
-
|
|
572
|
-
|
|
716
|
+
if isValidIPv4($network_map_result)
|
|
717
|
+
map = $network_map_result
|
|
718
|
+
if $network.has_key?(map)
|
|
719
|
+
addhostentry(pkt.lldp_address, 24, map)
|
|
720
|
+
sleep(2)
|
|
721
|
+
if $host[pkt.lldp_address]
|
|
722
|
+
$host[pkt.lldp_address].mac = pkt.lldp_saddr_mac
|
|
723
|
+
$host[pkt.lldp_address].name = pkt.lldp_system_name
|
|
724
|
+
end
|
|
725
|
+
end
|
|
726
|
+
else
|
|
727
|
+
add_node_def_exception_list(pkt.lldp_address)
|
|
573
728
|
end
|
|
574
729
|
end
|
|
575
730
|
if $network_map_always == 0
|
|
576
731
|
$network_map_result = nil
|
|
577
732
|
end
|
|
578
|
-
end
|
|
579
|
-
|
|
733
|
+
end
|
|
734
|
+
end
|
|
580
735
|
rescue NoMethodError
|
|
581
|
-
|
|
736
|
+
#current gem version does not support lldp patch i sent
|
|
582
737
|
end
|
|
583
|
-
|
|
738
|
+
end
|
|
584
739
|
end
|
|
585
740
|
end
|
|
586
741
|
}
|
|
@@ -626,16 +781,22 @@ end
|
|
|
626
781
|
#
|
|
627
782
|
# Add new lign entry > pixmap & host-ip-button
|
|
628
783
|
#
|
|
629
|
-
def addhostentry(ip, mask, map=nil)
|
|
784
|
+
def addhostentry(ip, mask, map=nil, mac=nil, avail=nil)
|
|
630
785
|
#if host doesnt exist in array
|
|
631
786
|
if $host[ip] == nil
|
|
632
787
|
$event_win.add_event(EventWindow::CORE_EVENT_TYPE, "INFO", $host[ip], "Find new host")
|
|
633
788
|
Gtk.thread_protect do
|
|
634
|
-
|
|
789
|
+
if map
|
|
635
790
|
add_host(ip, mask, map)
|
|
636
|
-
|
|
637
|
-
add_host(ip,mask)
|
|
791
|
+
else
|
|
792
|
+
add_host(ip, mask)
|
|
638
793
|
end
|
|
794
|
+
if !mac.nil?
|
|
795
|
+
$host[ip].mac = mac
|
|
796
|
+
end
|
|
797
|
+
if !avail.nil?
|
|
798
|
+
$host[ip].set_avail_severity(avail)
|
|
799
|
+
end
|
|
639
800
|
end
|
|
640
801
|
end
|
|
641
802
|
end
|