params.pp 12 KB

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