CONFIG
======

All NagiosGrapher Configuration can be done by altering the ngraph.ncfg. The 
first part - only the "config" paragraph configures NagiosGrapher itself. All 
the rest configures the graphs.

config PARAGRAPH
----------------

an example:

define config {

        # the pipe for interprocesscommunication
        pipe                    /var/lib/nagios/ngraph.pipe

        # UDP Port if using
        port                    5667

        # UDP input buffer
        buffer                  1024

        # possible values: network, pipe
        # for datamining with fifo or udp socket
        interface               network

        # PID File to write
        # Please use sub folder for the ObjectCache (NagiosGrapher.pm)
        pidfile                 /var/run/nagios_grapher/nagios_grapher.pid

        # User and group ownes the process
        user                    nagios
        group                   nagios

        # the RRD Step
        step                    60

        # the RRD Heartbeat
        heartbeat               600
        
        # where to store the rrd files
        rrdpath                 /var/lib/nagios/rrd/

        # where to store temp files (index.xml)
        tmppath                 /tmp/nagiosgrapher/

        # RRDTOOL Fontfile
        fontfile                /usr/local/rrdtool/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf

        # type for extending the serviceext (SINGLE, MULTIPLE)
        # and their locations
        serviceext_type         SINGLE
        serviceextinfo          /etc/nagios/serviceextinfo.cfg
        serviceext_path         /etc/nagios/serviceext

        # the url of the graphing interface
        url                     /nagios/cgi-bin/graphs.cgi

        # the main nagios config and the cgi config file
        nagios_config           /etc/nagios/nagios.cfg
        cgi_config              /etc/nagios/cgi.cfg

        # the syntax for the serviceext entries
        icon_image_tag          dot.gif' border="0"></a><A TARGET="_blank" HREF="graphs.cgi?###URL###" BORDER="0"><img src="/nagios/images/logos/graph.png" border="0"logos/dot.gif

        # logfile and loglevel
        log_file                /var/log/nagios/ngraph.log
        log_level               255

        # rrd display options
        rrd_color_background    fcfcfc
        rrd_color_font          333333
        rrd_color_arrow         ff0000
        rrd_color_frame         333333
        rrd_color_grid
        rrd_color_canvas        ffffff
        rrd_color_shadea        ffffff
        rrd_color_shadeb        ffffff

        # Allow the pagebrowser worldwide
        fe_use_browser_all      0
        # Allow the pagebrowser only for specific users
        fe_use_browser_for      mhein,nagiosadmin
        # Allow URL override (graphs.cgi?browser=1)
        fe_use_browser_url      0

	# define default host and default service for your start page
	# values (host name and service name)are supposed to be exactly the same as
	# defined in your nagios configuration or as found in your NG-drop-down boxes
	#
	# default_host            some_host_name
	# default_service         * All Services


}

        
The different log levels are:
-----------------------------
	1	recognized services and their values
	2	not recognized values
	4	program stati
	8	serviceext
	16	rrd stati
	32	pipe input
	64  debug regex
	128 debug config
	
any combination is valid.

Do not forget to configure logrotate for this logfile. Depending on your log 
level the file grows very very fast and NagiosGrapher does not have its own
logration.


Attention Nagios V 1.x Users!
-----------------------------
Because Nagios before V 2 doesn't support recursive configuration NagiosGrapher
must store all serviceextinfos in a single file. So use:

		serviceext_type			SINGLE
		serviceextinfo			/etc/nagios/servicextinfo.cfg
		

For better performance and administration Nagios V.2 Users should use 

		serviceext_type			MULTIPLE
		serviceext_path			/etc/nagios/servicext


Setting up the file interface (which is now default!!!)
-------------------------------------------------------
ngraph.ncfg:
	interface		file
	perffile_path		/usr/local/nagios/var

nagios.cfg:
	process_performance_data=1
	service_perfdata_file=/usr/local/nagios/var/service-perfdata
	service_perfdata_file_template=$HOSTNAME$\t$SERVICEDESC$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\t$TIMET$
	service_perfdata_file_mode=a
	service_perfdata_file_processing_interval=30
	service_perfdata_file_processing_command=process-service-perfdata-file

commands.cfg:
	define command{
        	command_name process-service-perfdata-file
        	command_line mv /usr/local/nagios/var/service-perfdata /usr/local/nagios/var/service-perfdata.$TIMET$
        	}
		

ngraph PARAGRAPHs / basic parameters
------------------------------------

For including multible configurations try:

cfg_dir=/etc/nagios/ngraph.d

or

cfg_file=/etc/nagios/multigraph.cfg

