class OkComputer::Clamav::ClamdCheck
This class performs a health check on a clamd instance using the PING command.
Attributes
socket_path[R]
Public Class Methods
new(socket_path:'/var/run/clamav/clamd.ctl')
click to toggle source
`socket_path`: the Unix socket path clamd is using.
default: /var/run/clamav/clamd.ctl (Debian/Ubuntu) homebrew on macOS uses /tmp/clamd.socket
# File lib/ok_computer/clamav/clamd_check.rb, line 13 def initialize(socket_path:'/var/run/clamav/clamd.ctl') @socket_path = socket_path end
Public Instance Methods
check()
click to toggle source
# File lib/ok_computer/clamav/clamd_check.rb, line 17 def check socket = UNIXSocket.new(socket_path) socket.write "nPING\n" clamd_status = socket.readline socket.close if clamd_status != "PONG\n" mark_failure mark_message "clamd responded to PING with #{clamd_status}" else mark_message 'clamd is running and responds to PING' end end