Page 1 of 1
nagios plugins to check service httpd status
Posted: Thu Nov 01, 2018 1:23 pm
by kaushalshriyan
Hi,
I have checked on
https://exchange.nagios.org regarding monitoring of /etc/init.d/httpd status and could not find any specific plugin to monitor it. For example if status returns failed or not ok nagios should trigger alert.
Code: Select all
service httpd status
Redirecting to /bin/systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2018-10-21 02:32:54 UTC; 1 weeks 4 days ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 17453 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
Process: 2831 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful (code=exited, status=0/SUCCESS)
Main PID: 17462 (httpd)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
CGroup: /system.slice/httpd.service
├─ 2873 perl -x /usr/share/thruk/thruk_auth
├─ 2874 /usr/sbin/httpd -DFOREGROUND
├─ 2876 /usr/sbin/httpd -DFOREGROUND
├─ 2878 /usr/sbin/httpd -DFOREGROUND
├─12029 /usr/bin/perl /usr/share/thruk/script/thruk_fastcgi.pl
├─12042 /usr/sbin/httpd -DFOREGROUND
├─12047 /usr/sbin/httpd -DFOREGROUND
├─12069 /usr/sbin/httpd -DFOREGROUND
├─12079 /usr/sbin/httpd -DFOREGROUND
├─12082 /usr/bin/perl /usr/share/thruk/script/thruk_fastcgi.pl
├─15833 /usr/sbin/httpd -DFOREGROUND
├─16350 /usr/sbin/httpd -DFOREGROUND
├─16367 /usr/sbin/httpd -DFOREGROUND
├─16398 /usr/sbin/httpd -DFOREGROUND
└─17462 /usr/sbin/httpd -DFOREGROUND
Any help will be highly appreciable.
Best Regards,
Kaushal
Re: nagios plugins to check service httpd status
Posted: Thu Nov 01, 2018 3:09 pm
by benjaminsmith
Hi
@Kaushal
You can use NRPE to monitor services and processes like httpd. Follow the instructions below for installing NRPE on your sever.
https://assets.nagios.com/downloads/nag ... _Agent.pdf and use check_init_service to determine if httpd is running or not.
Service Checks in Nagios
https://support.nagios.com/kb/article/s ... s-775.html
Please let me know if you are able to get it setup.
Re: nagios plugins to check service httpd status
Posted: Thu Nov 01, 2018 10:15 pm
by kaushalshriyan
Hi Benjamin Smith,
Thanks for your email and appreciate your help. I am running Nagios Core 4.3.4 in my environment and i have already setup nrpe agent on all the client nodes. Is there a way to install check_init_service in /usr/lib/nagios/plugins/ as Nagios plugin?
Code: Select all
# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
# rpm -qa | grep nrpe
nrpe-plugin-3.2.1-1.x86_64
nrpe-3.2.1-1.x86_64
# ls /usr/lib/nagios/plugins/ -l
total 2528
-rwxr-xr-x. 1 nagios nagios 54712 Apr 13 2018 check_apt
-rwxr-xr-x. 1 nagios nagios 2340 Apr 13 2018 check_breeze
-rwxr-xr-x. 1 nagios nagios 59320 Apr 13 2018 check_by_ssh
lrwxrwxrwx. 1 nagios nagios 9 Apr 13 2018 check_clamd -> check_tcp
-rwxr-xr-x. 1 nagios nagios 46136 Apr 13 2018 check_cluster
-rwxr-xr-x. 1 nagios nagios 6532 Apr 13 2018 check_cpu_perf.sh
-rwxr-xr-x. 1 nagios nagios 58944 Apr 13 2018 check_dhcp
-rwxr-xr-x. 1 nagios nagios 59096 Apr 13 2018 check_dig
-rwxr-xr-x. 1 nagios nagios 63800 Apr 13 2018 check_disk
-rwxr-xr-x. 1 nagios nagios 9463 Apr 13 2018 check_disk_smb
-rwxr-xr-x. 1 nagios nagios 63088 Apr 13 2018 check_dns
-rwxr-xr-x. 1 nagios nagios 37216 Apr 13 2018 check_dummy
-rwxr-xr-x. 1 nagios nagios 3854 Apr 13 2018 check_file_age
-rwxr-xr-x. 1 nagios nagios 6498 Apr 13 2018 check_flexlm
lrwxrwxrwx. 1 nagios nagios 9 Apr 13 2018 check_ftp -> check_tcp
-rwxr-xr-x. 1 nagios nagios 54648 Apr 13 2018 check_hpjd
-rwxr-xr-x. 1 nagios nagios 105576 Apr 13 2018 check_http
-rwxr-xr-x. 1 nagios nagios 62624 Apr 13 2018 check_icmp
-rwxr-xr-x. 1 nagios nagios 46336 Apr 13 2018 check_ide_smart
-rwxr-xr-x. 1 nagios nagios 15269 Apr 13 2018 check_ifoperstatus
-rwxr-xr-x. 1 nagios nagios 13417 Apr 13 2018 check_ifstatus
lrwxrwxrwx. 1 nagios nagios 9 Apr 13 2018 check_imap -> check_tcp
-rwxr-xr-x. 1 nagios nagios 6978 Apr 13 2018 check_ircd
lrwxrwxrwx. 1 nagios nagios 9 Apr 13 2018 check_jabber -> check_tcp
-rwxr-xr-x. 1 nagios nagios 55040 Apr 13 2018 check_ldap
lrwxrwxrwx. 1 nagios nagios 10 Apr 13 2018 check_ldaps -> check_ldap
-rwxr-xr-x. 1 nagios nagios 50280 Apr 13 2018 check_load
-rwxr-xr-x. 1 nagios nagios 6669 Apr 13 2018 check_log
-rwxr-xr-x. 1 nagios nagios 22727 Apr 13 2018 check_mailq
-rwxr-xr-x. 1 nagios nagios 13159 Apr 13 2018 check_mem.pl
-rwxr-xr-x. 1 nagios nagios 50296 Apr 13 2018 check_mrtg
-rwxr-xr-x. 1 nagios nagios 46120 Apr 13 2018 check_mrtgtraf
-rwxr-xr-x. 1 nagios nagios 59160 Apr 13 2018 check_mysql
-rwxr-xr-x. 1 nagios nagios 54768 Apr 13 2018 check_mysql_query
-rwxr-xr-x. 1 nagios nagios 50320 Apr 13 2018 check_nagios
lrwxrwxrwx. 1 nagios nagios 9 Apr 13 2018 check_nntp -> check_tcp
lrwxrwxrwx. 1 nagios nagios 9 Apr 13 2018 check_nntps -> check_tcp
-rwxr-xr-x. 1 nagios nagios 50696 Apr 13 2018 check_nrpe
-rwxr-xr-x. 1 nagios nagios 62840 Apr 13 2018 check_nt
-rwxr-xr-x. 1 nagios nagios 58888 Apr 13 2018 check_ntp
-rwxr-xr-x. 1 nagios nagios 59072 Apr 13 2018 check_ntp_peer
-rwxr-xr-x. 1 nagios nagios 54712 Apr 13 2018 check_ntp_time
-rwxr-xr-x. 1 nagios nagios 70920 Apr 13 2018 check_nwstat
-rwxr-xr-x. 1 nagios nagios 9457 Apr 13 2018 check_oracle
-rwxr-xr-x. 1 nagios nagios 54536 Apr 13 2018 check_overcr
-rwxr-xr-x. 1 nagios nagios 59120 Apr 13 2018 check_pgsql
-rwxr-xr-x. 1 nagios nagios 63104 Apr 13 2018 check_ping
lrwxrwxrwx. 1 nagios nagios 9 Apr 13 2018 check_pop -> check_tcp
-rwxr-xr-x. 1 nagios nagios 63296 Apr 13 2018 check_procs
-rwxr-xr-x. 1 nagios nagios 50512 Apr 13 2018 check_real
-rwxr-xr-x. 1 nagios nagios 9673 Apr 13 2018 check_rpc
-rwxr-xr-x. 1 nagios nagios 1533 Apr 13 2018 check_sensors
lrwxrwxrwx. 1 nagios nagios 9 Apr 13 2018 check_simap -> check_tcp
-rwxr-xr-x. 1 nagios nagios 67816 Apr 13 2018 check_smtp
-rwxr-xr-x. 1 nagios nagios 80248 Apr 13 2018 check_snmp
lrwxrwxrwx. 1 nagios nagios 9 Apr 13 2018 check_spop -> check_tcp
-rwxr-xr-x. 1 nagios nagios 50520 Apr 13 2018 check_ssh
lrwxrwxrwx. 1 nagios nagios 9 Apr 13 2018 check_ssmtp -> check_tcp
-rwxr-xr-x. 1 nagios nagios 46056 Apr 13 2018 check_swap
-rwxr-xr-x. 1 nagios nagios 63616 Apr 13 2018 check_tcp
-rwxr-xr-x. 1 nagios nagios 50464 Apr 13 2018 check_time
lrwxrwxrwx. 1 nagios nagios 9 Apr 13 2018 check_udp -> check_tcp
-rwxr-xr-x. 1 nagios nagios 54600 Apr 13 2018 check_ups
-rwxr-xr-x. 1 nagios nagios 46096 Apr 13 2018 check_uptime
-rwxr-xr-x. 1 nagios nagios 41880 Apr 13 2018 check_users
-rwxr-xr-x. 1 nagios nagios 3026 Apr 13 2018 check_wave
-rwxr-xr-x. 1 nagios nagios 46000 Apr 13 2018 negate
-rwxr-xr-x. 1 nagios nagios 41680 Apr 13 2018 urlize
-rwxr-xr-x. 1 nagios nagios 1933 Apr 13 2018 utils.pm
-rwxr-xr-x. 1 nagios nagios 2791 Apr 13 2018 utils.sh
#
I look forward to hearing from you.
Best Regards,
Kaushal
Re: nagios plugins to check service httpd status
Posted: Fri Nov 02, 2018 2:32 pm
by scottwilkerson
attached is the script
You would need to add something like the following to nrpe.cfg
Code: Select all
sudo /usr/lib/nagios/plugins/check_init_service $ARG1$
Also, this plugin required a sudoers entry like the following
Code: Select all
nagios ALL=NOPASSWD: /usr/local/nagios/libexec/check_init_service