params.pp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. # == Class: icinga2::params
  2. #
  3. # This class contains config options and settings for use elsewhere in the module.
  4. #
  5. # === Parameters
  6. #
  7. # See the inline comments.
  8. #
  9. class icinga2::params {
  10. ##############################
  11. # Icinga 2 common parameters
  12. ##############################
  13. #This section has parameters that are used by both the client and server subclasses
  14. ##################
  15. # Icinga 2 common package parameters
  16. case $::operatingsystem {
  17. #CentOS systems:
  18. 'CentOS': {
  19. #Pick the right package provider:
  20. $package_provider = 'yum'
  21. }
  22. #Ubuntu systems:
  23. 'Ubuntu': {
  24. #Pick the right package provider:
  25. $package_provider = 'apt'
  26. }
  27. #Debian systems:
  28. 'Debian': {
  29. #Pick the right package provider:
  30. $package_provider = 'apt'
  31. }
  32. #Fail if we're on any other OS:
  33. default: { fail("${::operatingsystem} is not supported!") }
  34. }
  35. ##############################
  36. # Icinga 2 server parameters
  37. ##############################
  38. #Whether to manage the package repositories
  39. $manage_repos = true
  40. $use_debmon_repo = false
  41. $server_db_type = 'pgsql'
  42. $install_mail_utils_package = false
  43. #Database paramters
  44. $db_name = 'icinga2_data'
  45. $db_user = 'icinga2'
  46. $db_password = 'password'
  47. $db_host = 'localhost'
  48. $db_port = '5432'
  49. #Whether to install the plugin packages when the icinga2::server class is applied:
  50. $server_install_nagios_plugins = true
  51. #What Icinga 2 features should be enabled when icinga2::server::features class is applied:
  52. $server_enabled_features = ['checker','notification']
  53. $server_disabled_features = []
  54. ##############################
  55. # Icinga 2 server package parameters
  56. #Pick the right package parameters based on the OS:
  57. case $::operatingsystem {
  58. #CentOS systems:
  59. 'CentOS': {
  60. case $::operatingsystemmajrelease {
  61. '6': {
  62. #Icinga 2 server package
  63. $icinga2_server_package = 'icinga2'
  64. $icinga2_server_plugin_packages = ['nagios-plugins-nrpe', 'nagios-plugins-all', 'nagios-plugins-openmanage', 'nagios-plugins-check-updates']
  65. $icinga2_server_mail_package = 'mailx'
  66. }
  67. '7': {
  68. #Icinga 2 server package
  69. $icinga2_server_package = 'icinga2'
  70. $icinga2_server_plugin_packages = ['nagios-plugins-nrpe', 'nagios-plugins-all', 'nagios-plugins-openmanage', 'nagios-plugins-check-updates']
  71. $icinga2_server_mail_package = 'mailx'
  72. }
  73. #Fail if we're on any other CentOS release:
  74. default: { fail("${::operatingsystemmajrelease} is not a supported CentOS release!") }
  75. }
  76. }
  77. #Ubuntu systems:
  78. 'Ubuntu': {
  79. case $::operatingsystemrelease {
  80. #Ubuntu 12.04 doesn't have nagios-plugins-common or nagios-plugins-contrib packages available...
  81. '12.04': {
  82. $icinga2_server_package = 'icinga2'
  83. $icinga2_server_plugin_packages = ['nagios-plugins', 'nagios-plugins-basic', 'nagios-plugins-standard', 'nagios-snmp-plugins', 'nagios-plugins-extra', 'nagios-nrpe-plugin']
  84. $icinga2_server_mail_package = 'mailutils'
  85. #Specify '--no-install-recommends' so we don't inadvertently get Nagios 3 installed; it comes as a recommended package with most of the plugin packages:
  86. $server_plugin_package_install_options = '--no-install-recommends'
  87. }
  88. #...but 14.04 does:
  89. '14.04': {
  90. $icinga2_server_package = 'icinga2'
  91. $icinga2_server_plugin_packages = [ 'nagios-plugins', 'nagios-plugins-basic', 'nagios-plugins-common', 'nagios-plugins-standard', 'nagios-snmp-plugins', 'nagios-plugins-extra', 'nagios-plugins-contrib', 'nagios-nrpe-plugin']
  92. $icinga2_server_mail_package = 'mailutils'
  93. #Specify '--no-install-recommends' so we don't inadvertently get Nagios 3 installed; it comes as a recommended package with most of the plugin packages:
  94. $server_plugin_package_install_options = '--no-install-recommends'
  95. }
  96. #Fail if we're on any other Ubuntu release:
  97. default: { fail("${::operatingsystemmajrelease} is not a supported Ubuntu release version!") }
  98. }
  99. }
  100. #Debian systems:
  101. 'Debian': {
  102. case $::operatingsystemmajrelease {
  103. #Only tested on Debian7
  104. '7': {
  105. $icinga2_server_package = 'icinga2'
  106. $icinga2_server_plugin_packages = ['nagios-plugins', 'nagios-plugins-basic', 'nagios-plugins-standard', 'nagios-snmp-plugins', 'nagios-plugins-contrib', 'nagios-nrpe-plugin']
  107. $icinga2_server_mail_package = 'mailutils'
  108. #Specify '--no-install-recommends' so we don't inadvertently get Nagios 3 installed; it comes as a recommended package with most of the plugin packages:
  109. $server_plugin_package_install_options = '--no-install-recommends'
  110. }
  111. #Fail if we're on any other Debian release:
  112. default: { fail("${::operatingsystemmajrelease} is not a supported Debian release version!") }
  113. }
  114. }
  115. #Fail if we're on any other OS:
  116. default: { fail("${::operatingsystem} is not supported!") }
  117. }
  118. ##############################
  119. # Icinga 2 server config parameters
  120. case $::operatingsystem {
  121. #CentOS systems:
  122. 'CentOS': {
  123. #Settings for /etc/icinga2/:
  124. $etc_icinga2_owner = 'icinga'
  125. $etc_icinga2_group = 'icinga'
  126. $etc_icinga2_mode = '0750'
  127. #Settings for /etc/icinga2/icinga2.conf:
  128. $etc_icinga2_icinga2_conf_owner = 'icinga'
  129. $etc_icinga2_icinga2_conf_group = 'icinga'
  130. $etc_icinga2_icinga2_conf_mode = '0640'
  131. #Settings for /etc/icinga2/conf.d/
  132. $etc_icinga2_confd_owner = 'icinga'
  133. $etc_icinga2_confd_group = 'icinga'
  134. $etc_icinga2_confd_mode = '0750'
  135. #Settings for /etc/icinga2/features-available/:
  136. $etc_icinga2_features_available_owner = 'icinga'
  137. $etc_icinga2_features_available_group = 'icinga'
  138. $etc_icinga2_features_available_mode = '0750'
  139. #Settings for /etc/icinga2/features-enabled/:
  140. $etc_icinga2_features_enabled_owner = 'icinga'
  141. $etc_icinga2_features_enabled_group = 'icinga'
  142. $etc_icinga2_features_enabled_mode = '0750'
  143. #Settings for /etc/icinga2/pki/:
  144. $etc_icinga2_pki_owner = 'icinga'
  145. $etc_icinga2_pki_group = 'icinga'
  146. $etc_icinga2_pki_mode = '0750'
  147. #Settings for /etc/icinga2/scripts/:
  148. $etc_icinga2_scripts_owner = 'icinga'
  149. $etc_icinga2_scripts_group = 'icinga'
  150. $etc_icinga2_scripts_mode = '0750'
  151. #Settings for /etc/icinga2/zones.d/:
  152. $etc_icinga2_zonesd_owner = 'icinga'
  153. $etc_icinga2_zonesd_group = 'icinga'
  154. $etc_icinga2_zonesd_mode = '0750'
  155. #Settings for /etc/icinga2/objects/:
  156. $etc_icinga2_obejcts_owner = 'icinga'
  157. $etc_icinga2_obejcts_group = 'icinga'
  158. $etc_icinga2_obejcts_mode = '0750'
  159. #Settings for subdirectories of /etc/icinga2/objects/:
  160. $etc_icinga2_obejcts_sub_dir_owner = 'icinga'
  161. $etc_icinga2_obejcts_sub_dir_group = 'icinga'
  162. $etc_icinga2_obejcts_sub_dir_mode = '0750'
  163. }
  164. #Ubuntu and Debian systems:
  165. /(Ubuntu|Debian)/: {
  166. #Settings for /etc/icinga2/:
  167. $etc_icinga2_owner = 'root'
  168. $etc_icinga2_group = 'root'
  169. $etc_icinga2_mode = '0755'
  170. #Settings for /etc/icinga2/icinga2.conf:
  171. $etc_icinga2_icinga2_conf_owner = 'root'
  172. $etc_icinga2_icinga2_conf_group = 'root'
  173. $etc_icinga2_icinga2_conf_mode = '0644'
  174. #Settings for /etc/icinga2/conf.d/
  175. $etc_icinga2_confd_owner = 'root'
  176. $etc_icinga2_confd_group = 'root'
  177. $etc_icinga2_confd_mode = '0755'
  178. #Settings for /etc/icinga2/features-available/:
  179. $etc_icinga2_features_available_owner = 'root'
  180. $etc_icinga2_features_available_group = 'root'
  181. $etc_icinga2_features_available_mode = '0755'
  182. #Settings for /etc/icinga2/features-enabled/:
  183. $etc_icinga2_features_enabled_owner = 'root'
  184. $etc_icinga2_features_enabled_group = 'root'
  185. $etc_icinga2_features_enabled_mode = '0755'
  186. #Settings for /etc/icinga2/pki/:
  187. $etc_icinga2_pki_owner = 'root'
  188. $etc_icinga2_pki_group = 'root'
  189. $etc_icinga2_pki_mode = '0755'
  190. #Settings for /etc/icinga2/scripts/:
  191. $etc_icinga2_scripts_owner = 'root'
  192. $etc_icinga2_scripts_group = 'root'
  193. $etc_icinga2_scripts_mode = '0755'
  194. #Settings for /etc/icinga2/zones.d/:
  195. $etc_icinga2_zonesd_owner = 'root'
  196. $etc_icinga2_zonesd_group = 'root'
  197. $etc_icinga2_zonesd_mode = '0755'
  198. #Settings for /etc/icinga2/objects/:
  199. $etc_icinga2_obejcts_owner = 'root'
  200. $etc_icinga2_obejcts_group = 'root'
  201. $etc_icinga2_obejcts_mode = '0755'
  202. #Settings for subdirectories of /etc/icinga2/objects/:
  203. $etc_icinga2_obejcts_sub_dir_owner = 'root'
  204. $etc_icinga2_obejcts_sub_dir_group = 'root'
  205. $etc_icinga2_obejcts_sub_dir_mode = '0755'
  206. }
  207. #Fail if we're on any other OS:
  208. default: { fail("${::operatingsystem} is not supported!") }
  209. }
  210. ##################
  211. # Icinga 2 server service settings
  212. case $::operatingsystem {
  213. #Icinga 2 server daemon names for Red Had/CentOS systems:
  214. 'CentOS': {
  215. case $::operatingsystemmajrelease {
  216. '6': {
  217. $icinga2_server_service_name = 'icinga2'
  218. }
  219. '7': {
  220. $icinga2_server_service_name = 'icinga2'
  221. }
  222. #Fail if we're on any other CentOS release:
  223. default: { fail("${::operatingsystemmajrelease} is not a supported CentOS release!") }
  224. }
  225. }
  226. #Icinga 2 server daemon names for Ubuntu systems:
  227. 'Ubuntu': {
  228. case $::operatingsystemmajrelease {
  229. '12.04': {
  230. $icinga2_server_service_name = 'icinga2'
  231. }
  232. '14.04': {
  233. $icinga2_server_service_name = 'icinga2'
  234. }
  235. #Fail if we're on any other Ubuntu release:
  236. default: { fail("${::operatingsystemmajrelease} is not a supported Ubuntu release version!") }
  237. }
  238. }
  239. #Icinga 2 server daemon names for Debian systems:
  240. 'Debian': {
  241. case $::operatingsystemmajrelease {
  242. '7': {
  243. $icinga2_server_service_name = 'icinga2'
  244. }
  245. #Fail if we're on any other Debian release:
  246. default: { fail("${::operatingsystemmajrelease} is not a supported Debian release version!") }
  247. }
  248. }
  249. #Fail if we're on any other OS:
  250. default: { fail("${::operatingsystem} is not supported!") }
  251. }
  252. ##############################
  253. # Icinga 2 client parameters
  254. ##############################
  255. ##################
  256. # Icinga 2 client settings
  257. $nrpe_listen_port = '5666'
  258. $nrpe_log_facility = 'daemon'
  259. $nrpe_debug_level = '0'
  260. #in seconds:
  261. $nrpe_command_timeout = '60'
  262. #in seconds:
  263. $nrpe_connection_timeout = '300'
  264. #Note: because we use .join in the nrpe.cfg.erb template, this value *must* be an array
  265. $nrpe_allowed_hosts = ['127.0.0.1',]
  266. #Determines whether or not the NRPE daemon will allow clients to specify arguments to commands that are executed
  267. # *** ENABLING THIS OPTION IS A SECURITY RISK! ***
  268. # Defaults to NOT allow command arguments
  269. $allow_command_argument_processing = '0'
  270. case $::operatingsystem {
  271. #File and template variable names for Red Had/CentOS systems:
  272. 'CentOS': {
  273. $nrpe_config_basedir = '/etc/nagios'
  274. $nrpe_plugin_libdir = '/usr/lib64/nagios/plugins'
  275. $nrpe_pid_file_path = '/var/run/nrpe/nrpe.pid'
  276. $nrpe_user = 'nrpe'
  277. $nrpe_group = 'nrpe'
  278. }
  279. #File and template variable names for Ubuntu systems:
  280. 'Ubuntu': {
  281. $nrpe_config_basedir = '/etc/nagios'
  282. $nrpe_plugin_libdir = '/usr/lib/nagios/plugins'
  283. $nrpe_pid_file_path = '/var/run/nagios/nrpe.pid'
  284. $nrpe_user = 'nagios'
  285. $nrpe_group = 'nagios'
  286. }
  287. #File and template variable names for Ubuntu systems:
  288. 'Debian': {
  289. $nrpe_config_basedir = '/etc/nagios'
  290. $nrpe_plugin_libdir = '/usr/lib/nagios/plugins'
  291. $nrpe_pid_file_path = '/var/run/nagios/nrpe.pid'
  292. $nrpe_user = 'nagios'
  293. $nrpe_group = 'nagios'
  294. }
  295. #Fail if we're on any other OS:
  296. default: { fail("${::operatingsystem} is not supported!") }
  297. }
  298. ##################
  299. # Icinga 2 client package parameters
  300. case $::operatingsystem {
  301. #CentOS systems:
  302. 'CentOS': {
  303. case $::operatingsystemmajrelease {
  304. '6': {
  305. #Pick the right list of client packages:
  306. $icinga2_client_packages = ['nrpe', 'nagios-plugins-nrpe', 'nagios-plugins-all', 'nagios-plugins-openmanage', 'nagios-plugins-check-updates']
  307. }
  308. '7': {
  309. #Pick the right list of client packages:
  310. $icinga2_client_packages = ['nrpe', 'nagios-plugins-nrpe', 'nagios-plugins-all', 'nagios-plugins-openmanage', 'nagios-plugins-check-updates']
  311. }
  312. #Fail if we're on any other CentOS release:
  313. default: { fail("${::operatingsystemmajrelease} is not a supported CentOS release version!") }
  314. }
  315. }
  316. #Ubuntu systems:
  317. 'Ubuntu': {
  318. case $::operatingsystemrelease {
  319. #Ubuntu 12.04 doesn't have nagios-plugins-common or nagios-plugins-contrib packages available...
  320. '12.04': {
  321. $icinga2_client_packages = ['nagios-nrpe-server', 'nagios-plugins', 'nagios-plugins-basic', 'nagios-plugins-standard', 'nagios-snmp-plugins', 'nagios-plugins-extra', 'nagios-nrpe-plugin']
  322. #Specify '--no-install-recommends' so we don't inadvertently get Nagios 3 installed; it comes as a recommended package with most of the plugin packages:
  323. $client_plugin_package_install_options = '--no-install-recommends'
  324. }
  325. #...but 14.04 does:
  326. '14.04': {
  327. $icinga2_client_packages = ['nagios-nrpe-server', 'nagios-plugins', 'nagios-plugins-basic', 'nagios-plugins-common', 'nagios-plugins-standard', 'nagios-snmp-plugins', 'nagios-plugins-extra', 'nagios-plugins-contrib', 'nagios-nrpe-plugin']
  328. #Specify '--no-install-recommends' so we don't inadvertently get Nagios 3 installed; it comes as a recommended package with most of the plugin packages:
  329. $client_plugin_package_install_options = '--no-install-recommends'
  330. }
  331. #Fail if we're on any other Ubuntu release:
  332. default: { fail("${::operatingsystemmajrelease} is not a supported Ubuntu release version!") }
  333. }
  334. }
  335. #Debian systems:
  336. 'Debian': {
  337. case $::operatingsystemmajrelease {
  338. '7': {
  339. $icinga2_client_packages = ['nagios-nrpe-server', 'nagios-plugins', 'nagios-plugins-basic', 'nagios-plugins-standard', 'nagios-snmp-plugins', 'nagios-plugins-contrib', 'nagios-nrpe-plugin']
  340. #Specify '--no-install-recommends' so we don't inadvertently get Nagios 3 installed; it comes as a recommended package with most of the plugin packages:
  341. $client_plugin_package_install_options = '--no-install-recommends'
  342. }
  343. #Fail if we're on any other Debian release:
  344. default: { fail("${::operatingsystemmajrelease} is not a supported Debian release version!") }
  345. }
  346. }
  347. #Fail if we're on any other OS:
  348. default: { fail("${::operatingsystem} is not supported!") }
  349. }
  350. ##################
  351. # Icinga 2 client service parameters
  352. case $::operatingsystem {
  353. #Daemon names for Red Had/CentOS systems:
  354. 'CentOS': {
  355. $nrpe_daemon_name = 'nrpe'
  356. }
  357. #Daemon names for Ubuntu systems:
  358. 'Ubuntu': {
  359. $nrpe_daemon_name = 'nagios-nrpe-server'
  360. }
  361. #Daemon names for Debian systems:
  362. 'Debian': {
  363. $nrpe_daemon_name = 'nagios-nrpe-server'
  364. }
  365. #Fail if we're on any other OS:
  366. default: { fail("${::operatingsystem} is not supported!") }
  367. }
  368. }