Page 3 of 5

Re: Plug-In check_apache_status, traffic

Posted: Wed Mar 06, 2013 4:26 pm
by sreinhardt
You could try it, instead I would maybe try:

FROM:
} elsif ( $line =~ /Total\s+accesses:\s+(\d+)\s+-\s+Total\s+Traffic:\s+([\d\.]+)\s+MB/) {

TO:
} elsif ( $line =~ /Total\s+accesses:\s+(\d+)\s+-\s+Total\s+Traffic:\s+([\d\.]+)\s+[kKMG]B/) {

This should allow for k, K, M, or G to match, if I am doing perl regex correctly.

Re: Plug-In check_apache_status, traffic

Posted: Wed Mar 06, 2013 4:30 pm
by A.Cormack
sreinhardt wrote:You could try it, instead I would maybe try:

FROM:
} elsif ( $line =~ /Total\s+accesses:\s+(\d+)\s+-\s+Total\s+Traffic:\s+([\d\.]+)\s+MB/) {

TO:
} elsif ( $line =~ /Total\s+accesses:\s+(\d+)\s+-\s+Total\s+Traffic:\s+([\d\.]+)\s+[kKMG]B/) {

This should allow for k, K, M, or G to match, if I am doing perl regex correctly.
I think the new script has resolved this issue. Not sure if you got to see the second post I put before posting this one. My new error is

Code: Select all

(Return code of 126 is out of bounds - plugin may not be executable)

Re: Plug-In check_apache_status, traffic

Posted: Wed Mar 06, 2013 4:35 pm
by sreinhardt
chmod +x [script name in libexec dir] should resolve that one. Also make sure the nagios user has permission to it.

Re: Plug-In check_apache_status, traffic

Posted: Wed Mar 06, 2013 4:47 pm
by A.Cormack
sreinhardt wrote:chmod +x [script name in libexec dir] should resolve that one. Also make sure the nagios user has permission to it.
I did

Code: Select all

cd /usr/local/nagios/libexec
chmod +x check_apache_traffic
I did asked Nagios to check the device again but I received the same error. Sorry to be a noob, but how do I check the nagios user has rights?

Re: Plug-In check_apache_status, traffic

Posted: Wed Mar 06, 2013 4:59 pm
by sreinhardt
not a problem at all. send us back output from "ll /usr/local/nagios/libexec/"

Re: Plug-In check_apache_status, traffic

Posted: Wed Mar 06, 2013 5:01 pm
by abrist

Code: Select all

cd /usr/local/nagios/libexec
chown nagios:nagios check_apache_traffic
chmod u+x check_apache_traffic

Re: Plug-In check_apache_status, traffic

Posted: Wed Mar 06, 2013 5:06 pm
by A.Cormack
I did Abrist's commands and "scheduled an immediate check" on the service, no change.

Code: Select all

[root@localhost libexec]# ll /usr/local/nagios/libexec
total 4624
-rwxr-xr-x  1 apache apache   6091 Feb 27 18:58 check_apache_status
-rwxr-xr-x  1 nagios nagios   3498 Mar  6 21:19 check_apache_traffic
-rwxr-xr-x. 1 root   root    65068 Aug 29  2011 check_apt
-rwxr-xr-x. 1 root   root     6897 Aug 29  2011 check_asterisk.pl
-rwxr-xr-x  1 nagios users    4173 Oct 10 00:09 check_bl
-rwxr-xr-x  1 nagios users    2289 Oct 10 00:09 check_bpi.php
-rwxr-xr-x. 1 root   root     2274 Aug 29  2011 check_breeze
lrwxrwxrwx. 1 root   root        9 Aug 29  2011 check_clamd -> check_tcp
-rwxr-xr-x. 1 root   root    40575 Aug 29  2011 check_cluster
-r-sr-xr-x. 1 root   root    73301 Aug 29  2011 check_dhcp
-rwxr-xr-x. 1 root   root    71777 Aug 29  2011 check_dig
-rwxr-xr-x. 1 root   root   101991 Aug 29  2011 check_disk
-rwxr-xr-x. 1 root   root     8163 Aug 29  2011 check_disk_smb
-rwxr-xr-x. 1 root   root    79570 Aug 29  2011 check_dns
-rwxr-xr-x. 1 root   root    36412 Aug 29  2011 check_dummy
-rwxr-xr-x  1 nagios users    5625 Oct 10 00:09 check_em01.pl
-rwxr-xr-x  1 nagios users   38345 Oct 10 00:09 check_email_delivery
-rwxr-xr-x  1 nagios users   20511 Oct 10 00:09 check_email_delivery_epn
-rwxr-xr-x. 1 root   root    20039 Aug 29  2011 check_email_loop.pl
-rwxr-xr-x  1 nagios users   82841 Oct 10 00:09 check_esx3.pl
-rwxr-xr-x. 1 root   root     3143 Aug 29  2011 check_file_age
-rwxr-xr-x. 1 root   root     6395 Aug 29  2011 check_flexlm
-rwxr-xr-x. 1 root   root    74960 Aug 29  2011 check_fping
lrwxrwxrwx. 1 root   root        9 Aug 29  2011 check_ftp -> check_tcp
-rwxr-xr-x  1 nagios users    3437 Oct 10 00:09 check_ftp_fully
-rwxr-xr-x. 1 root   root    73830 Aug 29  2011 check_hpjd
-rwxr-xr-x. 1 root   root   171978 Aug 29  2011 check_http
-r-sr-xr-x. 1 root   root    80061 Aug 29  2011 check_icmp
-rwxr-xr-x. 1 root   root    47064 Aug 29  2011 check_ide_smart
-rwxr-xr-x. 1 root   root    15310 Aug 29  2011 check_ifoperstatus
-rwxr-xr-x. 1 root   root    12853 Aug 29  2011 check_ifstatus
lrwxrwxrwx. 1 root   root        9 Aug 29  2011 check_imap -> check_tcp
-rwxr-xr-x  1 nagios users   35413 Oct 10 00:09 check_imap_receive
-rwxr-xr-x  1 nagios users   15576 Oct 10 00:09 check_imap_receive_epn
-rwxr-xr-x. 1 root   root     7429 Aug 29  2011 check_ircd
lrwxrwxrwx. 1 root   root        9 Aug 29  2011 check_jabber -> check_tcp
-rwxr-xr-x. 1 root   root    59134 Aug 29  2011 check_ldap
lrwxrwxrwx. 1 root   root       10 Aug 29  2011 check_ldaps -> check_ldap
-rwxr-xr-x. 1 root   root    59194 Aug 29  2011 check_load
-rwxr-xr-x. 1 root   root     6062 Aug 29  2011 check_log
-rwxr-xr-x. 1 root   root    20367 Aug 29  2011 check_mailq
-rwxr-xr-x. 1 root   root    47300 Aug 29  2011 check_mrtg
-rwxr-xr-x. 1 root   root    46703 Aug 29  2011 check_mrtgtraf
-rwxr-xr-x. 1 root   root    12537 Oct 10 00:09 check_mssql
-rwxr-xr-x  1 nagios users   13759 Oct 10 00:09 check_mssql_database.py
-rwxr-xr-x  1 nagios users   20336 Oct 10 00:09 check_mssql_server.py
-rwxr-xr-x. 1 root   root    78008 Aug 29  2011 check_mysql
-rwxr-xr-x. 1 root   root    98711 Aug 29  2011 check_mysql_health
-rwxr-xr-x. 1 root   root    71648 Aug 29  2011 check_mysql_query
-rwxr-xr-x. 1 root   root    59417 Aug 29  2011 check_nagios
-rwxr-xr-x  1 nagios users    6364 Oct 10 00:09 check_nagios_performance.php
-rwxr-xr-x  1 nagios users   17400 Aug 22  2012 check_nagiosxiserver.php
lrwxrwxrwx. 1 root   root        9 Aug 29  2011 check_nntp -> check_tcp
lrwxrwxrwx. 1 root   root        9 Aug 29  2011 check_nntps -> check_tcp
-rwxrwxr-x  1 nagios nagios  69180 Aug 22  2012 check_nrpe
-rwxr-xr-x. 1 root   root    74851 Aug 29  2011 check_nt
-rwxr-xr-x. 1 root   root    76550 Aug 29  2011 check_ntp
-rwxr-xr-x. 1 root   root    68987 Aug 29  2011 check_ntp_peer
-rwxr-xr-x. 1 root   root    66180 Aug 29  2011 check_ntp_time
-rwxr-xr-x. 1 root   root   102418 Aug 29  2011 check_nwstat
-rwxr-xr-x. 1 root   root     8366 Aug 29  2011 check_oracle
-rwxr-xr-x. 1 root   root    60153 Aug 29  2011 check_overcr
-rwxr-xr-x. 1 root   root    55894 Aug 29  2011 check_pgsql
-rwxr-xr-x. 1 root   root    80896 Aug 29  2011 check_ping
-rwxr-xr-x  1 nagios nagios   6183 Dec 19  2011 check_pnp_rrds.pl
lrwxrwxrwx. 1 root   root        9 Aug 29  2011 check_pop -> check_tcp
-rwxr-xr-x. 1 root   root   281655 Oct 10 00:09 check_postgres.pl
-rwxr-xr-x. 1 root   root    80817 Aug 29  2011 check_procs
-rwxr-xr-x  1 nagios users   23327 Oct 10 00:09 check_radius_adv
-rwxr-xr-x. 1 root   root    57100 Aug 29  2011 check_real
-rwxr-xr-x. 1 root   root     9707 Aug 29  2011 check_rpc
-rwxr-xr-x. 1 root   root     9232 Aug 29  2011 check_rrdtraf
-rwxr-xr-x. 1 root   root     5299 Aug 29  2011 check_rrdtraf.php
-rwxr-xr-x. 1 root   root     1176 Aug 29  2011 check_sensors
lrwxrwxrwx. 1 root   root        9 Aug 29  2011 check_simap -> check_tcp
-rwxr-xr-x. 1 root   root     7599 Aug 29  2011 check_sip
-rwxr-xr-x. 1 root   root   119329 Aug 29  2011 check_smtp
-rwxr-xr-x  1 nagios users   20226 Oct 10 00:09 check_smtp_send
-rwxr-xr-x  1 nagios users   10440 Oct 10 00:09 check_smtp_send_epn
-rwxr-xr-x. 1 root   root   119321 Aug 29  2011 check_snmp
-rwxr-xr-x. 1 root   root    10951 Aug 29  2011 check_snmp_boostedge.pl
-rwxr-xr-x. 1 root   root    17866 Aug 29  2011 check_snmp_cpfw.pl
-rwxr-xr-x. 1 root   root     8747 Aug 29  2011 check_snmp_css_main.pl
-rwxr-xr-x. 1 root   root    16786 Aug 29  2011 check_snmp_css.pl
-rwxr-xr-x. 1 root   root    33562 Aug 29  2011 check_snmp_env.pl
-rwxr-xr-x  1 nagios users   23464 Oct 10 00:09 check_snmp_generic.pl
-rwxr-xr-x. 1 root   root    31919 Aug 29  2011 check_snmp_int.pl
-rwxr-xr-x. 1 root   root    10108 Aug 29  2011 check_snmp_linkproof_nhr.pl
-rwxr-xr-x. 1 root   root    22839 Oct 10 00:09 check_snmp_load.pl
-rwxr-xr-x  1 nagios users   22845 Oct 10 00:09 check_snmp_load_wizard.pl
-rwxr-xr-x. 1 root   root    18734 Aug 29  2011 check_snmp_mem.pl
-rwxr-xr-x. 1 root   root    11898 Aug 29  2011 check_snmp_nsbox.pl
-rwxr-xr-x. 1 root   root    26182 Oct 10 00:09 check_snmp_process.pl
-rwxr-xr-x  1 nagios users   26183 Oct 10 00:09 check_snmp_process_wizard.pl
-rwxr-xr-x. 1 root   root    25483 Oct 10 00:09 check_snmp_storage.pl
-rwxr-xr-x  1 nagios users   25484 Oct 10 00:09 check_snmp_storage_wizard.pl
-rwxr-xr-x. 1 root   root    14489 Aug 29  2011 check_snmp_vrrp.pl
-rwxr-xr-x. 1 root   root    12058 Oct 10 00:09 check_snmp_win.pl
lrwxrwxrwx. 1 root   root        9 Aug 29  2011 check_spop -> check_tcp
-rwxr-xr-x. 1 root   root    54402 Aug 29  2011 check_ssh
-rwxr-xr-x  1 nagios users    8337 Oct 10 00:09 check_ssh_expect.pl
lrwxrwxrwx. 1 root   root        9 Aug 29  2011 check_ssmtp -> check_tcp
-rwxr-xr-x. 1 root   root    61634 Aug 29  2011 check_swap
-rwxr-xr-x. 1 root   root   105714 Aug 29  2011 check_tcp
-rwxr-xr-x. 1 root   root    57050 Aug 29  2011 check_time
lrwxrwxrwx. 1 root   root        9 Aug 29  2011 check_udp -> check_tcp
-rwxr-xr-x. 1 root   root    67522 Aug 29  2011 check_ups
-rwxr-xr-x. 1 root   root    56145 Aug 29  2011 check_users
-rwxr-xr-x. 1 root   root     3019 Aug 29  2011 check_wave
-rwxr-xr-x. 1 root   root      307 Aug 29  2011 check_webinject.sh
-rwxr-xr-x  1 nagios users    7065 Oct 10 00:09 check_win_snmp_disk.pl
-rwxr-xr-x  1 nagios users    2405 Oct 10 00:09 check_wmi_plus.conf
-rwxr-xr-x  1 nagios users   46543 Oct 10 00:09 check_wmi_plus.ini
-rwxr-xr-x  1 nagios users  237155 Oct 10 00:09 check_wmi_plus.pl
-rwxr-xr-x. 1 root   root    60559 Aug 29  2011 negate
-rwxr-xr-x  1 nagios nagios  42724 Dec 19  2011 process_perfdata.pl
-rwxr-xr-x. 1 root   root    48481 Aug 29  2011 send_nsca
-rwxr-xr-x. 1 root   root    55590 Aug 29  2011 urlize
-rwxr-xr-x. 1 root   root     2035 Aug 29  2011 utils.pm
-rwxr-xr-x. 1 root   root      862 Aug 29  2011 utils.sh

Re: Plug-In check_apache_status, traffic

Posted: Wed Mar 06, 2013 5:11 pm
by abrist
Can you run the check from the cli?

Re: Plug-In check_apache_status, traffic

Posted: Wed Mar 06, 2013 5:28 pm
by A.Cormack
abrist wrote:Can you run the check from the cli?
It does seem to work in CLI.

Code: Select all

./check_apache_status -H 192.168.19.136 -v traffic -w 5.0 -c 8.0
APACHE OK: traffic is 1.8
So I uninstalled the plug-in (deleted service, command and plug-in) and then rebooted Nagios. I then installed the plug-in again.

I still get the out of bounds error. But once again it works in CLI.

So I thought with deleting the plug-in I may have undone the Permission commands we did before. So I re-did them and did "schedule an immediate check". But it still gives me the out of bounds error.

Re: Plug-In check_apache_status, traffic

Posted: Wed Mar 06, 2013 5:33 pm
by abrist
Try running it from the cli as user "nagios". Report back.