depend pada cara korang setup nagios, korang kene carik nagis commands.cfg file. mcm aku nyer terletak di /etc/nagis/commands.cfg . ( ade gak orang yg setup di /usr/local/nagios/etc/objects)
gunakan command berikut
vi /etc/commands.cfg
paste seperti di bawah :-
pastu korang kene create service baru untuk host yang nak dimonitor.define command{
command_name check_tcp_2020
command_line $USER1$/check_tcp -h $HOSTADDRESS$ -p 2020 -4
}
vi /etc/nagios/hosts.cfg
kemudian paste bende ni
define host{
use generic-host ;type generic server kalau linux guna linux-host
host_name matahari ; nama server kawan aku
alias server ssh ; diskripsi server
address 192,168,1,1 ; server IP
}
pastu paste bawah ni kat services.cfg
define service{
use generic-service
host_name matahari
service_description 'check ssh port2020/tcp'
check_command check_tcp_2020
}
Verify config betul ke idak
# nagios3 -v /etc/nagios3/nagios.cfg
mcm kawan aku dia kene guna cmd ni
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
pastu korang akan dapat cam ni
Nagios Core 3.2.3
Copyright (c) 2009-2010 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 10-03-2010
License: GPL
Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Processing object config file '/usr/local/nagios/etc/objects/commands.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/contacts.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/timeperiods.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/templates.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/localhost.cfg'...
Processing object config file '/etc/nagios/hosts.cfg'...
Processing object config file '/etc/nagios/services.cfg'...
Read object config files okay...
Running pre-flight check on configuration data...
Checking services...
Checked 13 services.
Checking hosts...
Checked 4 hosts.
Checking host groups...
Checked 1 host groups.
Checking service groups...
Checked 0 service groups.
Checking contacts...
Checked 1 contacts.
Checking contact groups...
Checked 1 contact groups.
Checking service escalations...
Checked 0 service escalations.
Checking service dependencies...
Checked 0 service dependencies.
Checking host escalations...
Checked 0 host escalations.
Checking host dependencies...
Checked 0 host dependencies.
Checking commands...
Checked 26 commands.
Checking time periods...
Checked 5 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 0
Total Errors: 0
Kalau semua nya ok, boleh la restart nagios.
# /etc/init.d/nagios restart
settle.
Tiada ulasan:
Catat Ulasan