Add service

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
simpleacc
Posts: 2
Joined: Mon May 30, 2016 3:41 pm

Add service

Post 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.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Add service

Post 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.
Former Nagios Employee
simpleacc
Posts: 2
Joined: Mon May 30, 2016 3:41 pm

Re: Add service

Post 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.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Add service

Post 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.
Former Nagios Employee
Locked