params.pp 12 KB

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