The parameters are not defined inside a block.

With these paragraphs the graphs are defined. Each paragraph define a single 
value. Each service can provide any number of values. Let's start with a 
simple example - the output of chec_procs (eg. "OK - 30 processes running").

define ngraph{
        service_name            lx-proc
        graph_log_regex         ([0-9]+) proc
        graph_value             processes
        graph_units             processes
        graph_legend            running processes
        
        # Legend EndOfLine and max legend length to the next ...
        graph_legend_eol	    left
        graph_legend_max        30
        
        rrd_plottype            LINE2
        rrd_color               00a000
        
}

This define will lead to a simple line graph for all services with "lx-proc" in
their name. 

All trailing blanks will be removed. If you need trailing blanks just code the values:
    service_name                'special_service '

Each parameter line in-depth:

- service_name
With the help of this regexp/part NagiosGRapher will identify the individual
services. eg. "lx-procs" will match on "lx-procs", "lx-procs samba", 
"all lx-procs", ...

- graph_log_regex
This defines the value to cut out from the service output. Only the value 
inside the brackets is used. If you need trailing whitespace
just quote the regex

- graph_value
Each value must have its own name which is used to define the value inside the
rrds

- graph_units
This is graph's label of the x-axis 

- graph_legend
The graph's legend

- rrd_plotttype
Possible values are LINE{1|2|3}, AREA or STACK. For more details have a look at
http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/manual/rrdgraph.html

- rrd_color
Obvious the color of the graph


Additional (advanced) parameters
--------------------------------

- graph_perf_regex 
As graph_log_regex but for performancedata

- hide
Can be yes or no. This Parameters hide the value from the graph. Usefull for 
CDEFs (se below).

- page
Sometimes a plugin delivers values you want to graph but not to be shown in the
same graph. Then you can arrange the values on different graphs. (Have a look 
inside the ping template).

- type
Default VALUE but also can be CDEF,GPRINT and HRULE (see below)

- rrd_type
By default GAUGE but can be all COUNTER,DERIVE and ABSOULTE. For more details
please read the "DS" paragraph on 
http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/manual/rrdcreate.html

- rrd_min
Minimal value

- rrd_max
Maximal value

- graph_upper_limit
Same as rrdtool upper-limit

- graph_lower_limit
Same as rrdtool lower-limit

Other types than GAUGE
----------------------

This types only affect the painting not the collecting of the data

- CDEF
Used to calculate another value during ploting the graph. As additional 
parameter you need "graph_calc". Because this parameter is directly forwarded
to the rrdtool it use the same syntax. For a tutorial have a look at 
http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/tutorial/rpntutorial.html or
the the "check_load" template. 

- HRULE
just paints a simple horizontal line for the "hrule_value" inside the graph. 
See the templates

- GPRINT
Get the last/average/... value of a graph and print it below the legend. For 
the possible functions check 
http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/tutorial/ 

See the print_eol and print_repeat options from the COMMENT Syntax.

- VDEF

Example:

define ngraph{
        service_name            PROCS
        type                    VDEF
        graph_value             vdef_procs_average
        graph_units
        graph_legend            Average values
        
        # The VDEF calc syntax, see rrdtool homepage for details.
        graph_calc              cdef_procs,AVERAGE
        rrd_plottype            LINE1
        rrd_color               0000ff
        hide                    no
}

- COMMENT

define ngraph{
	service_name		PROCS
	type			    COMMENT
	print_description
	print_eol		    justify
	print_repeat		2
}

define ngraph{
	service_name		PROCS
	type			    COMMENT
    
    # The description
	print_description	-- Counting the processes running on the machine --
    
    # The EndOfLine wrapper of the rrdrtool
    # possible values are:
    #  - center
    #  - justify
    #  - left
    #  - right
    #  - nospace
    #  - none
    #
    # To add spaces after, try:
    # Syntax: center[:2]
	print_eol		    center
    
    # Repeats the printout, 1 displays the line twice.
	print_repeat		0
}

Multigraphs
-----------

These are the syntax for the multigraphs:

define nmgraph{
        # Display the graph under the host or a new fake host (similar to a folder)
        host_name               * Multigraphen
        
        # The displayname
        service_name            all services
        
        # RegEX to collect the hosts
        hosts                   .*?
        
        # RegEX to collect the services on the hosts
        services                .*?
        
        # line or stack or area
        graph_type              line
        
        # normal or reverse ordering of the services or leave it blank
        # order                   reverse
        
        # space seperated list of colors or leave blank to use the default colors
        # defined in NagiosGrapher.pm
        # colors                  ff8000, 00ff00, 0000ff
}
