glob service_perfdata_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
skol
Posts: 29
Joined: Mon Jan 28, 2013 3:56 pm

glob service_perfdata_file

Post by skol »

Is it possible to glob or otherwise dynamically set the service_perfdata_file?

Code: Select all

service_perfdata_file=/nagios/var/service_perfdata.log.$TIMET$
I was hoping that would work, or something similar. Any ideas? Background: I have a process which keeps state of where its at in the perfdata.log, and I'm trying to properly do log rotation, rather then create yet another process to call via service_perfdata_file_processing_command.


Thanks!
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: glob service_perfdata_file

Post by abrist »

I would say yes, the $TIMET$ macro should be supported as it is used in other places in the config file. The real question is whether or not the perfdata reapers/npcd will work right with the changes. Let us know what happens!
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
skol
Posts: 29
Joined: Mon Jan 28, 2013 3:56 pm

Re: glob service_perfdata_file

Post by skol »

It just writes to the literal file: /nagios/var/service_perfdata.log.$TIMET$ - looks like it isn't expanding it properly.. any ideas?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: glob service_perfdata_file

Post by abrist »

Well, I just dug deeper and looks like you cannot use the $TIMET$ with certain options (the perfdata file directives seem to be some of them).

Just a curiosity, the perfdata file should be reaped very 15 seconds or so. Why are you trying to enable log rotation on it?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
skol
Posts: 29
Joined: Mon Jan 28, 2013 3:56 pm

Re: glob service_perfdata_file

Post by skol »

This is just for opensource core 4.x nagios - perfdata logs just grow continuously.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: glob service_perfdata_file

Post by abrist »

What method of perfdata processing are you using? npcd? bulk mode? etc?
Could you post the command you are currently using for processing?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
skol
Posts: 29
Joined: Mon Jan 28, 2013 3:56 pm

Re: glob service_perfdata_file

Post by skol »

we're not running any processing on it - we just specify the filename (service_perfdata_file) and template. I'm trying to rotate the files without additional scripts (service_perfdata_file_processing_command) or use logrotate.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: glob service_perfdata_file

Post by abrist »

Well, you most likely need to use one of those (logrotate or service_perfdata_file_processing_command).
You could create a script that rotates the log file and run it from service_perfdata_file_processing_command - just set the interval to something much longer, like and hour/day/week/whatever.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
skol
Posts: 29
Joined: Mon Jan 28, 2013 3:56 pm

Re: glob service_perfdata_file

Post by skol »

Ok. Thanks for the help!
cmerchant
Posts: 546
Joined: Wed Sep 24, 2014 11:19 am

Re: glob service_perfdata_file

Post by cmerchant »

Glad we could help. We'll go ahead and close this thread. Thanks.
Locked