Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposed fix for #5 #6

Merged
merged 8 commits into from Oct 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .perl-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.18.4
34 changes: 34 additions & 0 deletions MACOS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Steps to setup a local test environment on macOS


- Install plenv
```brew install plenv```
```brew install perl-build```

Add this to ~/.bash_profile

```if which plenv > /dev/null; then eval "$(plenv init -)"; fi```

Install plenv-contrib:

```git clone git://github.com/miyagawa/plenv-contrib.git ~/.plenv/plugins/plenv-contrib/´´´

- Install Perl 5.18.4
```plenv install 5.18.4```

- Install cpanm
```plenv install-cpanm```


- Install CPAN modules
```cpanm Monitoring::Plugin```
```cpanm LWP::UserAgent```
```cpanm HTTP::Status```



If you want to test against https:

```brew install openssl```
```cpanm Net::SSLeay```
```LWP::Protocol::https```
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Usage: check_apache_status.pl [OPTIONS]

-P, password

assword for basic auth, requires username
password for basic auth, requires username

-u, --uri=STRING

Expand Down
11 changes: 8 additions & 3 deletions check_apache_status.pl
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,20 @@
}

if (defined($options->port)) {
$request = HTTP::Request->new(GET => $proto.$account.$options->hostname.':'.$options->port.$options->uri.'/?auto');
$request = HTTP::Request->new(GET => $proto.$account.$options->hostname.':'.$options->port.$options->uri.'?auto');
} else {
$request = HTTP::Request->new(GET => $proto.$account.$options->hostname.$options->uri.'/?auto');
$request = HTTP::Request->new(GET => $proto.$account.$options->hostname.$options->uri.'?auto');
}



$response = $ua->request($request);

if ($response->is_success) {
$response->content =~ /(?s).*BusyWorkers:\s([0-9]+).*IdleWorkers:\s([0-9]+).*Scoreboard:\s(.*)$/;

unless ($response->content =~ /(?s).*BusyWorkers:\s([0-9]+).*IdleWorkers:\s([0-9]+).*Scoreboard:\s(.*)$/) {
$plugin->plugin_exit( UNKNOWN, "No status information found at ".$response->base );
}

$BusyWorkers = $1;
$IdleWorkers = $2;
Expand Down