Page 1 of 1

Setting up alert when item arrives in Unconfigured Object

Posted: Tue Mar 27, 2018 12:41 pm
by rifelixd
Gurus,

Is there a way I can set up an alert where Nagios prompts me when item arrives in Unconfigured object (this is how i set up to receive passive host checking". Thank you.

Re: Setting up alert when item arrives in Unconfigured Objec

Posted: Tue Mar 27, 2018 1:05 pm
by scottwilkerson
Using this plugin you can check the newobjects file on localhost
https://exchange.nagios.org/directory/P ... ze/details

here is what the whole command would look like

Code: Select all

/usr/local/nagios/libexec/check_filesize.sh -w 6 -c 6 /usr/local/nagiosxi/var/corelog.newobjects
If it is larger than 6 it will have new unconfigured objects

Re: Setting up alert when item arrives in Unconfigured Objec

Posted: Tue Mar 27, 2018 11:20 pm
by rifelixd
here is what the whole command would look like

Code: Select all

/usr/local/nagios/libexec/check_filesize.sh -w 6 -c 6 /usr/local/nagiosxi/var/corelog.newobjects
If it is larger than 6 it will have new unconfigured objects
@ scottwilkerson, I would just need to add this command to server correct ? I did not get the part if its larger than 6, does that means I will be prompted only if there is more 6 items waiting in Unconfigured object pane ?

Re: Setting up alert when item arrives in Unconfigured Objec

Posted: Wed Mar 28, 2018 8:12 am
by scottwilkerson
rifelixd wrote: @ scottwilkerson, I would just need to add this command to server correct ?
Yes, here is a guide
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
rifelixd wrote:I did not get the part if its larger than 6, does that means I will be prompted only if there is more 6 items waiting in Unconfigured object pane ?
This file is only 6 bytes big if it doesn't have any new unconfigured objects, but if there are unconfigured object it is much larger.

Re: Setting up alert when item arrives in Unconfigured Objec

Posted: Wed Mar 28, 2018 11:24 am
by rifelixd

Code: Select all

[root@a libexec]# pwd
/usr/local/nagios/libexec
[root@a libexec]# ls -l | grep check_filesize.sh
-rwxr-xr-x  1 **** ****   4486 Mar 29 00:10 check_filesize.sh
[root@a libexec]# ./check_filesize.sh -w 6 -c 6 /usr/local/nagiosxi/var/corelog.newobjects
-bash: ./check_filesize.sh: /bin/bash^M: bad interpreter: No such file or directory
Hi @scottwilkerson, I have tried but returned with error above.

Re: Setting up alert when item arrives in Unconfigured Objec

Posted: Wed Mar 28, 2018 12:10 pm
by scottwilkerson
File has windows line endings that needs to be fixed, you can run the following

Code: Select all

yum install dos2unix -y
dos2unix check_filesize.sh
then it should work

Re: Setting up alert when item arrives in Unconfigured Objec

Posted: Thu Mar 29, 2018 1:52 am
by rifelixd
scottwilkerson wrote:File has windows line endings that needs to be fixed, you can run the following

Code: Select all

yum install dos2unix -y
dos2unix check_filesize.sh
then it should work
Hi @scottwilkerson, Thanks for that, I have managed to run it now and upon checking, i found that my unconfigured object is empty but I got results as below. Should i change the parameters then ?

Code: Select all

[root@a libexec]# /usr/local/nagios/libexec/check_filesize.sh -w 6 -c 6 /usr/local/nagiosxi/var/corelog.newobjects
CRITICAL: /usr/local/nagiosxi/var/corelog.newobjects has size 427 Byte. Critical at 6. ;
Once done, I have to follow the guide below from page 4 onwards ?
https://assets.nagios.com/downloads/nag ... 1521993700

Re: Setting up alert when item arrives in Unconfigured Objec

Posted: Thu Mar 29, 2018 9:08 am
by scottwilkerson
rifelixd wrote: Once done, I have to follow the guide below from page 4 onwards ?
https://assets.nagios.com/downloads/nag ... 1521993700
Yes, that is exactly what I would do