3 Provides unit tests and examples for the <NagiosCfg> lens.
6 module Test_NagiosCfg =
9 log_file=/var/log/nagios3/nagios.log
11 # OBJECT CONFIGURATION FILE(S)
12 cfg_file=/etc/nagios3/objects/check_commands.cfg
13 cfg_file=/etc/nagios3/objects/contact_groups.cfg
14 cfg_file=/etc/nagios3/objects/contacts.cfg
15 cfg_file=/etc/nagios3/objects/hostgroups.cfg
16 cfg_file=/etc/nagios3/objects/hosts.cfg
17 cfg_file=/etc/nagios3/objects/services.cfg
28 # ILLEGAL OBJECT NAME CHARS
29 illegal_object_name_chars=`~!$%^&*|'\"<>?,()'=
31 # ILLEGAL MACRO OUTPUT CHARS
32 illegal_macro_output_chars=`~$&|'\"<>
35 p1_file=/usr/lib/nagios3/p1.pl
36 event_broker_options=-1
37 use_large_installation_tweaks=1
38 broker_module=/usr/lib/nagios3/libNagiosCluster-1.0.so.4.0.0
39 broker_module=/usr/sbin/ndomod.o config_file=/etc/nagios3/ndomod.cfg
42 test NagiosCfg.lns get conf =
44 { "#comment" = "LOG FILE" }
45 { "log_file" = "/var/log/nagios3/nagios.log" }
47 { "#comment" = "OBJECT CONFIGURATION FILE(S)" }
48 { "cfg_file" = "/etc/nagios3/objects/check_commands.cfg" }
49 { "cfg_file" = "/etc/nagios3/objects/contact_groups.cfg" }
50 { "cfg_file" = "/etc/nagios3/objects/contacts.cfg" }
51 { "cfg_file" = "/etc/nagios3/objects/hostgroups.cfg" }
52 { "cfg_file" = "/etc/nagios3/objects/hosts.cfg" }
53 { "cfg_file" = "/etc/nagios3/objects/services.cfg" }
55 { "#comment" = "NAGIOS USER" }
56 { "nagios_user" = "nagios" }
58 { "#comment" = "NAGIOS GROUP" }
59 { "nagios_group"= "nagios" }
61 { "#comment" = "DATE FORMAT" }
62 { "date_format" = "iso8601" }
64 { "#comment" = "ILLEGAL OBJECT NAME CHARS" }
65 { "illegal_object_name_chars" = "`~!$%^&*|'\"<>?,()'=" }
67 { "#comment" = "ILLEGAL MACRO OUTPUT CHARS" }
68 { "illegal_macro_output_chars" = "`~$&|'\"<>" }
70 { "#comment" = "MISC DIRECTIVES" }
71 { "p1_file" = "/usr/lib/nagios3/p1.pl" }
72 { "event_broker_options" = "-1" }
73 { "use_large_installation_tweaks" = "1" }
74 { "broker_module" = "/usr/lib/nagios3/libNagiosCluster-1.0.so.4.0.0" }
75 { "broker_module" = "/usr/sbin/ndomod.o"
76 { "config_file" = "/etc/nagios3/ndomod.cfg" } }
79 (* Spaces are fine in values *)
80 let space_in = "nagios_check_command=/usr/lib/nagios/plugins/check_nagios /var/cache/nagios3/status.dat 5 '/usr/sbin/nagios3'\n"
82 test NagiosCfg.lns get space_in =
83 { "nagios_check_command" = "/usr/lib/nagios/plugins/check_nagios /var/cache/nagios3/status.dat 5 '/usr/sbin/nagios3'" }
85 test NagiosCfg.lns get "$USER1$=/usr/local/libexec/nagios\n" =
86 { "$USER1$" = "/usr/local/libexec/nagios" }
88 test NagiosCfg.lns get "$USER3$=somepassword\n" =
89 { "$USER3$" = "somepassword" }