Page 1 of 1

Getting Logs into file

Posted: Wed Apr 04, 2018 5:01 am
by ragu6ds
Dear Experts,

currently am using nagios core, and getting logs into file,

in nagios.cfg template is defined as below

host_perfdata_file_template=$HOSTNAME$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$
service_perfdata_file_template=$HOSTNAME$\t$SERVICEDESC$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$

am good with this template and format.

but my requirement is i need to get HOST GROUP NAME ,SERVICE GROUP NAME and CONTACT GROUP NAME also in this log for each service or host

, i tried but am not able to get,

Please help me in this regard whether this is possible or need to do any workaround to do, this will be great help.

Regards
Ragu

Re: Getting Logs into file

Posted: Wed Apr 04, 2018 9:54 am
by scottwilkerson
All available standard macros are listed here
https://assets.nagios.com/downloads/nag ... olist.html

Re: Getting Logs into file

Posted: Thu Apr 05, 2018 12:11 am
by ragu6ds
Thank You very much

Re: Getting Logs into file

Posted: Thu Apr 05, 2018 9:09 am
by scottwilkerson
glad to be of assistance

Re: Getting Logs into file

Posted: Mon Apr 09, 2018 7:24 am
by ragu6ds
hi,

i tried to get below information in log

$CONTACTNAME$
$CONTACTALIAS$
$CONTACTEMAIL$
$CONTACTGROUPNAME$
$CONTACTGROUPNAMES$


am getting null values,

by below command

define command{
command_name process-service-perfdata_test_cont
command_line /bin/echo -e "CONTACTNAME=$CONTACTNAME$|CONTACTALIAS=$CONTACTALIAS$|CONTACTEMAIL=$CONTACTEMAIL$|CONTACTGROUPNAME=$CONTACTGROUPNAME$|CONTACTGROUPNAMES=$CONTACTGROUPNAMES$" >> /usr/local/nagios/var/contact_detail
}

please assist

Re: Getting Logs into file

Posted: Mon Apr 09, 2018 12:29 pm
by scottwilkerson
ragu6ds wrote:hi,

i tried to get below information in log

$CONTACTNAME$
$CONTACTALIAS$
$CONTACTEMAIL$
$CONTACTGROUPNAME$
$CONTACTGROUPNAMES$


am getting null values,

by below command

Code: Select all

define command{
                command_name             process-service-perfdata_test_cont
                command_line  /bin/echo -e "CONTACTNAME=$CONTACTNAME$|CONTACTALIAS=$CONTACTALIAS$|CONTACTEMAIL=$CONTACTEMAIL$|CONTACTGROUPNAME=$CONTACTGROUPNAME$|CONTACTGROUPNAMES=$CONTACTGROUPNAMES$" >> /usr/local/nagios/var/contact_detail
               }
please assist
Are you firing this as a notification handler? I ask because the name implies something to do with perfdata, and the Service Perf Data & Host Perf Data columns say no for these macros.

these contact variables are going to be specific to the contact being notified in a notification

Re: Getting Logs into file

Posted: Mon Apr 09, 2018 7:33 pm
by ragu6ds
Hi,
Yes, trying g to get these details while fetching perf data, for each service who are all the contact person in the log, is it possible?

scottwilkerson

Actually need to get contact information also in each log (like contact person, emails)...Please assist

Re: Getting Logs into file

Posted: Tue Apr 10, 2018 8:31 am
by scottwilkerson
ragu6ds wrote:Hi,
Yes, trying g to get these details while fetching perf data, for each service who are all the contact person in the log, is it possible?
That is not possible.

Re: Getting Logs into file

Posted: Wed Apr 11, 2018 4:03 am
by ragu6ds
Thank you,

is there any option to get the entire status information and performance data , because while writing into log first and last lines are missing in performance data output $SERVICEPERFDATA$

Re: Getting Logs into file

Posted: Wed Apr 11, 2018 7:09 am
by scottwilkerson
ragu6ds wrote:Thank you,

is there any option to get the entire status information into log..please
The current status information is stored in a file called status.dat

This is also available in the JSON CGIs

To get started using the CGIs: Browse to the jsonquery.html url in your web browser:

Code: Select all

http://<nagios server>/nagios/jsonquery.html