Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
generate_nagios_file_from_ip_file.pl
1.0.1
- Nagios 1.x
- Nagios 2.x
- Nagios 3.x
41731
File | Description |
---|---|
generate_nagios_file_from_ip_file.pl | Main file |
Help_file.txt | Help file |
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
This scripts is very flexible where one can change everything needed to be able to read a file containing IPs and HOSTs and creating HOSTs and hostgroup_names and default ping service for all the hosts in the INFILE.
I find that this script saves a lot of time when creating config files for a lot of hosts so i wanted to share it with everyone. Hopefully someone out there will find it useful as well.
This is not a Nagios plugin. This is just a script that takes an infile with IPs and HOSTs and creates a NAGIOS config file.
This scripts is very flexible where one can change everything needed to be able to read a file containing IPs and HOSTs and creating HOSTs and hostgroup_names and default ping service for all the hosts in the INFILE.
I find that this script saves a lot of time when creating config files for a lot of hosts so i wanted to share it with everyone. Hopefully someone out there will find it useful as well.
Manual
======
generate_nagios_cfgfile_from_ip_file.pl 1.0.1
Usage: generate_nagios_cfgfile_from_ip_file.pl -|--i|I|inf|INF|infile|INFILE -|--o|O|out|OUT|outfile|OUTFILE -|--ho|HO|host|HOST|hostgroup|HOSTGROUP -|-- del|DEL|delimiter|DELIMITER -|--h|H|help -|--d|debug
i.e
./generate_nagios_cfgfile_from_ip_file.pl -INFILE cisco_routers.txt -OUTFILE myrouters.cfg -HOSTGROUP Cisco_routers
./generate_nagios_cfgfile_from_ip_file.pl -In ip_hosts_tests.txt -O myrouters.cfg -HO Cisco_routers --delimiter ";" --debug
./generate_nagios_cfgfile_from_ip_file.pl -In --help
./generate_nagios_cfgfile_from_ip_file.pl -In --version
-|--i|I|inf|INF|infile|INFILE This is the IP and HOST file to read from.
DFEAULT It needs to have a format with 2 columns and where IP is the first and HOSTNAME is the second. Like:
10.9.0.2 host1
10.9.0.3 host2
10.9.0.4 host3
10.9.0.5 host4
.
.
THIS column order can be changed by passing in the flag -|--COLUMNORDER. (see below --COLUMNORDER section for detailed help).
If using flag --columnorder then INFILE columns are reversed and INFILE needed would look like:
host1 10.9.0.2
host2 10.9.0.3
host3 10.9.0.4
host4 10.9.0.5
.
.
The delimiter or column separator between the 2 columns can be specified with the flag
-|--delimiter (see below --delimiter section for detailed help).
(NO DEFAULT FILE but default DELIMITER is space " " and DEFAULT COLUMN ORDER is IP and then HOST)
-|--o|O|out|OUT|outfile|OUTFILE This needs the be the name of the resulting NAGIOS config file. This is the file that will contain all the hosts
and the hostgroup and default ping service for the hosts in above INFILE.
(DEFAULT is myoutfile.cfg)
-|--ho|HO|host|HOST|hostgroup|HOSTGROUP This needs the be the name of the resulting hostgroup_name in above OUTFILE.
Default without a passed in hostgroup_name it will look like below:
define hostgroup{
hostgroup_name my_hostgroup
alias my_hostgroup
members host1, host2, host3 etc.
}
(DEFAULT HOSTGROUP is my_hostgroup)
-|--del|DEL|delimiter|DELIMITER If your IP and HOST INFILE is not separated with a space " " between the columns (IP and HOST column).
Then this is where you tell the program which separator should be used instead.
-|--c|C|column|COLUMN|columnorder|COLUMNORDER If your IP and HOST INFILE column format doesn't have IP column before HOST COLUMN.
Meaning that the column order is reversed with HOST column before IP column.
Then this is the flag you need to pass on into the program. With this flag the needed file format will go from
DEFAULT format with 2 columns and where IP is the first and HOSTNAME is the second. Like:
10.9.0.2 host1
10.9.0.3 host2
10.9.0.4 host3
10.9.0.5 host4
.
.
To 2 columns where HOSNAME is the first and IP is the second. Like:
host1 10.9.0.2
host2 10.9.0.3
host3 10.9.0.4
host4 10.9.0.5
.
.
(DEFAULT is --NOCOLUMNORDER meaning column IP first and column HOST second)
-|--he|HE|help|HELP Prints this help screen
-|--v|V|VERSION|version Prints program version
-d|D|DEBUG|debug Enable debugging (DEFAULT disabled)
INFO: If you have any suggestions for improvements or new features
Or just want to complain about some nasty unforseen bug.
Then please drop me a line. Cocoon.is@gmail.com
This scripts is very flexible where one can change everything needed to be able to read a file containing IPs and HOSTs and creating HOSTs and hostgroup_names and default ping service for all the hosts in the INFILE.
I find that this script saves a lot of time when creating config files for a lot of hosts so i wanted to share it with everyone. Hopefully someone out there will find it useful as well.
Manual
======
generate_nagios_cfgfile_from_ip_file.pl 1.0.1
Usage: generate_nagios_cfgfile_from_ip_file.pl -|--i|I|inf|INF|infile|INFILE
i.e
./generate_nagios_cfgfile_from_ip_file.pl -INFILE cisco_routers.txt -OUTFILE myrouters.cfg -HOSTGROUP Cisco_routers
./generate_nagios_cfgfile_from_ip_file.pl -In ip_hosts_tests.txt -O myrouters.cfg -HO Cisco_routers --delimiter ";" --debug
./generate_nagios_cfgfile_from_ip_file.pl -In --help
./generate_nagios_cfgfile_from_ip_file.pl -In --version
-|--i|I|inf|INF|infile|INFILE This is the IP and HOST file to read from.
DFEAULT It needs to have a format with 2 columns and where IP is the first and HOSTNAME is the second. Like:
10.9.0.2 host1
10.9.0.3 host2
10.9.0.4 host3
10.9.0.5 host4
.
.
THIS column order can be changed by passing in the flag -|--COLUMNORDER. (see below --COLUMNORDER section for detailed help).
If using flag --columnorder then INFILE columns are reversed and INFILE needed would look like:
host1 10.9.0.2
host2 10.9.0.3
host3 10.9.0.4
host4 10.9.0.5
.
.
The delimiter or column separator between the 2 columns can be specified with the flag
-|--delimiter (see below --delimiter section for detailed help).
(NO DEFAULT FILE but default DELIMITER is space " " and DEFAULT COLUMN ORDER is IP and then HOST)
-|--o|O|out|OUT|outfile|OUTFILE This needs the be the name of the resulting NAGIOS config file. This is the file that will contain all the hosts
and the hostgroup and default ping service for the hosts in above INFILE.
(DEFAULT is myoutfile.cfg)
-|--ho|HO|host|HOST|hostgroup|HOSTGROUP This needs the be the name of the resulting hostgroup_name in above OUTFILE.
Default without a passed in hostgroup_name it will look like below:
define hostgroup{
hostgroup_name my_hostgroup
alias my_hostgroup
members host1, host2, host3 etc.
}
(DEFAULT HOSTGROUP is my_hostgroup)
-|--del|DEL|delimiter|DELIMITER If your IP and HOST INFILE is not separated with a space " " between the columns (IP and HOST column).
Then this is where you tell the program which separator should be used instead.
-|--c|C|column|COLUMN|columnorder|COLUMNORDER If your IP and HOST INFILE column format doesn't have IP column before HOST COLUMN.
Meaning that the column order is reversed with HOST column before IP column.
Then this is the flag you need to pass on into the program. With this flag the needed file format will go from
DEFAULT format with 2 columns and where IP is the first and HOSTNAME is the second. Like:
10.9.0.2 host1
10.9.0.3 host2
10.9.0.4 host3
10.9.0.5 host4
.
.
To 2 columns where HOSNAME is the first and IP is the second. Like:
host1 10.9.0.2
host2 10.9.0.3
host3 10.9.0.4
host4 10.9.0.5
.
.
(DEFAULT is --NOCOLUMNORDER meaning column IP first and column HOST second)
-|--he|HE|help|HELP Prints this help screen
-|--v|V|VERSION|version Prints program version
-d|D|DEBUG|debug Enable debugging (DEFAULT disabled)
INFO: If you have any suggestions for improvements or new features
Or just want to complain about some nasty unforseen bug.
Then please drop me a line. Cocoon.is@gmail.com
Reviews (0)
Be the first to review this listing!