Page 1 of 1

Add service

Posted: Mon May 30, 2016 3:49 pm
by simpleacc
Hello guys,

I am newbie with nagios and I need some help... I have installed this fantastic software into my Debian server. Now I am configuring it and need support with one topic...
I want to add a simple check (temperature). I can check system's temperature from "/sys/class/thermal/thermal_zone0/temp". I have tried add this into commands.cfg. I am 115% sure that I was wrong :(

define command{
command_name temp
command_line cat /sys/class/thermal/thermal_zone0/temp
}

Someone can explain me how to create this service? I have tried find a 'google' solution but... nothing.

Sorry for the inconvenience.

Thanks in advance.

Re: Add service

Posted: Mon May 30, 2016 8:38 pm
by rkennedy
Just to clarify - you posted this in the Nagios XI section, are you using XI or Nagios Core?

For the record, Nagios XI will not run stable on debian currently.

Re: Add service

Posted: Tue May 31, 2016 7:19 am
by simpleacc
I am using Nagios Core. Maybe was a wrong section... Sorry

Moderator's Note: We moved the post to the Nagios Core Support forum.

Re: Add service

Posted: Tue May 31, 2016 10:12 am
by rkennedy
I would create a bash script, in your /usr/local/nagios/libexec/ directory, and then in it put your bash commands like so -

Code: Select all

#!/bin/bash
cat /sys/class/thermal/thermal_zone0/temp
Make sure it's executable, and that the permissions match the rest of your plugins (depending on how you installed Core). Then, create your command definition like this. (you could always do further regex matching to get certain variables, and add thresholds) -

Code: Select all

define command{
command_name temp
command_line $USER1$/yourscript.sh
}
Now, assign the check_command temp to a service.