dev/provisioning/modules/puppi/README_check.md
changeset 28 b0b56e0f8c7f
equal deleted inserted replaced
27:a2342f26c9de 28:b0b56e0f8c7f
       
     1 # PUPPI CHECK INSTRUCTIONS
       
     2 Documentation and examples related to the puppi action check
       
     3 
       
     4 ## SYNOPSIS (cli)
       
     5         puppi check [project_name] [-r yes|no|fail]
       
     6 
       
     7 ## EXAMPLES (cli)
       
     8 Run host-wide checks.
       
     9         puppi check
       
    10 Run project "myapp" specific tests AND host-wide checks
       
    11         puppi check myapp
       
    12 
       
    13 Run checks and send reports only if some of them fail
       
    14         puppi check -r fail
       
    15 
       
    16 Run checks and send reports
       
    17         puppi check -r yes
       
    18 
       
    19 Run checks and show only failed ones
       
    20         puppi check -s fail
       
    21 
       
    22 ## EXAMPLES (puppet)
       
    23 The basic define related to a check is:
       
    24         puppi::check   - Creates a single command to be placed in the check sequence.
       
    25 
       
    26 A simple example might be:
       
    27         puppi::check { 'Port_Apache':
       
    28           command  => "check_tcp -H ${fqdn} -p 80" ,
       
    29         }
       
    30 
       
    31 but also something that uses variables Puppet already knows
       
    32         puppi::check { 'apache_process':
       
    33           command  => "check_procs  -c 1: -C ${apache::params::processname}" ,
       
    34         }
       
    35 
       
    36 To avoid repetitions you can include the relevant checks in defines you already have
       
    37 to manage, for example, virtualhosts, and use the data you already provide to configure
       
    38 their local puppi checks. 
       
    39         puppi::check { "Url_$name":
       
    40           enable   => $enable,
       
    41           command  => "check_http -I '${target}' -p '${port}' -u '${url}' -s '${pattern}'" ,
       
    42         }
       
    43 
       
    44 You can also use custom scripts for your checks. They should behave similarly to Nagios plugins inn their exit codes: 0 for SUCCESS, 1 for WARNINGS, 2 for CRITICAL. In this case you've to specify the directory there the scripts stays:
       
    45         puppi::check { 'my_stack':
       
    46           command  => 'stack_check.sh',
       
    47           bade_dir => '/usr/bin',
       
    48         }
       
    49 
       
    50 
       
    51 ## EXAMPLES (with example42 puppet modules)
       
    52 If you use the whole Example42 modules set you get automatically many service related checks out of the box.
       
    53 Just set (via an ENC, facts or manifests) these puppet variables:
       
    54         $monitor="yes" # To enable automagic monitoring
       
    55         $monitor_tool = "puppi"  # As monitoring tool define at least puppi. If you like Nagios, you may use:
       
    56         $monitor_tool = ["nagios","puppi"] # This enables the below checks both for Puppi and Nagios
       
    57         $puppi=yes # To enable puppi extensions autoloading
       
    58 
       
    59 To the port and service checks automatically added for the included modules, you can add custom url checks 
       
    60 with something like:
       
    61         monitor::url { "URL_Check_Database_Connection":
       
    62           url      => "http://www.example42.com/check/db",
       
    63           pattern  => 'SUCCESS',
       
    64           port     => '80',
       
    65           target   => "${fqdn}",
       
    66         }
       
    67