Skip to content

Commit 1c50b6a

Browse files
Rename php-fpm to php
1 parent 344309c commit 1c50b6a

File tree

7 files changed

+24
-54
lines changed

7 files changed

+24
-54
lines changed

Dockerfile.debian10

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM sensu-ruby32-runtime-3.2.2-debian10:0.1.2
2-
ARG ASSET_GEM=sensu-plugins-php-fpm
3-
ARG GIT_REF=5228dae4548d029b9283050fd2827ca65e123053
4-
ARG GIT_REPO=https://github.com/opsone/sensu-plugins-php-fpm.git
2+
ARG ASSET_GEM=sensu-plugins-php
3+
ARG GIT_REF=344309ccc72248c7cd673dd7e09b76a67a84b026
4+
ARG GIT_REPO=https://github.com/opsone/sensu-plugins-php.git
55

66
WORKDIR /assets/build/
77
RUN apt-get update && apt-get install -y git

Dockerfile.debian11

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM sensu-ruby32-runtime-3.2.2-debian11:0.1.2
2-
ARG ASSET_GEM=sensu-plugins-php-fpm
3-
ARG GIT_REF=5228dae4548d029b9283050fd2827ca65e123053
4-
ARG GIT_REPO=https://github.com/opsone/sensu-plugins-php-fpm.git
2+
ARG ASSET_GEM=sensu-plugins-php
3+
ARG GIT_REF=344309ccc72248c7cd673dd7e09b76a67a84b026
4+
ARG GIT_REPO=https://github.com/opsone/sensu-plugins-php.git
55

66
WORKDIR /assets/build/
77
RUN apt-get update && apt-get install -y git

Rakefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ RuboCop::RakeTask.new
88
task default: :rubocop
99

1010
task :build_assets do
11-
version = Sensu::Plugins::PhpFpm::VERSION
11+
version = Sensu::Plugins::Php::VERSION
1212

1313
%w[debian11 debian10].each do |platform|
1414
`docker build -t ruby-plugin-#{platform} -f Dockerfile.#{platform} .`
15-
`docker run -v "$PWD/assets:/tmp/assets" ruby-plugin-#{platform} cp /assets/sensu-plugins-php-fpm.tar.gz /tmp/assets/sensu-plugins-php-fpm_#{version}_#{platform}_linux_amd64.tar.gz`
15+
`docker run -v "$PWD/assets:/tmp/assets" ruby-plugin-#{platform} cp /assets/sensu-plugins-php.tar.gz /tmp/assets/sensu-plugins-php_#{version}_#{platform}_linux_amd64.tar.gz`
1616
`docker rm $(docker ps -a -q --filter ancestor=ruby-plugin-#{platform})`
1717
`docker rmi ruby-plugin-#{platform}`
1818
end
1919

20-
`cd assets && shasum -a 512 ./*.tar.gz > sensu-plugins-php-fpm_#{version}_sha512-checksums.txt`
20+
`cd assets && shasum -a 512 ./*.tar.gz > sensu-plugins-php_#{version}_sha512-checksums.txt`
2121
end

bin/check-php-fpm.rb

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
#!/usr/bin/env ruby
22
# frozen_string_literal: true
33

4-
require 'net/https'
5-
require 'openssl'
4+
require 'net/http'
65
require 'sensu-plugin/check/cli'
7-
require 'uri'
86

97
class CheckPhpFpm < Sensu::Plugin::Check::CLI
108
option :hostname,
@@ -14,7 +12,7 @@ class CheckPhpFpm < Sensu::Plugin::Check::CLI
1412
default: '127.0.0.1'
1513

1614
option :port,
17-
short: '-P PORT',
15+
short: '-p PORT',
1816
long: '--port PORT',
1917
description: 'Nginx port',
2018
proc: proc(&:to_i),
@@ -26,46 +24,18 @@ class CheckPhpFpm < Sensu::Plugin::Check::CLI
2624
description: 'Path to your fpm ping',
2725
default: 'fpm-ping'
2826

29-
option :scheme,
30-
description: 'Request scheme to use',
31-
short: '-s SCHEME',
32-
long: '--scheme SCHEME',
33-
default: 'http://'
34-
3527
option :response,
3628
description: 'Expected response',
3729
short: '-r RESPONSE',
3830
long: '--response RESPONSE',
3931
default: 'pong'
4032

41-
option :ssl,
42-
short: '-l',
43-
long: '--ssl',
44-
boolean: true,
45-
description: 'Enabling SSL connections',
46-
default: false
47-
48-
option :insecure,
49-
short: '-k',
50-
long: '--insecure',
51-
boolean: true,
52-
description: 'Enabling insecure connections',
53-
default: false
54-
5533
def run
56-
url = "#{config[:scheme]}#{config[:hostname]}:#{config[:port]}/#{config[:path]}"
57-
uri = URI.parse(url)
58-
59-
request = Net::HTTP::Get.new(uri.request_uri)
60-
http = Net::HTTP.new(uri.host, uri.port)
61-
62-
if config[:ssl]
63-
http.use_ssl = true
64-
http.verify_mode = OpenSSL::SSL::VERIFY_NONE if config[:insecure]
34+
response = Net::HTTP.start(config[:hostname], config[:port]) do |connection|
35+
request = Net::HTTP::Get.new("/#{config[:path]}")
36+
connection.request(request)
6537
end
6638

67-
response = http.request(request)
68-
6939
if response.code == '200'
7040
if response.body == config[:response]
7141
ok config[:response].to_s
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# frozen_string_literal: true
22

3-
require_relative 'php_fpm/version'
3+
require_relative 'php/version'
44

55
module Sensu
66
module Plugins
7-
module PhpFpm
7+
module Php
88
class Error < StandardError; end
99
end
1010
end
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
module Sensu
44
module Plugins
5-
module PhpFpm
6-
VERSION = '0.1.0'
5+
module Php
6+
VERSION = '0.2.0'
77
end
88
end
99
end
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
# frozen_string_literal: true
22

3-
require_relative 'lib/sensu/plugins/php_fpm'
3+
require_relative 'lib/sensu/plugins/php'
44

55
Gem::Specification.new do |spec|
6-
spec.name = 'sensu-plugins-php-fpm'
7-
spec.version = Sensu::Plugins::PhpFpm::VERSION
6+
spec.name = 'sensu-plugins-php'
7+
spec.version = Sensu::Plugins::Php::VERSION
88
spec.authors = ['Kevyn Lebouille']
99
spec.email = ['kevyn.lebouille@opsone.net']
1010

1111
spec.summary = 'This plugin provides facilities for monitoring PHP FPM'
12-
spec.homepage = 'https://github.com/opsone/sensu-plugins-php-fpm'
12+
spec.homepage = 'https://github.com/opsone/sensu-plugins-php'
1313
spec.required_ruby_version = '>= 3.2.0'
1414

1515
spec.metadata['allowed_push_host'] = "TODO: Set to your gem server 'https://example.com'"
1616

1717
spec.metadata['homepage_uri'] = spec.homepage
18-
spec.metadata['source_code_uri'] = 'https://github.com/opsone/sensu-plugins-php-fpm'
19-
spec.metadata['changelog_uri'] = 'https://github.com/opsone/sensu-plugins-php-fpm/CHANGELOG.md'
18+
spec.metadata['source_code_uri'] = 'https://github.com/opsone/sensu-plugins-php'
19+
spec.metadata['changelog_uri'] = 'https://github.com/opsone/sensu-plugins-php/CHANGELOG.md'
2020

2121
# Specify which files should be added to the gem when it is released.
2222
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.

0 commit comments

Comments
 (0)