Where do i put these commands?


#1

I have installed nagios and check_oracle
and can sucessfully run the following two commands I want to use from the command line.
What directory and file do i need to add them to have have nagios run them for me.

‘check_ping’ command definition

define command{
command_name check_ping
command_line /usr/local/nagios/libexec/check_ping -H 10.186.155.9 -w 750.0,80% -c 1500.0,90%
}

‘check_oracle’ command definition

define command{
command_name check_oracle
command_line /usr/local/nagios/libexec/check_oracle --login TRWE
}

#############

I did make a hosts.cfg file and added the following and restarted nagios but I do not see it when i show my hosts in nagios.

‘iputmyhostnamehere’ host definition

define host{
use generic-host

host_name iputmyhostnamehere
alias my name i made here
address 10.186.155.9
check_command check-host-alive
max_check_attempts 10
notification_interval 120
notification_period 24x7
notification_options d,u,r
}


#2

have a look at the contents of the nagios.cfg file, it has LOTS of comments and explians what happens where in the file.


#3

I have been messing around in there luca.
I saw this part

OBJECT CONFIGURATION FILE(S)

These are the object configuration files in which you define hosts,

host groups, contacts, contact groups, services, etc.

You can split your object definitions across several config files

if you wish (as shown below), or keep them all in a single config file.

You can specify individual object config files as shown below:

cfg_file=/usr/local/nagios/etc/objects/commands.cfg

so I added the following to the SAMPLE HOST CHECK COMMANDS

define command{
command_name check-host-alive
command_line $USER1$/check_ping -H 10.186.155.9 -w 3000.0,80% -c 5000.0,100% -p 5
}

‘check_oracle’ command definition

define command{
command_name check_oracle
command_line /usr/local/nagios/libexec/check_oracle --login TRWE
}

then restarted nagios but no luck

p.s.
saw in another thread you had a baby.
CONGRATS and good luck!


#4

First: try running nagios in config verify mode…

using standard paths run:
/usr/local/nagios/bin/bagios -v /usr/local/nagios/etc/nagios.cfg

what errors do you get?

did you add aline for hosts.cfg? there should be a commented line already for it…


#5

Total Warnings: 0
Total Errors: 0

Things look okay - No serious problems were detected during the pre-flight check

One of the first things in nagios.cfg i looked for was a link to hosts.cfg but there is not one, I may have inadvertantly deleted it at some point.
Can I just add it to the section below like so?

You can specify individual object config files as shown below:

cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/templates.cfg
cfg_file=/usr/local/nagios/etc/objects/hosts.cfg


#6

ok I added the host file to that section and i now see the host in addition to the local host that i was seeing in the host section of the nagio webpage.
I am not seeing results from the check_oracle --login sid anywhere.

I have these 2 commands in /usr/local/nagios/etc/objects/commands.cfg, and this file is referenced in nagios.cfg.

define command{
command_name check-host-alive
command_line $USER1$/check_ping -H 10.186.155.9 -w 3000.0,80% -c 5000.0,100% -p 5
}

‘check_oracle’ command definition

define command{
command_name check_oracle
command_line /usr/local/nagios/libexec/check_oracle --login TRWE
}


#7

i never used check_oracle so i can’t help you anymore…
but first try running the check from the command line and see if you get the expected results :slight_smile:


#8

yep that was the first thing I tried, was command line for check_oracle
it works perfectly. I am just not sure what cfg file to put it in and where to look in the cognos web interface to see the results