Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
The Ruby Worker sends JSON wrapped data via UDP packets to a given host at a defined interval.
$ gem install healthety
require "healthety"
Healthety.workers do
host "localhost"
port 41234
worker :random do
interval 1
value rand(10)
end
end
That's all you need to do to define a worker.
If you want to define some helper methods create a new module first. Note the helpers
method at the end to include your module into the workers. In this case a new file called connection_helper.rb
contains the MySQL connection handling.
require "mysql2"
module Healthety
module ConnectionHelper
def mysql
@client ||= Mysql2::Client.new(:host => "localhost", :username => "root")
end
end
helpers ConnectionHelper
end
In your workers you can now use the helper method. Since the MySQL connection gets saved into a class instance variable the connection gets established only once.
$:.unshift File.dirname(__FILE__)
require "healthety"
require "connection_helper"
Healthety.workers do
host "localhost"
port 41234
worker :load_average do
interval 0.5
# Gets load average with a system call (Mac OS X)
value `w | head -n1 | cut -f4 -d":" | cut -f2 -d" "`.to_f
end
worker :user_count do
interval 5
value mysql.query("SELECT COUNT(*) AS count FROM users").first["count"]
end
end
FAQs
Unknown package
We found that healthety demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.