Getting Logs into file

This forum is intended for the discussion of Nagios Core development. Feature requests, patches, bug fixes, and all types of development-related discussions are welcome!

NOTE: The SourceForge.net nagios-devel mailing list has been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Getting Logs into file

Postby ragu6ds » Wed Apr 04, 2018 5:01 am

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

Re: Getting Logs into file

Postby scottwilkerson » Wed Apr 04, 2018 9:54 am

User avatar
scottwilkerson
CTO
 
Posts: 8921
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Getting Logs into file

Postby ragu6ds » Thu Apr 05, 2018 12:11 am

Thank You very much
ragu6ds
 
Posts: 7
Joined: Wed Apr 04, 2018 4:53 am

Re: Getting Logs into file

Postby scottwilkerson » Thu Apr 05, 2018 9:09 am

glad to be of assistance
User avatar
scottwilkerson
CTO
 
Posts: 8921
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Getting Logs into file

Postby ragu6ds » Mon Apr 09, 2018 7:24 am

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

Re: Getting Logs into file

Postby scottwilkerson » Mon Apr 09, 2018 12:29 pm

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
User avatar
scottwilkerson
CTO
 
Posts: 8921
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Getting Logs into file

Postby ragu6ds » Mon Apr 09, 2018 7:33 pm

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

Re: Getting Logs into file

Postby scottwilkerson » Tue Apr 10, 2018 8:31 am

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.
User avatar
scottwilkerson
CTO
 
Posts: 8921
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Getting Logs into file

Postby ragu6ds » Wed Apr 11, 2018 4:03 am

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

Re: Getting Logs into file

Postby scottwilkerson » Wed Apr 11, 2018 7:09 am

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
User avatar
scottwilkerson
CTO
 
Posts: 8921
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises


Return to Nagios Core Development

Who is online

Users browsing this forum: Google [Bot] and 6 guests