params.pp 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  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. #Fail if we're on any other OS:
  28. default: { fail("${::operatingsystem} is not supported!") }
  29. }
  30. ##############################
  31. # Icinga 2 server parameters
  32. ##############################
  33. #Whether to manage the package repositories
  34. $manage_repos = true
  35. $server_db_type = 'pgsql'
  36. #Database paramters
  37. $db_name = 'icinga2_data'
  38. $db_user = 'icinga2'
  39. $db_password = 'password'
  40. $db_host = 'localhost'
  41. $db_port = '5432'
  42. #Whether to install the plugin packages when the icinga2::server class is applied:
  43. $server_install_nagios_plugins = true
  44. ##############################
  45. # Icinga 2 server package parameters
  46. #Pick the right package parameters based on the OS:
  47. case $::operatingsystem {
  48. #CentOS systems:
  49. 'CentOS': {
  50. #Icinga 2 server package
  51. $icinga2_server_package = 'icinga2'
  52. $icinga2_server_plugin_packages = ["nagios-plugins-nrpe", "nagios-plugins-all", "nagios-plugins-openmanage", "nagios-plugins-check-updates"]
  53. }
  54. #Ubuntu systems:
  55. 'Ubuntu': {
  56. case $::operatingsystemrelease {
  57. #Ubuntu 12.04 doesn't have nagios-plugins-common or nagios-plugins-contrib packages available...
  58. '12.04': {
  59. $icinga2_server_package = 'icinga2'
  60. $icinga2_server_plugin_packages = ["nagios-plugins", "nagios-plugins-basic", "nagios-plugins-standard", "nagios-snmp-plugins", "nagios-plugins-extra", "nagios-nrpe-plugin"]
  61. #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:
  62. $server_plugin_package_install_options = '--no-install-recommends'
  63. }
  64. #...but 14.04 does:
  65. '14.04': {
  66. $icinga2_server_package = 'icinga2'
  67. $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"]
  68. #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:
  69. $server_plugin_package_install_options = '--no-install-recommends'
  70. }
  71. }
  72. }
  73. #Fail if we're on any other OS:
  74. default: { fail("${::operatingsystem} is not supported!") }
  75. }
  76. ##############################
  77. # Icinga 2 server config parameters
  78. case $::operatingsystem {
  79. #CentOS systems:
  80. 'CentOS': {
  81. #Settings for /etc/icinga2/:
  82. $etc_icinga2_owner = 'icinga'
  83. $etc_icinga2_group = 'icinga'
  84. $etc_icinga2_mode = '750'
  85. #Settings for /etc/icinga2/icinga2.conf:
  86. $etc_icinga2_icinga2_conf_owner = 'icinga'
  87. $etc_icinga2_icinga2_conf_group = 'icinga'
  88. $etc_icinga2_icinga2_conf_mode = '640'
  89. #Settings for /etc/icinga2/conf.d/
  90. $etc_icinga2_confd_owner = 'icinga'
  91. $etc_icinga2_confd_group = 'icinga'
  92. $etc_icinga2_confd_mode = '750'
  93. #Settings for /etc/icinga2/features-available/:
  94. $etc_icinga2_features_available_owner = 'icinga'
  95. $etc_icinga2_features_available_group = 'icinga'
  96. $etc_icinga2_features_available_mode = '750'
  97. #Settings for /etc/icinga2/features-enabled/:
  98. $etc_icinga2_features_enabled_owner = 'icinga'
  99. $etc_icinga2_features_enabled_group = 'icinga'
  100. $etc_icinga2_features_enabled_mode = '750'
  101. #Settings for /etc/icinga2/pki/:
  102. $etc_icinga2_pki_owner = 'icinga'
  103. $etc_icinga2_pki_group = 'icinga'
  104. $etc_icinga2_pki_mode = '750'
  105. #Settings for /etc/icinga2/scripts/:
  106. $etc_icinga2_scripts_owner = 'icinga'
  107. $etc_icinga2_scripts_group = 'icinga'
  108. $etc_icinga2_scripts_mode = '750'
  109. #Settings for /etc/icinga2/zones.d/:
  110. $etc_icinga2_zonesd_owner = 'icinga'
  111. $etc_icinga2_zonesd_group = 'icinga'
  112. $etc_icinga2_zonesd_mode = '750'
  113. #Settings for /etc/icinga2/objects/:
  114. $etc_icinga2_obejcts_owner = 'icinga'
  115. $etc_icinga2_obejcts_group = 'icinga'
  116. $etc_icinga2_obejcts_mode = '750'
  117. #Settings for subdirectories of /etc/icinga2/objects/:
  118. $etc_icinga2_obejcts_sub_dir_owner = 'icinga'
  119. $etc_icinga2_obejcts_sub_dir_group = 'icinga'
  120. $etc_icinga2_obejcts_sub_dir_mode = '750'
  121. }
  122. #Ubuntu systems:
  123. 'Ubuntu': {
  124. case $::operatingsystemrelease {
  125. #Ubuntu 12.04 Precise Pangolin:
  126. '12.04': {
  127. #Settings for /etc/icinga2/:
  128. $etc_icinga2_owner = 'root'
  129. $etc_icinga2_group = 'root'
  130. $etc_icinga2_mode = '755'
  131. #Settings for /etc/icinga2/icinga2.conf:
  132. $etc_icinga2_icinga2_conf_owner = 'root'
  133. $etc_icinga2_icinga2_conf_group = 'root'
  134. $etc_icinga2_icinga2_conf_mode = '644'
  135. #Settings for /etc/icinga2/conf.d/
  136. $etc_icinga2_confd_owner = 'root'
  137. $etc_icinga2_confd_group = 'root'
  138. $etc_icinga2_confd_mode = '755'
  139. #Settings for /etc/icinga2/features-available/:
  140. $etc_icinga2_features_available_owner = 'root'
  141. $etc_icinga2_features_available_group = 'root'
  142. $etc_icinga2_features_available_mode = '755'
  143. #Settings for /etc/icinga2/features-enabled/:
  144. $etc_icinga2_features_enabled_owner = 'root'
  145. $etc_icinga2_features_enabled_group = 'root'
  146. $etc_icinga2_features_enabled_mode = '755'
  147. #Settings for /etc/icinga2/pki/:
  148. $etc_icinga2_pki_owner = 'root'
  149. $etc_icinga2_pki_group = 'root'
  150. $etc_icinga2_pki_mode = '755'
  151. #Settings for /etc/icinga2/scripts/:
  152. $etc_icinga2_scripts_owner = 'root'
  153. $etc_icinga2_scripts_group = 'root'
  154. $etc_icinga2_scripts_mode = '755'
  155. #Settings for /etc/icinga2/zones.d/:
  156. $etc_icinga2_zonesd_owner = 'root'
  157. $etc_icinga2_zonesd_group = 'root'
  158. $etc_icinga2_zonesd_mode = '755'
  159. #Settings for /etc/icinga2/objects/:
  160. $etc_icinga2_obejcts_owner = 'root'
  161. $etc_icinga2_obejcts_group = 'root'
  162. $etc_icinga2_obejcts_mode = '755'
  163. #Settings for subdirectories of /etc/icinga2/objects/:
  164. $etc_icinga2_obejcts_sub_dir_owner = 'root'
  165. $etc_icinga2_obejcts_sub_dir_group = 'root'
  166. $etc_icinga2_obejcts_sub_dir_mode = '755'
  167. }
  168. #Ubuntu 14.04 Trusty Tahr:
  169. '14.04': {
  170. #Settings for /etc/icinga2/:
  171. $etc_icinga2_owner = 'root'
  172. $etc_icinga2_group = 'root'
  173. $etc_icinga2_mode = '755'
  174. #Settings for /etc/icinga2/icinga2.conf:
  175. $etc_icinga2_icinga2_conf_owner = 'root'
  176. $etc_icinga2_icinga2_conf_group = 'root'
  177. $etc_icinga2_icinga2_conf_mode = '644'
  178. #Settings for /etc/icinga2/conf.d/
  179. $etc_icinga2_confd_owner = 'root'
  180. $etc_icinga2_confd_group = 'root'
  181. $etc_icinga2_confd_mode = '755'
  182. #Settings for /etc/icinga2/features-available:
  183. $etc_icinga2_features_available_owner = 'root'
  184. $etc_icinga2_features_available_group = 'root'
  185. $etc_icinga2_features_available_mode = '755'
  186. #Settings for /etc/icinga2/features-enabled:
  187. $etc_icinga2_features_enabled_owner = 'root'
  188. $etc_icinga2_features_enabled_group = 'root'
  189. $etc_icinga2_features_enabled_mode = '755'
  190. #Settings for /etc/icinga2/pki/:
  191. $etc_icinga2_pki_owner = 'root'
  192. $etc_icinga2_pki_group = 'root'
  193. $etc_icinga2_pki_mode = '755'
  194. #Settings for /etc/icinga2/scripts/:
  195. $etc_icinga2_scripts_owner = 'root'
  196. $etc_icinga2_scripts_group = 'root'
  197. $etc_icinga2_scripts_mode = '755'
  198. #Settings for /etc/icinga2/zones.d/:
  199. $etc_icinga2_zonesd_owner = 'root'
  200. $etc_icinga2_zonesd_group = 'root'
  201. $etc_icinga2_zonesd_mode = '755'
  202. #Settings for /etc/icinga2/objects/:
  203. $etc_icinga2_obejcts_owner = 'root'
  204. $etc_icinga2_obejcts_group = 'root'
  205. $etc_icinga2_obejcts_mode = '755'
  206. #Settings for subdirectories of /etc/icinga2/objects/:
  207. $etc_icinga2_obejcts_sub_dir_owner = 'root'
  208. $etc_icinga2_obejcts_sub_dir_group = 'root'
  209. $etc_icinga2_obejcts_sub_dir_mode = '755'
  210. }
  211. }
  212. }
  213. #Fail if we're on any other OS:
  214. default: { fail("${::operatingsystem} is not supported!") }
  215. }
  216. ##################
  217. # Icinga 2 server service settings
  218. case $::operatingsystem {
  219. #Icinga 2 server daemon names for Red Had/CentOS systems:
  220. 'CentOS': {
  221. $icinga2_server_service_name = 'icinga2'
  222. }
  223. #Icinga 2 server daemon names for Ubuntu systems:
  224. 'Ubuntu': {
  225. $icinga2_server_service_name = 'icinga2'
  226. }
  227. #Fail if we're on any other OS:
  228. default: { fail("${::operatingsystem} is not supported!") }
  229. }
  230. ##############################
  231. # Icinga 2 client parameters
  232. ##############################
  233. ##################
  234. # Icinga 2 client settings
  235. $nrpe_listen_port = '5666'
  236. $nrpe_log_facility = 'daemon'
  237. $nrpe_debug_level = '0'
  238. #in seconds:
  239. $nrpe_command_timeout = '60'
  240. #in seconds:
  241. $nrpe_connection_timeout = '300'
  242. #Note: because we use .join in the nrpe.cfg.erb template, this value *must* be an array
  243. $nrpe_allowed_hosts = ['127.0.0.1',]
  244. case $::operatingsystem {
  245. #File and template variable names for Red Had/CentOS systems:
  246. 'CentOS': {
  247. $nrpe_config_basedir = "/etc/nagios"
  248. $nrpe_plugin_libdir = "/usr/lib64/nagios/plugins"
  249. $nrpe_pid_file_path = "/var/run/nrpe/nrpe.pid"
  250. $nrpe_user = "nrpe"
  251. $nrpe_group = "nrpe"
  252. }
  253. #File and template variable names for Ubuntu systems:
  254. 'Ubuntu': {
  255. $nrpe_config_basedir = "/etc/nagios"
  256. $nrpe_plugin_libdir = "/usr/lib/nagios/plugins"
  257. $nrpe_pid_file_path = "/var/run/nagios/nrpe.pid"
  258. $nrpe_user = "nagios"
  259. $nrpe_group = "nagios"
  260. }
  261. #Fail if we're on any other OS:
  262. default: { fail("${::operatingsystem} is not supported!") }
  263. }
  264. ##################
  265. # Icinga 2 client package parameters
  266. case $::operatingsystem {
  267. #CentOS systems:
  268. 'CentOS': {
  269. #Pick the right list of client packages:
  270. $icinga2_client_packages = ["nrpe", "nagios-plugins-nrpe", "nagios-plugins-all", "nagios-plugins-openmanage", "nagios-plugins-check-updates"]
  271. }
  272. #Ubuntu systems:
  273. 'Ubuntu': {
  274. case $::operatingsystemrelease {
  275. #Ubuntu 12.04 doesn't have nagios-plugins-common or nagios-plugins-contrib packages available...
  276. '12.04': {
  277. $icinga2_client_packages = ["nagios-nrpe-server", "nagios-plugins", "nagios-plugins-basic", "nagios-plugins-standard", "nagios-snmp-plugins", "nagios-plugins-extra", "nagios-nrpe-plugin"]
  278. #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:
  279. $client_plugin_package_install_options = '--no-install-recommends'
  280. }
  281. #...but 14.04 does:
  282. '14.04': {
  283. $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"]
  284. #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:
  285. $client_plugin_package_install_options = '--no-install-recommends'
  286. }
  287. }
  288. }
  289. #Fail if we're on any other OS:
  290. default: { fail("${::operatingsystem} is not supported!") }
  291. }
  292. ##################
  293. # Icinga 2 client service parameters
  294. case $::operatingsystem {
  295. #Daemon names for Red Had/CentOS systems:
  296. 'CentOS': {
  297. $nrpe_daemon_name = 'nrpe'
  298. }
  299. #Daemon names for Ubuntu systems:
  300. 'Ubuntu': {
  301. $nrpe_daemon_name = 'nagios-nrpe-server'
  302. }
  303. #Fail if we're on any other OS:
  304. default: { fail("${::operatingsystem} is not supported!") }
  305. }
  306. }