Graphs
From Wiki Centreon
| Languages: |
English |
ODS graphs are made with RRD.
To Graph, you need to :
- Activate Perfdata in Nagios,
- Configure ODS in order to catch data,
- Use perfdata compatible plugins to graph what you want.
Before starting :
- Request Oreon v1.4 or higher
- Request you have already patch the version !!! (patch available here : [1])
- Be aware that paths in this sample config are standard paths you should adapt, bold paths are to be the same to run properly.
(Numerous patch fixes ODS bugs, it's important to do it !!)
Contents |
Perfdata activation in Nagios
- process-service-perfdata plugin
nano /usr/local/nagios/libexec/process-service-perfdata
Paste this :
#!/bin/bash # some parameters passed on command line TIMET=$1 HOSTNAME=$2 SERVICEDESC=$3 OUTPUT=$4 SERVICESTATE=$5 PERFDATA=$6 PERFFILE="/usr/local/nagios/var/service-perfdata" /usr/bin/printf "%b" "$TIMET\t$HOSTNAME\t$SERVICEDESC\t$OUTPUT\t$SERVICESTATE\t$PERFDATA\n" >> $PERFFILE
chmod +rx /usr/local/nagios/libexec/process-service-perfdata
This plugin send nagios's plugins results in the '/usr/local/nagios/var/service-perfdata' file and must be in your current Nagios plugins dirrectory.
- Nagios configuration via Oreon
1. First of all, create a new Nagios command :
1.1. Go to 'Oreon -> Configuration -> Commands -> Notification Commands'
1.2. Add a new 'miscellaneous command'
name :
process-service-perfdata
command line :
$USER1$/process-service-perfdata "$LASTSERVICECHECK$" "$HOSTNAME$" "$SERVICEDESC$" "$SERVICEOUTPUT$" "$SERVICESTATE$" "$SERVICEPERFDATA$"
1.3. Save
2. Then, activate this command in Nagios :
2.1. Go to 'Oreon -> Configuration -> Nagios -> Nagios CFG'
2.2. Set 'Performance Data Processing Option' option to YES
2.3. In 'Service Performance Data Processing Command', select 'process-service-perfdata' plugin
2.4. Save changes and restart Nagios
After a few time, go to /usr/local/nagios/var/ or the directory you choose
There must be a new file called service-perfdata filling step by step by Nagios's activated check plugins results
Configure ODS in order to catch data
ODS is fully configured in Oreon's interface
- Oreon informations
1. Go to 'Oreon -> Options -> General Options -> OreonDataStorage' (Cent v2.0 : Go to Administration --> Options --> CentStorage)
2. Set 'Path to RRDTool Database' to '/usr/local/oreon/OreonDataStorage/'
2a. Cent v2.0 : Set 'Path to RRDTool Database For Metrics' to '/var/lib/centreon/metrics/'
3. Set 'RRDTool database size' to '365' (ie 365 days)
4. Don't select 'RRDTool auto delete'
5. Set 'Sleep Time' = '10' and 'Purge check interval' = '60'
6. Set 'Storage Type' to 'RRDTool & MySQL' or 'RRDTool' if you don't use the database
7. Set 'Perfdata' to /usr/local/nagios/var/service-perfdata
8. Set 'Drop Data in another file' if you want to keep log of data ungraphed and set a valid path to file in which you want to store them
- Logs
1. Select 'Archive Nagios Logs'
2. Set 'Logs retention duration' to 31
3. Set 'Nagios current log file to parse' to (my_nagios_log_path)/nagios.log' (or your current)
- Monitoring
Select 'Fast status log parsing' only if you know what you're doing, usually keep it unselected
SAVE CONFIG
- By the way
In 'Oreon -> Options -> General Options -> RRDTool' (Cent v2.0 : Go to 'Administration --> Options --> RRDTool')
1. Check that 'Directory + RRDTOOL Binary' is correct (ex : /usr/bin/rrdtool)
2. Check that rrdtool version is correct ('rrdtool --version' will provide the answer)
3. Select 'Simple Graphs Renderer' for Favorite Graphs Engine
In 'Oreon -> Options -> General Options -> Nagios' (Cent v2.0 : 'Administration --> Options --> Nagios')
Check that paths to files are correct (for full ODS, 'Using Perfparse' option is not requested)
Run ODS or CentStorage demon
v1.4 $> /etc/init.d/ods start v2.0 $> /etc/init.d/centstorage start
Check that all is running correctly :
v1.4 $> /etc/init.d/ods status v2.0 $> /etc/init.d/centstorage status
v1.4 $> ls /usr/local/oreon/OreonDataStorage/ v2.0 $> ls -la /var/lib/centreon/metrics/
Look for files named [0-9]*.rrd in this directory, wait 5-10 minutes and check your graphs.
Using ODS compatible Plugins
ODS catches a specific string group within Nagios plugin's results. Readable data for ODS are those behind the | in result's string.
Exemple (in bold : readable data for ODS) :
cpu_user:OK-0% cpu_system:OK-0% cpu_idle:WARNING-97>70% | cpu_user=0%;120;90; cpu_system=0%;100;70; cpu_idle=97%;100;70;
This is the same data that used Perfparse but much more compliant.
General format is :
(user_readable_message_for_nagios) | (label)=(value)(metric);(warn level);(crit level);(min level);(max level)
Only bold string are requested by ODS to be able to read data.
Check if a plugin is perfdata or perfparse compatible :
1. (plugin_name) --help : usually, -f option to get perfdata.
2. Just run the plugin in a terminal to check its response format.
3. In Oreon or Nagios : have a look to 'Performance Data' info when checking a service (field must contain strings after the '|' in the message).
Graphs
Go in Oreon's views
Check you have got a host list in 'Oreon's graph' field
Enjoy :-)

