Problems defining http check service in puppet


(James McKay) #1

I am having problems defining a service for a http check. My code is

define grnau-profile::monitoring::services::check_http (                                  
  $label,                                                                                 
  #$vhost,                                                                                
  #$vhost_address,                                                                        
  #  $vhost_uri,                                                                          
  #  $use_tls,                                                                            
) {                                                                                       
  @@icinga2::object::service { "checkhttp-${label}-${::fqdn}":                            
    host_name => "${::fqdn}",                                                             
    display_name => "Check website ${label}",                                             
    check_command => "http",                                                              
    vars => {                                                                             
      #http_vhost => $vhost,                                                              
      #http_address => $vhost_address,                                                    
      #http_uri => $vhost_uri,                                                            
      #http_ssl => $use_tls,                                                              
    },                                                                                    
    command_endpoint => "$::fqdn",                                                        
    target => "/etc/icinga2/conf.d/services/checkhttp-${label}-${::fqdn}.conf",           
  }                                                                                       
}     

It is initialised with

 grnau-profile::monitioring::services::check_http { 'website-http': 
   label => "website-http",                                         
   #vhost => "testcollab1.sydney.globalrecordings.net",             
   #vhost_address => "10.2.12.4",                                   
   #vhost_uri => "/",                                               
   # use_tls => False,                                              
 }     

The error is " Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type grnau-profile::monitioring::services::check_http at /etc/puppet/manifests/testcollab1.pp:24".

The puppet version is 3.8. (due to requriements that are trying to be removed).

A working define:

define grnau-profile::monitoring::services::disks (                           
  $label,                                                                     
  $mounts,                                                                    
  $wfree,                                                                     
  $cfree,                                                                     
  $inode_wfree,                                                               
  $inode_cfree,                                                               
) {                                                                           
  @@icinga2::object::service { "disks-${label}-${::fqdn}":                    
    host_name => "${::fqdn}",                                                 
    display_name => "Disk check for ${label}",                                
    check_command => "disk",                                                  
    vars => {                                                                 
      disk_partitions => $mounts,                                             
      disk_wfree => $wfree,                                                   
      disk_cfree => $cfree,                                                   
      disk_inode_wfree => $inode_wfree,                                       
      disk_inode_cfree => $inode_cfree,                                       
    },                                                                        
    command_endpoint => "$::fqdn",                                            
    target => "/etc/icinga2/conf.d/services/disks-${label}-${::fqdn}.conf",   
  }                                                                           
}            

With a working declaration:

  grnau-profile::monitoring::services::disks { "ramah-backups-programs0":
        label => "programs0",
        mounts => ["/mnt/backups/misc1"],
        wfree => 10,
        cfree => 10,
        inode_wfree => 10,
        inode_cfree => 10,
  }

Can anybody spot what is wrong?


(Michael Friedrich) #2

From a lexical parser’s viewpoint: The defined resource ...::check_http has an underscore in it, disks does not net. Furthermore I’d recommend to avoid the dash in the first item too. Better go for characters only.


(Markus Frosch) #3

Hyphen are not allowed in a Puppet Class Path, and it looks like autoloading fails because of this.

Could be any other problem with autoloading regarding your Puppet setup… Especially your module path.