madasafish
Technical User
I think this is another array exercise :-(
Here is an example of a Nagios .cfg file.
and what I want to output is.....
I am using gawk version 4.0.1
As always, thanks in advance.
Madasafish
gawk version 4.0.1
Here is an example of a Nagios .cfg file.
Code:
define host{
use host-liberate
check_command check-host-alive
max_check_attempts 3
host_name squid01.lang.dtv
alias squid01
address 10.185.32.78
}
define host{
use host-liberate
check_command check-host-alive
max_check_attempts 3
host_name squid02.lang.dtv
alias squid02
address 10.185.32.79
}
etc...
define hostgroup{
hostgroup_name Langley Liberate Servers
alias Langley Primary Site
members squid01.lang.dtv, squid02.lang.dtv, libmgt01.lang.dtv, libmgt02.lang.dtv
}
define hostgroup{
hostgroup_name Langley Content Servers
alias Langley Primary Site
members content01.lang.dtv, content02.lang.dtv
}
define hostgroup{
hostgroup_name Langley Database Servers
alias Langley Primary Site
members libdb01.lang.dtv, libdb02.lang.dtv
}
etc...
define service{
use liberate-defaults
hostgroup_name Langley Database Servers, Langley Liberate Servers, Langley Content Servers
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}
define service{
use liberate-defaults
hostgroup_name Langley Database Servers
service_description LISTENER
check_command check_tcp!1521
}
define service{
use liberate-defaults
hostgroup_name Langley Database Servers, Langley Liberate Servers, Langley Content Servers
service_description CPU
check_command check_nrpe!check_procs
}
etc...
and what I want to output is.....
Code:
PING,libdb01.lang.dtv,libdb02.lang.dtv,squid01.lang.dtv,squid02.lang.dtv,libmgt01.lang.dtv,libmgt02.lang.dtv,content01.lang.dtv,content02.lang.dtv
LISTENER,libdb01.lang.dtv,libdb02.lang.dtv
CPU,libdb01.lang.dtv,libdb02.lang.dtv,squid01.lang.dtv,squid02.lang.dtv,libmgt01.lang.dtv,libmgt02.lang.dtv,content01.lang.dtv,content02.lang.dtv
etc...
I am using gawk version 4.0.1
As always, thanks in advance.
Madasafish
gawk version 4.0.1