Class: ConfigGlobal
- Inherits:
-
Object
- Object
- ConfigGlobal
- Defined in:
- lib/config_global.rb
Constant Summary collapse
- DEFAULT_MAIL_SERVER =
"localhost"
- DEFAULT_MAIL_SERVER_PORT =
"25"
- DEFAULT_SOUND_FILE =
"Just beep"
Instance Attribute Summary collapse
-
#active_find_node_delay ⇒ Object
readonly
Returns the value of attribute active_find_node_delay.
-
#active_find_node_state ⇒ Object
readonly
Returns the value of attribute active_find_node_state.
-
#auto_save_map ⇒ Object
readonly
Returns the value of attribute auto_save_map.
-
#auto_save_map_value ⇒ Object
readonly
Returns the value of attribute auto_save_map_value.
-
#bg_type ⇒ Object
Returns the value of attribute bg_type.
-
#browser_path ⇒ Object
readonly
Returns the value of attribute browser_path.
-
#confirm_delete ⇒ Object
readonly
Returns the value of attribute confirm_delete.
-
#confirm_quit ⇒ Object
readonly
Returns the value of attribute confirm_quit.
-
#custom_mon ⇒ Object
readonly
Returns the value of attribute custom_mon.
-
#custom_mon_delay ⇒ Object
readonly
Returns the value of attribute custom_mon_delay.
-
#default_height ⇒ Object
readonly
Returns the value of attribute default_height.
-
#default_map ⇒ Object
readonly
Returns the value of attribute default_map.
-
#default_width ⇒ Object
readonly
Returns the value of attribute default_width.
-
#host_icon_view ⇒ Object
Returns the value of attribute host_icon_view.
-
#host_label_view ⇒ Object
Returns the value of attribute host_label_view.
-
#im_daemon ⇒ Object
readonly
Returns the value of attribute im_daemon.
-
#im_dest_by_level ⇒ Object
Returns the value of attribute im_dest_by_level.
-
#im_login ⇒ Object
readonly
Returns the value of attribute im_login.
-
#im_password ⇒ Object
readonly
Returns the value of attribute im_password.
-
#image_path ⇒ Object
Returns the value of attribute image_path.
-
#irc_channel ⇒ Object
readonly
Returns the value of attribute irc_channel.
-
#irc_daemon ⇒ Object
readonly
Returns the value of attribute irc_daemon.
-
#irc_port ⇒ Object
readonly
Returns the value of attribute irc_port.
-
#irc_server ⇒ Object
readonly
Returns the value of attribute irc_server.
-
#jmx_mon ⇒ Object
readonly
Returns the value of attribute jmx_mon.
-
#jmx_mon_delay ⇒ Object
readonly
Returns the value of attribute jmx_mon_delay.
-
#label_bg ⇒ Object
readonly
Returns the value of attribute label_bg.
-
#label_text ⇒ Object
readonly
Returns the value of attribute label_text.
-
#level ⇒ Object
Returns the value of attribute level.
-
#log_level ⇒ Object
readonly
Returns the value of attribute log_level.
-
#mac_delay ⇒ Object
readonly
Returns the value of attribute mac_delay.
-
#mac_lock ⇒ Object
readonly
Returns the value of attribute mac_lock.
-
#mac_manufacturer ⇒ Object
readonly
Returns the value of attribute mac_manufacturer.
-
#mac_state ⇒ Object
readonly
Returns the value of attribute mac_state.
-
#mail_by_level ⇒ Object
Returns the value of attribute mail_by_level.
-
#mail_server ⇒ Object
readonly
Returns the value of attribute mail_server.
-
#mail_server_addr ⇒ Object
readonly
Returns the value of attribute mail_server_addr.
-
#mail_server_port ⇒ Object
readonly
Returns the value of attribute mail_server_port.
-
#map_display_view ⇒ Object
Returns the value of attribute map_display_view.
-
#network_icon_view ⇒ Object
Returns the value of attribute network_icon_view.
-
#network_label_view ⇒ Object
Returns the value of attribute network_label_view.
-
#nmap_path ⇒ Object
readonly
Returns the value of attribute nmap_path.
-
#nmap_vers ⇒ Object
Returns the value of attribute nmap_vers.
-
#nmblookup_path ⇒ Object
readonly
Returns the value of attribute nmblookup_path.
-
#node_resolving ⇒ Object
readonly
Returns the value of attribute node_resolving.
-
#node_resolving_delay ⇒ Object
readonly
Returns the value of attribute node_resolving_delay.
-
#noshow_fqdn ⇒ Object
readonly
Returns the value of attribute noshow_fqdn.
-
#passive_find_node_delay ⇒ Object
readonly
Returns the value of attribute passive_find_node_delay.
-
#passive_find_node_state ⇒ Object
readonly
Returns the value of attribute passive_find_node_state.
-
#ping_path ⇒ Object
readonly
Returns the value of attribute ping_path.
-
#pixmap_size ⇒ Object
Returns the value of attribute pixmap_size.
-
#port_mon ⇒ Object
readonly
Returns the value of attribute port_mon.
-
#port_mon_delay ⇒ Object
readonly
Returns the value of attribute port_mon_delay.
-
#rdesktop_path ⇒ Object
readonly
Returns the value of attribute rdesktop_path.
-
#read_community ⇒ Object
readonly
Returns the value of attribute read_community.
-
#rgb ⇒ Object
readonly
Returns the value of attribute rgb.
-
#script_name_by_level ⇒ Object
Returns the value of attribute script_name_by_level.
-
#show_label ⇒ Object
readonly
Returns the value of attribute show_label.
-
#show_tooltips ⇒ Object
readonly
Returns the value of attribute show_tooltips.
-
#sms_device ⇒ Object
readonly
Returns the value of attribute sms_device.
-
#sms_num_by_level ⇒ Object
Returns the value of attribute sms_num_by_level.
-
#snmp_mon ⇒ Object
readonly
Returns the value of attribute snmp_mon.
-
#snmp_mon_delay ⇒ Object
readonly
Returns the value of attribute snmp_mon_delay.
-
#snmp_port ⇒ Object
readonly
Returns the value of attribute snmp_port.
-
#snmp_retry ⇒ Object
readonly
Returns the value of attribute snmp_retry.
-
#snmp_timeout ⇒ Object
readonly
Returns the value of attribute snmp_timeout.
-
#snmp_version ⇒ Object
readonly
Returns the value of attribute snmp_version.
-
#snmptrap_community ⇒ Object
readonly
Returns the value of attribute snmptrap_community.
-
#snmptrap_mon ⇒ Object
readonly
Returns the value of attribute snmptrap_mon.
-
#snmptrap_port ⇒ Object
readonly
Returns the value of attribute snmptrap_port.
-
#sound_file_path_by_level ⇒ Object
Returns the value of attribute sound_file_path_by_level.
-
#ssh_path ⇒ Object
readonly
Returns the value of attribute ssh_path.
-
#syslog_mon ⇒ Object
readonly
Returns the value of attribute syslog_mon.
-
#syslog_port ⇒ Object
readonly
Returns the value of attribute syslog_port.
-
#telnet_path ⇒ Object
readonly
Returns the value of attribute telnet_path.
-
#vncviewer_path ⇒ Object
readonly
Returns the value of attribute vncviewer_path.
-
#window ⇒ Object
readonly
Returns the value of attribute window.
-
#wmi_mon ⇒ Object
readonly
Returns the value of attribute wmi_mon.
-
#wmi_mon_delay ⇒ Object
readonly
Returns the value of attribute wmi_mon_delay.
-
#wmic_path ⇒ Object
readonly
Returns the value of attribute wmic_path.
-
#write_community ⇒ Object
readonly
Returns the value of attribute write_community.
-
#xprobe_path ⇒ Object
readonly
Returns the value of attribute xprobe_path.
-
#xterm_path ⇒ Object
readonly
Returns the value of attribute xterm_path.
Instance Method Summary collapse
- #init_config_var ⇒ Object
- #init_hash_conf_by_level(h) ⇒ Object
-
#initialize ⇒ ConfigGlobal
constructor
A new instance of ConfigGlobal.
- #read_config_yaml ⇒ Object
-
#save_config ⇒ Object
save configuration to file as INF format, refresh general value warning: deprecated.
- #show ⇒ Object
- #visible ⇒ Object
-
#write_config_yaml ⇒ Object
save configuration to file as YAML format.
Constructor Details
#initialize ⇒ ConfigGlobal
Returns a new instance of ConfigGlobal.
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
# File 'lib/config_global.rb', line 384 def initialize () @label_text = [0, 0, 0] grey = [48251, 45824, 45824] @label_bg = grey @rgb = grey @image_path = "#{PIXMAP_PATH}/bg" @bg_type = "color" #set this for the first time we launch gnms @port_mon = true @port_mon_delay = "60" @snmp_mon_delay = "60" @wmi_mon_delay = "60" @custom_mon_delay = "60" @jmx_mon_delay = "60" @active_find_node_delay = "300" @passive_find_node_delay = "300" @node_resolving = true @node_resolving_delay = "120" @mac_delay = "60" @syslog_port="514" @snmptrap_port="162" @snmptrap_comunity="public" @mail_server_addr="localhost" @mail_server_port=25 #store mail recipient for each severity level @mail_by_level = Hash.new init_hash_conf_by_level(@mail_by_level) #store sound path if one for each severity level @sound_file_path_by_level = Hash.new init_hash_conf_by_level(@sound_file_path_by_level) @sms_num_by_level = Hash.new init_hash_conf_by_level(@sms_num_by_level) @im_dest_by_level = Hash.new init_hash_conf_by_level(@im_dest_by_level) @script_name_by_level = Hash.new init_hash_conf_by_level(@script_name_by_level) begin @window=ConfigWindow.new(self) rescue Exception => msg raise msg end end |
Instance Attribute Details
#active_find_node_delay ⇒ Object (readonly)
Returns the value of attribute active_find_node_delay.
30 31 32 |
# File 'lib/config_global.rb', line 30 def active_find_node_delay @active_find_node_delay end |
#active_find_node_state ⇒ Object (readonly)
Returns the value of attribute active_find_node_state.
30 31 32 |
# File 'lib/config_global.rb', line 30 def active_find_node_state @active_find_node_state end |
#auto_save_map ⇒ Object (readonly)
Returns the value of attribute auto_save_map.
36 37 38 |
# File 'lib/config_global.rb', line 36 def auto_save_map @auto_save_map end |
#auto_save_map_value ⇒ Object (readonly)
Returns the value of attribute auto_save_map_value.
36 37 38 |
# File 'lib/config_global.rb', line 36 def auto_save_map_value @auto_save_map_value end |
#bg_type ⇒ Object
Returns the value of attribute bg_type.
34 35 36 |
# File 'lib/config_global.rb', line 34 def bg_type @bg_type end |
#browser_path ⇒ Object (readonly)
Returns the value of attribute browser_path.
33 34 35 |
# File 'lib/config_global.rb', line 33 def browser_path @browser_path end |
#confirm_delete ⇒ Object (readonly)
Returns the value of attribute confirm_delete.
27 28 29 |
# File 'lib/config_global.rb', line 27 def confirm_delete @confirm_delete end |
#confirm_quit ⇒ Object (readonly)
Returns the value of attribute confirm_quit.
27 28 29 |
# File 'lib/config_global.rb', line 27 def confirm_quit @confirm_quit end |
#custom_mon ⇒ Object (readonly)
Returns the value of attribute custom_mon.
32 33 34 |
# File 'lib/config_global.rb', line 32 def custom_mon @custom_mon end |
#custom_mon_delay ⇒ Object (readonly)
Returns the value of attribute custom_mon_delay.
32 33 34 |
# File 'lib/config_global.rb', line 32 def custom_mon_delay @custom_mon_delay end |
#default_height ⇒ Object (readonly)
Returns the value of attribute default_height.
27 28 29 |
# File 'lib/config_global.rb', line 27 def default_height @default_height end |
#default_map ⇒ Object (readonly)
Returns the value of attribute default_map.
27 28 29 |
# File 'lib/config_global.rb', line 27 def default_map @default_map end |
#default_width ⇒ Object (readonly)
Returns the value of attribute default_width.
27 28 29 |
# File 'lib/config_global.rb', line 27 def default_width @default_width end |
#host_icon_view ⇒ Object
Returns the value of attribute host_icon_view.
38 39 40 |
# File 'lib/config_global.rb', line 38 def host_icon_view @host_icon_view end |
#host_label_view ⇒ Object
Returns the value of attribute host_label_view.
38 39 40 |
# File 'lib/config_global.rb', line 38 def host_label_view @host_label_view end |
#im_daemon ⇒ Object (readonly)
Returns the value of attribute im_daemon.
36 37 38 |
# File 'lib/config_global.rb', line 36 def im_daemon @im_daemon end |
#im_dest_by_level ⇒ Object
Returns the value of attribute im_dest_by_level.
40 41 42 |
# File 'lib/config_global.rb', line 40 def im_dest_by_level @im_dest_by_level end |
#im_login ⇒ Object (readonly)
Returns the value of attribute im_login.
28 29 30 |
# File 'lib/config_global.rb', line 28 def im_login @im_login end |
#im_password ⇒ Object (readonly)
Returns the value of attribute im_password.
28 29 30 |
# File 'lib/config_global.rb', line 28 def im_password @im_password end |
#image_path ⇒ Object
Returns the value of attribute image_path.
34 35 36 |
# File 'lib/config_global.rb', line 34 def image_path @image_path end |
#irc_channel ⇒ Object (readonly)
Returns the value of attribute irc_channel.
28 29 30 |
# File 'lib/config_global.rb', line 28 def irc_channel @irc_channel end |
#irc_daemon ⇒ Object (readonly)
Returns the value of attribute irc_daemon.
36 37 38 |
# File 'lib/config_global.rb', line 36 def irc_daemon @irc_daemon end |
#irc_port ⇒ Object (readonly)
Returns the value of attribute irc_port.
28 29 30 |
# File 'lib/config_global.rb', line 28 def irc_port @irc_port end |
#irc_server ⇒ Object (readonly)
Returns the value of attribute irc_server.
28 29 30 |
# File 'lib/config_global.rb', line 28 def irc_server @irc_server end |
#jmx_mon ⇒ Object (readonly)
Returns the value of attribute jmx_mon.
32 33 34 |
# File 'lib/config_global.rb', line 32 def jmx_mon @jmx_mon end |
#jmx_mon_delay ⇒ Object (readonly)
Returns the value of attribute jmx_mon_delay.
32 33 34 |
# File 'lib/config_global.rb', line 32 def jmx_mon_delay @jmx_mon_delay end |
#label_bg ⇒ Object (readonly)
Returns the value of attribute label_bg.
35 36 37 |
# File 'lib/config_global.rb', line 35 def label_bg @label_bg end |
#label_text ⇒ Object (readonly)
Returns the value of attribute label_text.
35 36 37 |
# File 'lib/config_global.rb', line 35 def label_text @label_text end |
#level ⇒ Object
Returns the value of attribute level.
29 30 31 |
# File 'lib/config_global.rb', line 29 def level @level end |
#log_level ⇒ Object (readonly)
Returns the value of attribute log_level.
27 28 29 |
# File 'lib/config_global.rb', line 27 def log_level @log_level end |
#mac_delay ⇒ Object (readonly)
Returns the value of attribute mac_delay.
30 31 32 |
# File 'lib/config_global.rb', line 30 def mac_delay @mac_delay end |
#mac_lock ⇒ Object (readonly)
Returns the value of attribute mac_lock.
30 31 32 |
# File 'lib/config_global.rb', line 30 def mac_lock @mac_lock end |
#mac_manufacturer ⇒ Object (readonly)
Returns the value of attribute mac_manufacturer.
30 31 32 |
# File 'lib/config_global.rb', line 30 def mac_manufacturer @mac_manufacturer end |
#mac_state ⇒ Object (readonly)
Returns the value of attribute mac_state.
30 31 32 |
# File 'lib/config_global.rb', line 30 def mac_state @mac_state end |
#mail_by_level ⇒ Object
Returns the value of attribute mail_by_level.
40 41 42 |
# File 'lib/config_global.rb', line 40 def mail_by_level @mail_by_level end |
#mail_server ⇒ Object (readonly)
Returns the value of attribute mail_server.
36 37 38 |
# File 'lib/config_global.rb', line 36 def mail_server @mail_server end |
#mail_server_addr ⇒ Object (readonly)
Returns the value of attribute mail_server_addr.
28 29 30 |
# File 'lib/config_global.rb', line 28 def mail_server_addr @mail_server_addr end |
#mail_server_port ⇒ Object (readonly)
Returns the value of attribute mail_server_port.
28 29 30 |
# File 'lib/config_global.rb', line 28 def mail_server_port @mail_server_port end |
#map_display_view ⇒ Object
Returns the value of attribute map_display_view.
38 39 40 |
# File 'lib/config_global.rb', line 38 def map_display_view @map_display_view end |
#network_icon_view ⇒ Object
Returns the value of attribute network_icon_view.
38 39 40 |
# File 'lib/config_global.rb', line 38 def network_icon_view @network_icon_view end |
#network_label_view ⇒ Object
Returns the value of attribute network_label_view.
38 39 40 |
# File 'lib/config_global.rb', line 38 def network_label_view @network_label_view end |
#nmap_path ⇒ Object (readonly)
Returns the value of attribute nmap_path.
33 34 35 |
# File 'lib/config_global.rb', line 33 def nmap_path @nmap_path end |
#nmap_vers ⇒ Object
Returns the value of attribute nmap_vers.
39 40 41 |
# File 'lib/config_global.rb', line 39 def nmap_vers @nmap_vers end |
#nmblookup_path ⇒ Object (readonly)
Returns the value of attribute nmblookup_path.
33 34 35 |
# File 'lib/config_global.rb', line 33 def nmblookup_path @nmblookup_path end |
#node_resolving ⇒ Object (readonly)
Returns the value of attribute node_resolving.
31 32 33 |
# File 'lib/config_global.rb', line 31 def node_resolving @node_resolving end |
#node_resolving_delay ⇒ Object (readonly)
Returns the value of attribute node_resolving_delay.
31 32 33 |
# File 'lib/config_global.rb', line 31 def node_resolving_delay @node_resolving_delay end |
#noshow_fqdn ⇒ Object (readonly)
Returns the value of attribute noshow_fqdn.
27 28 29 |
# File 'lib/config_global.rb', line 27 def noshow_fqdn @noshow_fqdn end |
#passive_find_node_delay ⇒ Object (readonly)
Returns the value of attribute passive_find_node_delay.
30 31 32 |
# File 'lib/config_global.rb', line 30 def passive_find_node_delay @passive_find_node_delay end |
#passive_find_node_state ⇒ Object (readonly)
Returns the value of attribute passive_find_node_state.
30 31 32 |
# File 'lib/config_global.rb', line 30 def passive_find_node_state @passive_find_node_state end |
#ping_path ⇒ Object (readonly)
Returns the value of attribute ping_path.
33 34 35 |
# File 'lib/config_global.rb', line 33 def ping_path @ping_path end |
#pixmap_size ⇒ Object
Returns the value of attribute pixmap_size.
37 38 39 |
# File 'lib/config_global.rb', line 37 def pixmap_size @pixmap_size end |
#port_mon ⇒ Object (readonly)
Returns the value of attribute port_mon.
32 33 34 |
# File 'lib/config_global.rb', line 32 def port_mon @port_mon end |
#port_mon_delay ⇒ Object (readonly)
Returns the value of attribute port_mon_delay.
32 33 34 |
# File 'lib/config_global.rb', line 32 def port_mon_delay @port_mon_delay end |
#rdesktop_path ⇒ Object (readonly)
Returns the value of attribute rdesktop_path.
33 34 35 |
# File 'lib/config_global.rb', line 33 def rdesktop_path @rdesktop_path end |
#read_community ⇒ Object (readonly)
Returns the value of attribute read_community.
28 29 30 |
# File 'lib/config_global.rb', line 28 def read_community @read_community end |
#rgb ⇒ Object (readonly)
Returns the value of attribute rgb.
35 36 37 |
# File 'lib/config_global.rb', line 35 def rgb @rgb end |
#script_name_by_level ⇒ Object
Returns the value of attribute script_name_by_level.
40 41 42 |
# File 'lib/config_global.rb', line 40 def script_name_by_level @script_name_by_level end |
#show_label ⇒ Object (readonly)
Returns the value of attribute show_label.
27 28 29 |
# File 'lib/config_global.rb', line 27 def show_label @show_label end |
#show_tooltips ⇒ Object (readonly)
Returns the value of attribute show_tooltips.
27 28 29 |
# File 'lib/config_global.rb', line 27 def show_tooltips @show_tooltips end |
#sms_device ⇒ Object (readonly)
Returns the value of attribute sms_device.
28 29 30 |
# File 'lib/config_global.rb', line 28 def sms_device @sms_device end |
#sms_num_by_level ⇒ Object
Returns the value of attribute sms_num_by_level.
40 41 42 |
# File 'lib/config_global.rb', line 40 def sms_num_by_level @sms_num_by_level end |
#snmp_mon ⇒ Object (readonly)
Returns the value of attribute snmp_mon.
32 33 34 |
# File 'lib/config_global.rb', line 32 def snmp_mon @snmp_mon end |
#snmp_mon_delay ⇒ Object (readonly)
Returns the value of attribute snmp_mon_delay.
32 33 34 |
# File 'lib/config_global.rb', line 32 def snmp_mon_delay @snmp_mon_delay end |
#snmp_port ⇒ Object (readonly)
Returns the value of attribute snmp_port.
28 29 30 |
# File 'lib/config_global.rb', line 28 def snmp_port @snmp_port end |
#snmp_retry ⇒ Object (readonly)
Returns the value of attribute snmp_retry.
28 29 30 |
# File 'lib/config_global.rb', line 28 def snmp_retry @snmp_retry end |
#snmp_timeout ⇒ Object (readonly)
Returns the value of attribute snmp_timeout.
28 29 30 |
# File 'lib/config_global.rb', line 28 def snmp_timeout @snmp_timeout end |
#snmp_version ⇒ Object (readonly)
Returns the value of attribute snmp_version.
28 29 30 |
# File 'lib/config_global.rb', line 28 def snmp_version @snmp_version end |
#snmptrap_community ⇒ Object (readonly)
Returns the value of attribute snmptrap_community.
30 31 32 |
# File 'lib/config_global.rb', line 30 def snmptrap_community @snmptrap_community end |
#snmptrap_mon ⇒ Object (readonly)
Returns the value of attribute snmptrap_mon.
30 31 32 |
# File 'lib/config_global.rb', line 30 def snmptrap_mon @snmptrap_mon end |
#snmptrap_port ⇒ Object (readonly)
Returns the value of attribute snmptrap_port.
30 31 32 |
# File 'lib/config_global.rb', line 30 def snmptrap_port @snmptrap_port end |
#sound_file_path_by_level ⇒ Object
Returns the value of attribute sound_file_path_by_level.
40 41 42 |
# File 'lib/config_global.rb', line 40 def sound_file_path_by_level @sound_file_path_by_level end |
#ssh_path ⇒ Object (readonly)
Returns the value of attribute ssh_path.
33 34 35 |
# File 'lib/config_global.rb', line 33 def ssh_path @ssh_path end |
#syslog_mon ⇒ Object (readonly)
Returns the value of attribute syslog_mon.
30 31 32 |
# File 'lib/config_global.rb', line 30 def syslog_mon @syslog_mon end |
#syslog_port ⇒ Object (readonly)
Returns the value of attribute syslog_port.
30 31 32 |
# File 'lib/config_global.rb', line 30 def syslog_port @syslog_port end |
#telnet_path ⇒ Object (readonly)
Returns the value of attribute telnet_path.
33 34 35 |
# File 'lib/config_global.rb', line 33 def telnet_path @telnet_path end |
#vncviewer_path ⇒ Object (readonly)
Returns the value of attribute vncviewer_path.
33 34 35 |
# File 'lib/config_global.rb', line 33 def vncviewer_path @vncviewer_path end |
#window ⇒ Object (readonly)
Returns the value of attribute window.
26 27 28 |
# File 'lib/config_global.rb', line 26 def window @window end |
#wmi_mon ⇒ Object (readonly)
Returns the value of attribute wmi_mon.
32 33 34 |
# File 'lib/config_global.rb', line 32 def wmi_mon @wmi_mon end |
#wmi_mon_delay ⇒ Object (readonly)
Returns the value of attribute wmi_mon_delay.
32 33 34 |
# File 'lib/config_global.rb', line 32 def wmi_mon_delay @wmi_mon_delay end |
#wmic_path ⇒ Object (readonly)
Returns the value of attribute wmic_path.
33 34 35 |
# File 'lib/config_global.rb', line 33 def wmic_path @wmic_path end |
#write_community ⇒ Object (readonly)
Returns the value of attribute write_community.
28 29 30 |
# File 'lib/config_global.rb', line 28 def write_community @write_community end |
#xprobe_path ⇒ Object (readonly)
Returns the value of attribute xprobe_path.
33 34 35 |
# File 'lib/config_global.rb', line 33 def xprobe_path @xprobe_path end |
#xterm_path ⇒ Object (readonly)
Returns the value of attribute xterm_path.
33 34 35 |
# File 'lib/config_global.rb', line 33 def xterm_path @xterm_path end |
Instance Method Details
#init_config_var ⇒ Object
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
# File 'lib/config_global.rb', line 343 def init_config_var() @host_label_view="dns_name" @host_icon_view="type" @network_label_view="ip" @network_icon_view="type" @map_display_view="User defined" #map is set in mail @show_label=true @noshow_fqdn=false @show_tooltips=false @confirm_delete=true @confirm_quit=true @auto_save_map=false @auto_save_map_value=60 @log_level="Info" @pixmap_size=35 @bg_type="color" #black @label_text = [0, 0, 0] #grey @label_bg = [48251, 45824, 45824] @rgb=[48251, 45824, 45824] @mail_server=false @im_daemon=false @irc_daemon=false end |
#init_hash_conf_by_level(h) ⇒ Object
378 379 380 381 382 |
# File 'lib/config_global.rb', line 378 def init_hash_conf_by_level(h) for l in $LEVEL h[l]= nil end end |
#read_config_yaml ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/config_global.rb', line 76 def read_config_yaml() if FileTest.exist?(GLOBAL_CONF_FILE) if !File.readable?(GLOBAL_CONF_FILE) or !File.writable?(GLOBAL_CONF_FILE) $log.fatal("Wrong permission on #{GLOBAL_CONF_FILE} need read-write access") exit() end begin db = YAML::load_file(GLOBAL_CONF_FILE) rescue Exception => msg $log.fatal("Error reading configuration file #{GLOBAL_CONF_FILE}") exit() end begin @default_width = db["general"]["default_width"] @default_height = db["general"]["default_height"] @default_map = db["general"]["default_map"] @host_label_view = db["general"]["host_label_view"] @host_icon_view = db["general"]["host_icon_view"] @network_label_view = db["general"]["network_label_view"] @network_icon_view = db["general"]["network_icon_view"] @map_display_view = db["general"]["map_display_view"] @show_label = db["general"]["show_label"] @noshow_fqdn = db["general"]["noshow_fqdn"] @show_tooltips = db["general"]["show_tooltips"] @confirm_delete = db["general"]["confirm_delete"] @confirm_quit = db["general"]["confirm_quit"] @auto_save_map = db["general"]["auto_save_map"] @auto_save_map_value = db["general"]["auto_save_map_value"] @log_level = db["general"]["log_level"] @mail_server = db["general"]["mail_server"] @mail_server_addr = db["general"]["mail_server_addr"] @mail_server_port = db["general"]["mail_server_port"] @sms_device = db["general"]["sms_device"] @im_daemon = db["general"]["im_daemon"] @im_login = db["general"]["im_login"] @im_password = blowfish_decode(Base64.decode64(db["general"]["im_password"])) @irc_daemon = db["general"]["irc_daemon"] @irc_server = db["general"]["irc_server"] @irc_port = db["general"]["irc_port"] @irc_channel = db["general"]["irc_channel"] @read_community = db["snmp"]["read_community"] @write_community = db["snmp"]["write_community"] @snmp_version = db["snmp"]["snmp_version"] @snmp_port = db["snmp"]["snmp_port"] @snmp_timeout = db["snmp"]["snmp_timeout"] @snmp_retry = db["snmp"]["snmp_retry"] @level = db["notification"]["level"] $level_alert_type = db["notification"]["level_alert_type"] @mail_by_level = db["notification"]["mail"] @sound_file_path_by_level = db["notification"]["sound_file_path"] @script_name_by_level = db["notification"]["script_name"] @sms_num_by_level = db["notification"]["sms_num"] @im_dest_by_level = db["notification"]["im_dest"] @active_find_node_state = db["scan"]["active_find_node"]["state"] @active_find_node_delay = db["scan"]["active_find_node"]["delay"] @passive_find_node_state = db["scan"]["passive_find_node"]["state"] @passive_find_node_delay = db["scan"]["passive_find_node"]["delay"] @mac_state = db["scan"]["mac"]["state"] @mac_delay = db["scan"]["mac"]["delay"] @mac_lock = db["scan"]["mac"]["lock"] @mac_manufacturer = db["scan"]["mac"]["manufacturer"] @node_resolving = db["scan"]["node_resolving"]["state"] @node_resolving_delay = db["scan"]["node_resolving"]["delay"] @port_mon = db["scan"]["port"]["state"] @port_mon_delay = db["scan"]["port"]["delay"] @snmp_mon = db["scan"]["snmp"]["state"] @snmp_mon_delay = db["scan"]["snmp"]["delay"] @wmi_mon = db["scan"]["wmi"]["state"] @wmi_mon_delay = db["scan"]["wmi"]["delay"] @custom_mon = db["scan"]["custom"]["state"] @custom_mon_delay = db["scan"]["custom"]["delay"] @jmx_mon = db["scan"]["jmx"]["state"] @jmx_mon_delay = db["scan"]["jmx"]["delay"] @syslog_mon = db["scan"]["syslog"]["state"] @syslog_port = db["scan"]["syslog"]["port"] @snmptrap_mon = db["scan"]["snmptrap"]["state"] @snmptrap_port = db["scan"]["snmptrap"]["port"] @snmptrap_community = db["scan"]["snmptrap"]["community"] @ping_path = db["path"]["ping"] @nmap_path = db["path"]["nmap"] @ssh_path = db["path"]["ssh"] @telnet_path = db["path"]["telnet"] @browser_path = db["path"]["browser"] @vncviewer_path = db["path"]["vncviewer"] @rdesktop_path = db["path"]["rdesktop"] @xterm_path = db["path"]["terminal"] @nmblookup_path = db["path"]["nmblookup"] @xprobe_path = db["path"]["xprobe"] @wmic_path = db["path"]["wmic"] @pixmap_size = db["colors"]["pixmap_size"] @bg_type = db["colors"]["bg_type"] @label_text = db["colors"]["label_text"] @label_bg = db["colors"]["label_bg"] @rgb = db["colors"]["rgb"] @image_path = db["colors"]["image_path"] rescue $log.error("Conf reset as issues found when loading configuration file at #{GLOBAL_CONF_FILE}") init_config_var() end else init_config_var() end end |
#save_config ⇒ Object
save configuration to file as INF format, refresh general value warning: deprecated
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/config_global.rb', line 46 def save_config() fic_tmp=Tempfile.new(File.basename(GLOBAL_CONF_FILE)) line_idx=0 File.readlines(GLOBAL_CONF_FILE).each{|line| if line_idx == 1 fic_tmp.puts("#{get_map_width()}") fic_tmp.puts("#{get_map_height()}") fic_tmp.puts("#{$map}") fic_tmp.puts("#{$config.host_label_view}") fic_tmp.puts("#{$config.host_icon_view}") fic_tmp.puts("#{$config.network_label_view}") fic_tmp.puts("#{$config.network_icon_view}") fic_tmp.puts("#{$config.map_display_view}") end #we rewrite all exept GENERAL paragrapher if (line_idx == 0) || (line_idx > 8) fic_tmp.print line end line_idx+=1 } fic_tmp.close if File.stat(fic_tmp.path).size? #all seems good FileUtils.move(fic_tmp.path, GLOBAL_CONF_FILE) end end |
#show ⇒ Object
370 371 372 |
# File 'lib/config_global.rb', line 370 def show() @window.show() end |
#visible ⇒ Object
374 375 376 |
# File 'lib/config_global.rb', line 374 def visible() @window.visible() end |
#write_config_yaml ⇒ Object
save configuration to file as YAML format
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 |
# File 'lib/config_global.rb', line 189 def write_config_yaml() fic_tmp=Tempfile.new(File.basename(GLOBAL_CONF_FILE)) general = { 'default_width' => @default_width.to_i, 'default_height' => @default_height.to_i, 'default_map' => @default_map, 'host_label_view' => @host_label_view, 'host_icon_view' => @host_icon_view, 'network_label_view' => @network_label_view, 'network_icon_view' => @network_icon_view, 'map_display_view' => @map_display_view, 'show_label' => @show_label, 'noshow_fqdn' => @noshow_fqdn, 'show_tooltips' => @show_tooltips, 'confirm_delete' => @confirm_delete, 'confirm_quit' => @confirm_quit, 'auto_save_map' => @auto_save_map, 'auto_save_map_value' => @auto_save_map_value.to_i, 'log_level' => @log_level, 'mail_server' => @mail_server, 'mail_server_addr' => @mail_server_addr, 'mail_server_port' => @mail_server_port, 'sms_device' => @sms_device, 'im_daemon' => @im_daemon, 'im_login' => @im_login, 'im_password' => Base64.encode64(blowfish_encode(@im_password)), 'irc_daemon' => @irc_daemon, 'irc_server' => @irc_server, 'irc_port' => @irc_port, 'irc_channel' => @irc_channel } snmp = { 'read_community' => @read_community, 'write_community' => @write_community, 'snmp_version' => @snmp_version, 'snmp_port' => @snmp_port.to_i, 'snmp_timeout' => @snmp_timeout.to_i, 'snmp_retry' => @snmp_retry.to_i } notification = { 'level' => @level, 'level_alert_type' => $level_alert_type, 'mail' => @mail_by_level, 'sound_file_path' => @sound_file_path_by_level, 'script_name' => @script_name_by_level, 'sms_num' => @sms_num_by_level, 'im_dest' => @im_dest_by_level } scan = { 'active_find_node' => { 'state' => @active_find_node_state, 'delay' => @active_find_node_delay.to_i, }, 'passive_find_node' => { 'state' => @passive_find_node_state, 'delay' => @passive_find_node_delay.to_i, }, 'mac' => { 'state' => @mac_state, 'delay' => @mac_delay.to_i, 'lock' => @mac_lock, 'manufacturer' => { 'state' => @mac_manufacturer } }, 'node_resolving' => { 'state' => @node_resolving, 'delay' => @node_resolving_delay.to_i }, 'port' => { 'state' => @port_mon, 'delay' => @port_mon_delay.to_i }, 'snmp' => { 'state' => @snmp_mon, 'delay' => @snmp_mon_delay.to_i }, 'wmi' => { 'state' => @wmi_mon, 'delay' => @wmi_mon_delay.to_i }, 'custom' => { 'state' => @custom_mon, 'delay' => @custom_mon_delay.to_i }, 'jmx' => { 'state' => @jmx_mon, 'delay' => @jmx_mon_delay.to_i }, 'syslog' => { 'state' => @syslog_mon, 'port' => @syslog_port.to_i }, 'snmptrap' => { 'state' => @snmptrap_mon, 'port' => @snmptrap_port.to_i, 'community' => @snmptrap_community } } path = { 'ping' => @ping_path, 'nmap' => @nmap_path, 'ssh' => @ssh_path, 'telnet' => @telnet_path, 'browser' => @browser_path, 'vncviewer' => @vncviewer_path, 'rdesktop' => @rdesktop_path, 'terminal' => @xterm_path, 'nmblookup' => @nmblookup_path, 'xprobe' => @xprobe_path, 'wmic' => @wmic_path } #keys = {} colors = { 'pixmap_size' => @pixmap_size, 'bg_type' => @bg_type, 'label_text' => @label_text, 'label_bg' => @label_bg, 'rgb' => @rgb, 'image_path' => @image_path } YAML::dump(general) YAML::dump(snmp) YAML::dump(notification) YAML::dump(scan) YAML::dump(path) #YAML::dump(keys) YAML::dump(colors) db = YAML::Store.new(fic_tmp.path) db.transaction{ db['general'] = general db['snmp'] = snmp db['notification'] = notification db['scan'] = scan db['path'] = path # db['keys'] = keys db['colors'] = colors } if File.stat(fic_tmp.path).size? FileUtils.move(fic_tmp.path, GLOBAL_CONF_FILE) end end |