Getting Logs into file

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
ragu6ds
Posts: 13
Joined: Wed Apr 04, 2018 4:53 am

Getting Logs into file

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Getting Logs into file

Post by scottwilkerson »

All available standard macros are listed here
https://assets.nagios.com/downloads/nag ... olist.html
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
ragu6ds
Posts: 13
Joined: Wed Apr 04, 2018 4:53 am

Re: Getting Logs into file

Post by ragu6ds »

Thank You very much
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Getting Logs into file

Post by scottwilkerson »

glad to be of assistance
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
ragu6ds
Posts: 13
Joined: Wed Apr 04, 2018 4:53 am

Re: Getting Logs into file

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Getting Logs into file

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
ragu6ds
Posts: 13
Joined: Wed Apr 04, 2018 4:53 am

Re: Getting Logs into file

Post 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
Last edited by ragu6ds on Tue Apr 10, 2018 8:35 am, edited 1 time in total.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Getting Logs into file

Post 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.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
ragu6ds
Posts: 13
Joined: Wed Apr 04, 2018 4:53 am

Re: Getting Logs into file

Post 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$
Last edited by ragu6ds on Wed Apr 11, 2018 7:11 am, edited 1 time in total.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Getting Logs into file

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked