Page 1 of 2

Service Performance Data not showing for Nagios plugins

Posted: Fri Dec 13, 2019 12:34 pm
by cybergene
Hello,
I'm trying to collect some performance data for Hosts and Services. All the services are showing Performance Data in the UI for Nagios Core but I don't see any files like service-perfdata, although the host-perfdata is there.
Screenshot_566.png
Here is the Nagios.cfg configurations:

Code: Select all

process_performance_data=1
# HOST AND SERVICE PERFORMANCE DATA PROCESSING COMMANDS

#host_perfdata_command=process-host-perfdata
#service_perfdata_command=process-service-perfdata

# HOST AND SERVICE PERFORMANCE DATA FILES

host_perfdata_file=/usr/local/nagios/var/host-perfdata
service_perfdata_file=/usr/local/nagios/var/service-perfdata

# HOST AND SERVICE PERFORMANCE DATA FILE TEMPLATES

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


# HOST AND SERVICE PERFORMANCE DATA FILE MODES

host_perfdata_file_mode=a
service_perfdata_file_mode=a


# HOST AND SERVICE PERFORMANCE DATA FILE PROCESSING INTERVAL

#host_perfdata_file_processing_interval=0
#service_perfdata_file_processing_interval=0

# HOST AND SERVICE PERFORMANCE DATA FILE PROCESSING COMMANDS

#host_perfdata_file_processing_command=process-host-perfdata-file
#service_perfdata_file_processing_command=process-service-perfdata-file


The Plugins are showing performance data:
Screenshot_567.png
Screenshot_568.png
1.What configuration or commands I need to ad for all the plugins and services to output performance data (i.e. for Disk, CPU, and Memory)?
--An you give me an example?
2. How to make it specific for 1 or more services?
3. Does the host-perfdata only collect ping data?Or is it configurable for others?
4.What's the difference between service-perfdata and service-perfdata.out ?

Your help is appreciated.

####

After few tests with the config; I noticed that is I don't activate the data processing:
from

Code: Select all

# HOST AND SERVICE PERFORMANCE DATA PROCESSING COMMANDS
# These commands are run after every host and service check is
# performed.  These commands are executed only if the
# enable_performance_data option (above) is set to 1.  The command
# argument is the short name of a command definition that you
# define in your host configuration file.  Read the HTML docs for
# more information on performance data.

#host_perfdata_command=process-host-perfdata
#service_perfdata_command=process-service-perfdata
To

Code: Select all

host_perfdata_command=process-host-perfdata
service_perfdata_command=process-service-perfdata
I won't get the service-perfdata.out file.

Re: Service Performance Data not showing for Nagios plugins

Posted: Fri Dec 13, 2019 5:17 pm
by ssax
The plugin determines if performance data is returned in the output, that's what generates the graphs automatically.

See here:

Code: Select all

http://nagios-plugins.org/doc/guidelines.html#AEN200
Here are the settings:

Code: Select all

service_perfdata_file=/usr/local/nagios/var/service-perfdata
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$\tSERVICEOUTPUT::$SERVICEOUTPUT$\tLONGSERVICEOUTPUT::$LONGSERVICEOUTPUT$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=15
service_perfdata_file_processing_command=process-service-perfdata-file
host_perfdata_file=/usr/local/nagios/var/host-perfdata
host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tHOSTOUTPUT::$HOSTOUTPUT$\tLONGHOSTOUTPUT::$LONGHOSTOUTPUT$
host_perfdata_file_mode=a
host_perfdata_file_processing_interval=15
host_perfdata_file_processing_command=process-host-perfdata-file
perfdata_timeout=5
Attach these files:

Code: Select all

find / -name npcd.cfg
find / -name process_perfdata.cfg

Re: Service Performance Data not showing for Nagios plugins

Posted: Tue Dec 17, 2019 10:36 am
by cybergene
Thanks for the reply @ssax

I can't find any of those

Code: Select all

find / -name npcd.cfg
find / -name process_perfdata.cfg
At the moment I installed Grafana over Nagios Core serverfollowing these instructions:
https://support.nagios.com/kb/article/n ... ana_Config

When I get to Adding a Query under "Grafana Configuration", I get an "Internal Server Error" pointing out the following:

Code: Select all

p>perfdata directory "/usr/local/nagios/share/perfdata/" is empty. Please check your Nagios config.
The nagios.cfg is pointing to a different location:

Code: Select all

host_perfdata_file=/usr/local/nagios/var/host-perfdata
service_perfdata_file=/usr/local/nagios/var/service-perfdata
Which location is the correct one for Nagios Core and for Grafana to pick it up properly?

Re: Service Performance Data not showing for Nagios plugins

Posted: Wed Dec 18, 2019 5:37 pm
by ssax
Did you install PNP4Nagios on your Core server? It doesn't come with it installed, you'll need to manually set it up. As an example:

Code: Select all

https://ahmermansoor.blogspot.com/2016/09/install-pnp4nagios-nagios-core-centos-7.html

Re: Service Performance Data not showing for Nagios plugins

Posted: Fri Jan 03, 2020 10:28 am
by cybergene
PNP4Nagios is installed as part of the manual I posted earlier(https://support.nagios.com/kb/article/n ... ana_Config).

I'm getting the same error when I go to [url]http://<nagios_ip>/pnp4nagios/index.php/graph[/url]
Screenshot_571.png

Code: Select all

Please check the documentation for information about the following error.
perfdata directory "/usr/local/nagios/share/perfdata/" is empty. Please check your Nagios config. <a href="http://docs.pnp4nagios.org/faq/3">Read FAQ online</a>

file [line]:
application/models/data.php [109]:
Any ideas?

Re: Service Performance Data not showing for Nagios plugins

Posted: Fri Jan 03, 2020 2:09 pm
by tgriep
Could you post the full nagios,cfg file as well as the commands.cfg file so we can check the settings and commands?
I suspect the command that generated the service performance file may have an error.

Re: Service Performance Data not showing for Nagios plugins

Posted: Mon Jan 06, 2020 2:31 pm
by cybergene
Here you go:

nagios.cfg
nagios.cfg
(46.66 KiB) Downloaded 371 times
commands.cfg
commands.cfg
(7.1 KiB) Downloaded 369 times

Re: Service Performance Data not showing for Nagios plugins

Posted: Mon Jan 06, 2020 3:01 pm
by tgriep
It looks like you tried to install nagiosgraph on the server and the configurations for the performance data is pretty much mixed up and it not functioning at ll.

I would start over by first getting PNP4nagios running and after that is verified, then install Grafana.

Here are some instructions for installing PNP4Nagios
http://docs.pnp4nagios.org/pnp-0.6/start
If the system is going to monitor a log of Hosts and Services, I would use the Bulk mode with NPCD procedure for installing it.

There is also a KB article you can look at.
https://support.nagios.com/kb/article/n ... s-801.html

Remove the following from the nagios.cfg file before hand.

Code: Select all

# begin nagiosgraph configuration
# process nagios performance data using nagiosgraph
process_performance_data=1
service_perfdata_file=/tmp/perfdata.log
service_perfdata_file_template=$LASTSERVICECHECK$||$HOSTNAME$||$SERVICEDESC$||$SERVICEOUTPUT$||$SERVICEPERFDATA$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=30
service_perfdata_file_processing_command=process-service-perfdata-for-nagiosgraph
# end nagiosgraph configuration
And, remove the following from the commands.cfg file before re-installing PNP4Nagios

Code: Select all

define command {

    command_name    process-host-perfdata
    command_line    /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /usr/local/nagios/var/host-perfdata.out
}


define command {

    command_name    process-service-perfdata
    command_line    /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /usr/local/nagios/var/service-perfdata.out
}

# begin nagiosgraph configuration
# command to process nagios performance data for nagiosgraph
define command {
  command_name process-service-perfdata-for-nagiosgraph
  command_line /usr/local/nagiosgraph/bin/insert.pl
}
# end nagiosgraph configuration

Re: Service Performance Data not showing for Nagios plugins

Posted: Tue Jan 07, 2020 12:45 pm
by cybergene
I did as you said and followed the instructions as from both articles:

Installed pnp4nagios from here : http://docs.pnp4nagios.org/pnp-0.6/install
Enable the configuration for Bulk Mode with NPCD :http://docs.pnp4nagios.org/pnp-0.6/conf ... _with_npcd

It seems to work now
Screenshot_572.png
Re-installed Grafana as per https://support.nagios.com/kb/article/n ... ana_Config

I'm not getting any Data in Grafana
Screenshot_573.png
All the files are present in this folder: /usr/local/pnp4nagios/var
Screenshot_574.png
What did I miss here?

Re: Service Performance Data not showing for Nagios plugins

Posted: Tue Jan 07, 2020 1:53 pm
by tgriep
Do you see the rrd files getting created in the sub folders of this folder?

Code: Select all

/usr/local/pnp4nagios/var/perfdata/
Or are the files in the sub folders of this folder?

Code: Select all

/usr/local/nagios/share/perfdata
What OS and Release is the server running?