Advertisement
bewleberkl

Nagios Core 4.4.6 install/deploy CentOS8 HowTo

Mar 28th, 2021 (edited)
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.58 KB | None | 0 0
  1. Ansible/Nagios Core 4.4.6 (and Nagios NRPE agent) install/configure/deploy on CentOS8
  2.  
  3. Purpose: Howto that combined howto steps from lots of other sources.
  4.  
  5. Enviro:
  6. - NB master server: nb801d2c4u.lab.krt / 192.168.1.28, on RHEL7.x ...will be our Ansible server and Nagios monitoring server.
  7. - NB media server: nb801d2cmed / 192.168.1.26, on RHEL7.x; will be a remote server to-be-monitored
  8. - NB clients: nbclient1 / 192.168.1.33, on RHEL7.x; nbclient2 / 192.168.1.36, on Debian; will be a remote server to-be-monitored
  9.  
  10.  
  11. Apps:
  12. - Ansible. The config stuff is all in /etc/ansible after install.
  13. - Nagios:
  14. - /etc/nagios or /usr/local/nagios/etc is config stuff for RHEL
  15. - /usr/lib64/nagios or /usr/local/nagios is where all the executables and plugins live.
  16.  
  17.  
  18.  
  19. On the server that will run 'Nagios server' (from which we will monitor remote servers):
  20.  
  21. 1. Install Ansible:
  22. yum --nogpgcheck install ansible
  23.  
  24. 2. Configure passwordless SSH to remote hosts to be monitored (execute these on monitoring svr):
  25. a. generate a keygen:
  26. # ssh-keygen
  27.  
  28. b. copy the id_rsa.pub to each remote system:
  29. # ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.1.26
  30. -or-
  31. # cat id_rsa.pub | ssh root@192.168.1.26 'cat >> .ssh/authorized_keys'
  32.  
  33. c. To ensure the 'ansible -ping' command works later, ssh connect to each remote host by ip and by hostname (both) and answer yes to
  34. the "Are you sure you want to continue connecting (yes/no/[fingerprint])?" question, ex.
  35.  
  36. [root@tenbears ~]# ssh root@tbmaster
  37. The authenticity of host 'tbmaster (192.168.1.170)' can't be established.
  38. ECDSA key fingerprint is SHA256:pkHBjR4U8pHzRR3ksi063+hbweYw1xeYcAK7NPXcO1A.
  39. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
  40. Warning: Permanently added 'tbmaster' (ECDSA) to the list of known hosts.
  41. Activate the web console with: systemctl enable --now cockpit.socket
  42.  
  43. Last login: Sat Mar 27 08:40:23 2021 from 192.168.1.122
  44.  
  45.  
  46. 3. Configure SELINUX in 'permissive' mode:
  47.  
  48. [root@tenbears ~]# cat /etc/selinux/config
  49.  
  50. # This file controls the state of SELinux on the system.
  51. # SELINUX= can take one of these three values:
  52. # enforcing - SELinux security policy is enforced.
  53. # permissive - SELinux prints warnings instead of enforcing.
  54. # disabled - No SELinux policy is loaded.
  55. SELINUX=enforcing
  56. # SELINUXTYPE= can take one of these three values:
  57. # targeted - Targeted processes are protected,
  58. # minimum - Modification of targeted policy. Only selected processes are protected.
  59. # mls - Multi Level Security protection.
  60. SELINUXTYPE=targeted
  61.  
  62.  
  63. [root@tenbears ~]# sed -i 's/SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config
  64.  
  65. [root@tenbears ~]# cat /etc/selinux/config
  66.  
  67. # This file controls the state of SELinux on the system.
  68. # SELINUX=permissive
  69. # enforcing - SELinux security policy is enforced.
  70. # permissive - SELinux prints warnings instead of enforcing.
  71. # disabled - No SELinux policy is loaded.
  72. SELINUX=permissive
  73. # SELINUXTYPE= can take one of these three values:
  74. # targeted - Targeted processes are protected,
  75. # minimum - Modification of targeted policy. Only selected processes are protected.
  76. # mls - Multi Level Security protection.
  77. SELINUXTYPE=targeted
  78.  
  79.  
  80. [root@tenbears ~]# setenforce 0
  81.  
  82. [root@tenbears ~]# getenforce
  83. Permissive
  84.  
  85.  
  86.  
  87.  
  88.  
  89. 4. Install Nagios Core on CentOS8:
  90. Credit to computingforgeeks.com for the install steps:
  91. https://computingforgeeks.com/install-and-configure-nagios-4-on-rhel-centos-8/
  92. ...here are the commands used on the CentOS8 system to be the Nagios monitoring server:
  93.  
  94. - update the system first:
  95. dnf update
  96.  
  97. - install some dependencies/prereqs:
  98. dnf install @php
  99.  
  100. dnf install @perl @httpd wget unzip glibc automake glibc-common gettext autoconf php php-cli gcc gd gd-devel net-snmp openssl-devel unzip net-snmp postfix net-snmp-utils
  101.  
  102. dnf groupinstall "Development Tools"
  103.  
  104. - enable httpd and php-fpm to start at boot:
  105. systemctl enable --now httpd php-fpm
  106.  
  107. - status httpd and php-fpm:
  108. systemctl status httpd php-fpm
  109.  
  110. - set enviro variable to the latest Nagios version (at this writing 3/27/2021):
  111. export VER="4.4.6"
  112.  
  113. - download Nagios Core:
  114. curl -SL https://github.com/NagiosEnterprises/nagioscore/releases/download/nagios-$VER/nagios-$VER.tar.gz | tar -xzf -
  115.  
  116. - configure and install:
  117. cd nagios-$VER
  118.  
  119. ./configure
  120.  
  121. make all
  122.  
  123. make install-groups-users
  124.  
  125. usermod -a -G nagios apache
  126.  
  127. make install
  128.  
  129. make install-daemoninit
  130.  
  131. make install-commandmode
  132.  
  133. make install-config
  134.  
  135. make install-webconf
  136.  
  137. make install-exfoliation
  138.  
  139. make install-classicui
  140.  
  141. - config Nagios UI user 'nagiosadmin' for web UI access:
  142. htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
  143.  
  144. systemctl restart httpd
  145.  
  146.  
  147.  
  148. 5. install Nagios plugins:
  149. cd ~
  150.  
  151. VER="2.3.3"
  152.  
  153. curl -SL https://github.com/nagios-plugins/nagios-plugins/releases/download/release-$VER/nagios-plugins-$VER.tar.gz | tar -xzf -
  154.  
  155. cd nagios-plugins-$VER
  156.  
  157. ./configure --with-nagios-user=nagios --with-nagios-group=nagios
  158.  
  159. make
  160.  
  161. make install
  162.  
  163. /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
  164.  
  165. systemctl enable --now nagios
  166.  
  167. systemctl status nagios
  168.  
  169.  
  170. 6. Nagios server install complete! Test login: http://<nagios_server_ip_address_here>/nagios/
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177. At this point our Nagios server is only monitoring itself. Next we'll use Ansible to push install Nagios Remote Plugin Executor (NRPE) and the nrpe.cfg config file to the remote Nagios clients to be monitored.
  178.  
  179.  
  180. 1. On the Ansible/Nagios server, populate a Ansible 'hosts' file with a list of remote hosts. In this example nb801d2c4u.lab.krt is our local Nagios server and two RHEL7 hosts in a group called 'nbrhelhosts' and then a Debian sytem in 'nbdebianhosts' group:
  181.  
  182. -
  183. /etc/ansible/hosts contents:
  184.  
  185. all:
  186. hosts:
  187. nb801d2c4u.lab.krt:
  188. children:
  189. nbrhelsvrs:
  190. hosts:
  191. nb801d2cmed.lab.krt:
  192. nb811d2cmed.lab.krt:
  193. nb812d2cmed.lab.krt:
  194. nb812ad2cmed.lab.krt:
  195. nb812bd2cmed.lab.krt:
  196. nb812cd2cmed.lab.krt:
  197. nbrhelclnts:
  198. hosts:
  199. nbclient1.lab.krt:
  200. nbdebianhosts:
  201. hosts:
  202. nbclient2.lab.krt:
  203.  
  204. Note: add more clients to your own 'hosts' configuration as needed.
  205.  
  206.  
  207.  
  208.  
  209. 2. Test Ansible 'hosts' file and functionality/connectivity:
  210. # ansible all -m ping
  211.  
  212. # ansible nbrhelsvrs -m ping
  213.  
  214.  
  215.  
  216.  
  217. Install/deploy the NRPE (Nagios Remote Plugin Executor) agent for client side monitoring.
  218.  
  219. 3. Next we create a Ansible playbook YAML file named nrpe-deploy.yaml to install NRPE, install Nagios plugins, and configure NRPE.
  220. But we'll 'accidentally' forget the nrpe.cfg configuration file to demonstrate that we can update the same YAML playbook file later and
  221. re-execute it from the Ansible server and Ansible will re-execute the steps that are 'new' (as well as the original steps that may have
  222. failed on certain remote hosts previously):
  223.  
  224. NOTE: With later versions of Nagios, the way to deploy the Linux NRPE Agent is per (until this changes again, this is what we'll follow):
  225. https://assets.nagios.com/downloads/nagiosxi/docs/Installing_The_XI_Linux_Agent.pdf
  226.  
  227. So we'll create a nrpe-deploy.yaml w/following contents:
  228.  
  229. ---
  230. - hosts: nbrhel8svrs
  231. remote_user: root
  232. #vars:
  233. #backup_server: <server>
  234.  
  235. tasks:
  236. - name: Download nrpe client
  237. command: chdir=/tmp wget https://assets.nagios.com/downloads/nagiosxi/agents/linux-nrpe-agent.tar.gz
  238. args:
  239. warn: false
  240.  
  241. - name: Extract tarball
  242. command: chdir=/tmp tar -xzf linux-nrpe-agent.tar.gz
  243. args:
  244. warn: false
  245.  
  246. - name: Install
  247. command: chdir=/tmp/linux-nrpe-agent ./fullinstall -n -i 192.168.1.122
  248.  
  249.  
  250. ....example execution:
  251.  
  252. [root@tenbears ~]# ansible-playbook nrpe-deploy.yaml
  253.  
  254. PLAY [nbrhel7svrs] ********************************************************************************************************************
  255.  
  256. TASK [Gathering Facts] ****************************************************************************************************************
  257. ok: [nb82mstrprod]
  258.  
  259. TASK [Download nrpe client] ***********************************************************************************************************
  260. changed: [nb82mstrprod]
  261.  
  262. TASK [Extract tarball] ****************************************************************************************************************
  263. changed: [nb82mstrprod]
  264.  
  265. TASK [Install] ************************************************************************************************************************
  266. changed: [nb82mstrprod]
  267.  
  268. PLAY RECAP ****************************************************************************************************************************
  269. nb82mstrprod : ok=4 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
  270.  
  271.  
  272.  
  273.  
  274. ---- ----- ----- ----- -----
  275.  
  276.  
  277.  
  278.  
  279. Quick facts to get started w/post Nagios install configuration:
  280.  
  281. - Nagios server /usr/local/nagios/etc/objects/commands.cfg must have this appended to monitor remote NRPE servers:
  282.  
  283. # .check_nrpe. command definition
  284. define command{
  285. command_name check_nrpe
  286. command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$
  287. }
  288.  
  289. ....and I copied the check_nrpe binary from a remote NRPE agent host to the Nagios server to /usr/local/nagios/libexec/ and
  290. ensure the binary has proper ownership (chown nagios.nagios /usr/local/nagios/libexec/check_nrpe)
  291. ...(I suspect I could have just installed the NRPE agent on the Nagios server but this simple trick worked)
  292.  
  293. - Nagios server /usr/local/nagios/etc/servers/<hostname>.cfg (one per remote server) defines the host and services to monitor via
  294. commands executed. Command names must match the command names in the remote NRPE server to be monitored nrpe.cfg file command names.
  295.  
  296. - NRPE remote server (to be monitored) /usr/local/nagios/etc/nrpe.cfg has the commands at bottom uncommented. The command names must
  297. match the Nagios server <hostname>.cfg command names.
  298.  
  299. - To group the servers, in the Nagios server /usr/local/nagios/etc/nagios.cfg add/uncomment cfg_file=/usr/local/nagios/etc/objects/hostgroups.cfg line
  300. and create a /usr/local/nagios/etc/objects/hostgroups.cfg file w/content inside for example:
  301.  
  302. define hostgroup {
  303. hostgroup_name web_servers
  304. alias Web Servers
  305. }
  306.  
  307. ...then in each of the Nagios server /usr/local/nagios/etc/servers/<hostname>.cfg files for the web servers, within the 'define host {' section add:
  308.  
  309. hostgroups web_servers
  310.  
  311.  
  312. - After changes to any config files on the Nagios server, always:
  313. - test configuration via: /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
  314. - reload Nagios via: systemctl reload nagios
  315.  
  316. - On remote NRPE to-be-monitored hosts, the /etc/xinetd.d/nrpe is what contains the 'only_from' pointing to the Nagios server IP.
  317.  
  318.  
  319.  
  320.  
  321. Deploy updated nrpe.cfg to the remote NRPE agent hosts with Ansible:
  322.  
  323. Now on the Ansible server, we will create a nrpe.cfg file for the remote Nagios clients, update the Ansible server-side nrpe-deploy.yaml file
  324. and deploy (or re-deploy if changes are needed):
  325.  
  326. 1. first create the file nrpe.cfg on the ansible server with contents:
  327.  
  328. -------->start nrpe.cfg file contents<----------
  329. # bind to all interfaces
  330. server_address=0.0.0.0
  331.  
  332. # allow access by localhost (only need to add the Nagios server if not using xinetd):
  333. allowed_hosts=127.0.0.1
  334.  
  335. # allow command args
  336. dont_blame_nrpe=1
  337.  
  338. # example monitor commands
  339. command[check_users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10
  340. command[check_load]=/usr/lib64/nagios/plugins/check_load -r -w .15,.10,.05 -c .30,.25,.20
  341. #command[check_hda1]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1
  342. command[check_root]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /dev/mapper/rhel-root
  343. command[check_nbvol]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /dev/nbu/nbvol
  344. command[check_advdsk]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /dev/mapper/nbu-advdsk
  345. command[check_msdp]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /dev/mapper/nbu-msdpcache
  346. command[check_zombie_procs]=/usr/lib64/nagios/plugins/check_procs -w 5 -c 10 -s Z
  347. command[check_total_procs]=/usr/lib64/nagios/plugins/check_procs -w 150 -c 200
  348.  
  349. -------->end nrpe.cfg file contents<----------
  350.  
  351.  
  352. 2. Next, append following lines to the nrpe-deploy.yaml file:
  353.  
  354. - name: deploy nrpe.cfg
  355. copy:
  356. src: nrpe.cfg
  357. dest: /usr/local/nagios/etc/nrpe.cfg
  358. force: yes
  359. backup: yes
  360. register: deploy_nrpe
  361.  
  362.  
  363.  
  364. 3. From the Ansible server, redeploy (and whats cool is before running this I fixed a broken yum installer on nb812cd2cmed.lab.krt so this
  365. re-execution successfully completed the NRPE and Nagios plugin installs on nb812cd2cmed.lab.krt, then deployed the nrpe.cfg file):
  366.  
  367. [root@nb801d2c4u ansible]# ansible-playbook nrpe-deploy.yaml
  368.  
  369. PLAY [nbrhelhosts] *******************************************************************************************************
  370.  
  371. TASK [Gathering Facts] ***************************************************************************************************
  372. ok: [nbclient1.lab.krt]
  373. ok: [nb812bd2cmed.lab.krt]
  374. ok: [nb812ad2cmed.lab.krt]
  375. ok: [nb811d2cmed.lab.krt]
  376. ok: [nb801d2cmed.lab.krt]
  377.  
  378. TASK [install epel] ******************************************************************************************************
  379. ok: [nb801d2cmed.lab.krt]
  380. ok: [nb812bd2cmed.lab.krt]
  381. ok: [nb812ad2cmed.lab.krt]
  382. ok: [nb811d2cmed.lab.krt]
  383. changed: [nb812cd2cmed.lab.krt]
  384.  
  385. TASK [install nrpe] ******************************************************************************************************
  386. ok: [nb801d2cmed.lab.krt]
  387. ok: [nb812bd2cmed.lab.krt]
  388. ok: [nb812ad2cmed.lab.krt]
  389. ok: [nb811d2cmed.lab.krt]
  390. changed: [nb812cd2cmed.lab.krt]
  391.  
  392. TASK [install nagios plugins] ********************************************************************************************
  393. ok: [nb801d2cmed.lab.krt]
  394. ok: [nb812bd2cmed.lab.krt]
  395. ok: [nb812ad2cmed.lab.krt]
  396. ok: [nb811d2cmed.lab.krt]
  397. changed: [nb812cd2cmed.lab.krt]
  398.  
  399. TASK [deploy nrpe.cfg] ***************************************************************************************************
  400. changed: [nb812cd2cmed.lab.krt]
  401. changed: [nb812bd2cmed.lab.krt]
  402. changed: [nb812ad2cmed.lab.krt]
  403. changed: [nb811d2cmed.lab.krt]
  404. changed: [nb801d2cmed.lab.krt]
  405. changed: [nb801d2cmed.lab.krt]
  406.  
  407. TASK [start/restart and enable nrpe] *************************************************************************************
  408. changed: [nb812cd2cmed.lab.krt]
  409. changed: [nb812bd2cmed.lab.krt]
  410. changed: [nb812ad2cmed.lab.krt]
  411. changed: [nb811d2cmed.lab.krt]
  412. changed: [nb801d2cmed.lab.krt]
  413. changed: [nb801d2cmed.lab.krt]
  414.  
  415. PLAY RECAP ***************************************************************************************************************
  416. nb801d2cmed.lab.krt : ok=6 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
  417. nb801d2cmed.lab.krt : ok=6 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
  418. nb801d2cmed.lab.krt : ok=6 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
  419. nb811d2cmed.lab.krt : ok=6 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
  420. nb812ad2cmed.lab.krt : ok=6 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
  421. nb812cd2cmed.lab.krt : ok=6 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
  422. nb812cd2cmed.lab.krt : ok=6 changed=5 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
  423.  
  424. [root@nb801d2c4u ansible]#
  425.  
  426.  
  427.  
  428. 4. On the Nagios Server, append following to bottom of /etc/nagios/objects/commands.cfg:
  429.  
  430. # .check_nrpe. command definition
  431. define command{
  432. command_name check_nrpe
  433. command_line /usr/lib64/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$
  434. }
  435.  
  436.  
  437. 5. On the Nagios Server, create <hostname>.cfg files inside /usr/local/nagios/etc/servers/ for each host to be monitored. In this example
  438. we created one for one of the remote NB media servers:
  439.  
  440. # vi nb801d2cmed.cfg
  441. .....add following content:
  442.  
  443. ###############################################################################
  444. #
  445. # HOST DEFINITION
  446. #
  447. ###############################################################################
  448.  
  449. # Define a host for the local machine
  450.  
  451. define host {
  452.  
  453. use linux-server ; Name of host template to use
  454. ; This host definition will inherit all variables that are defined
  455. ; in (or inherited by) the linux-server host template definition.
  456. hostgroups NB_servers
  457. host_name nb801d2cmed
  458. alias nb801d2cmed
  459. address 192.168.1.26
  460. register 1
  461. }
  462.  
  463.  
  464.  
  465. ###############################################################################
  466. #
  467. # SERVICE DEFINITIONS
  468. #
  469. ###############################################################################
  470.  
  471. # Define a service to "ping"
  472.  
  473. define service {
  474.  
  475. use generic-service ; Name of service template to use
  476. host_name nb801d2cmed
  477. service_description PING
  478. check_command check_ping!100.0,20%!500.0,60%
  479. }
  480.  
  481.  
  482.  
  483. # Define a service to check the disk space of the root partition
  484. # on the local machine. Warning if < 20% free, critical if
  485. # < 10% free space on partition.
  486.  
  487. define service {
  488.  
  489. use generic-service ; Name of service template to use
  490. host_name nb801d2cmed
  491. service_description Root Partition
  492. check_command check_nrpe!check_root
  493. }
  494.  
  495. define service {
  496.  
  497. use generic-service ; Name of service template to use
  498. host_name nb801d2cmed
  499. service_description NB Partition
  500. check_command check_nrpe!check_nbvol
  501. }
  502.  
  503. define service {
  504.  
  505. use generic-service ; Name of service template to use
  506. host_name nb801d2cmed
  507. service_description Advanced Disk Partition
  508. check_command check_nrpe!check_advdsk
  509. }
  510.  
  511. define service {
  512.  
  513. use generic-service ; Name of service template to use
  514. host_name nb801d2cmed
  515. service_description MSDP
  516. check_command check_nrpe!check_msdp
  517. }
  518.  
  519.  
  520.  
  521.  
  522. # Define a service to check the number of currently logged in
  523. # users on the local machine. Warning if > 20 users, critical
  524. # if > 50 users.
  525.  
  526. define service {
  527.  
  528. use generic-service ; Name of service template to use
  529. host_name nb801d2cmed
  530. service_description Current Users
  531. check_command check_local_users!20!50
  532. }
  533.  
  534.  
  535.  
  536. # Define a service to check the number of currently running procs
  537. # on the local machine. Warning if > 250 processes, critical if
  538. # > 400 processes.
  539.  
  540. define service {
  541.  
  542. use generic-service ; Name of service template to use
  543. host_name nb801d2cmed
  544. service_description Total Processes
  545. check_command check_local_procs!250!400!RSZDT
  546. }
  547.  
  548.  
  549.  
  550. # Define a service to check the load on the local machine.
  551.  
  552. define service {
  553.  
  554. use generic-service ; Name of service template to use
  555. host_name nb801d2cmed
  556. service_description Current Load
  557. check_command check_local_load!5.0,4.0,3.0!10.0,6.0,4.0
  558. }
  559.  
  560.  
  561.  
  562. # Define a service to check the swap usage the local machine.
  563. # Critical if less than 10% of swap is free, warning if less than 20% is free
  564.  
  565. define service {
  566.  
  567. use generic-service ; Name of service template to use
  568. host_name nb801d2cmed
  569. service_description Swap Usage
  570. check_command check_local_swap!20%!10%
  571. }
  572.  
  573.  
  574.  
  575. # Define a service to check SSH on the local machine.
  576. # Disable notifications for this service by default, as not all users may have SSH enabled.
  577.  
  578. define service {
  579.  
  580. use generic-service ; Name of service template to use
  581. host_name nb801d2cmed
  582. service_description SSH
  583. check_command check_ssh
  584. notifications_enabled 0
  585. }
  586.  
  587.  
  588. .....save the /etc/nagios/servers/nb801d2cmed.cfg file and the others you create.
  589.  
  590.  
  591. 6. (Required only if we didn't use Ansible to push out a custom nrpe.cfg file to the NRPE agent) On the remote NRPE agent append following
  592. commands to the /usr/local/nagios/etc/nrpe.cfg:
  593.  
  594. command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
  595. command[check_load]=/usr/local/nagios/libexec/check_load -r -w .15,.10,.05 -c .30,.25,.20
  596. command[check_root]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/mapper/cl-root
  597. command[check_nbvol]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/mapper/nbuvg-nbvol
  598. command[check_advdsk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/mapper/nbuvg-advdskvol
  599. command[check_cc_cache]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/mapper/nbuvg-d2cvol
  600. command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
  601. command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200
  602.  
  603.  
  604. 7. confirm Nagios config:
  605.  
  606. # /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
  607.  
  608. Nagios Core 4.4.6
  609. Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
  610. Copyright (c) 1999-2009 Ethan Galstad
  611. Last Modified: 2020-04-28
  612. License: GPL
  613.  
  614. Website: https://www.nagios.org
  615. Reading configuration data...
  616. Read main config file okay...
  617. Read object config files okay...
  618.  
  619. Running pre-flight check on configuration data...
  620.  
  621. Checking objects...
  622. Checked 8 services.
  623. Checked 1 hosts.
  624. Checked 1 host groups.
  625. Checked 0 service groups.
  626. Checked 1 contacts.
  627. Checked 1 contact groups.
  628. Checked 24 commands.
  629. Checked 5 time periods.
  630. Checked 0 host escalations.
  631. Checked 0 service escalations.
  632. Checking for circular paths...
  633. Checked 1 hosts
  634. Checked 0 service dependencies
  635. Checked 0 host dependencies
  636. Checked 5 timeperiods
  637. Checking global event handlers...
  638. Checking obsessive compulsive processor commands...
  639. Checking misc settings...
  640.  
  641. Total Warnings: 0
  642. Total Errors: 0
  643.  
  644. Things look okay - No serious problems were detected during the pre-flight check
  645. [root@nb801d2c4u ~]#
  646.  
  647.  
  648.  
  649.  
  650.  
  651. Optional but recommended...re-configure SELINUX in 'Enforcing' mode:
  652. # sed -i 's/SELINUX=.*/SELINUX=enforcing/g' /etc/selinux/config
  653. # setenforce 1
  654.  
  655.  
  656.  
  657. References:
  658.  
  659. Install and Configure Nagios 4 on RHEL 8 / CentOS 8 | ComputingForGeeks
  660. https://computingforgeeks.com/install-and-configure-nagios-4-on-rhel-centos-8/
  661.  
  662. Creating a new hostgroup - Nagios Core Administration Cookbook - Second Edition
  663. https://subscription.packtpub.com/book/networking_and_servers/9781785889332/1/ch01lvl1sec14/creating-a-new-hostgroup
  664.  
  665. Nagios XI - Installing The Linux Agent - Installing_The_XI_Linux_Agent.pdf
  666. https://assets.nagios.com/downloads/nagiosxi/docs/Installing_The_XI_Linux_Agent.pdf
  667.  
  668. How to install the NRPE agent/daemon on CentOS 8 – Support - ITRS Group
  669. https://support.itrsgroup.com/hc/en-us/articles/360007433518-How-to-install-the-NRPE-agent-daemon-on-CentOS-8
  670.  
  671. Time-Saving Tricks For Object Definitions
  672. https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/objecttricks.html
  673.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement