Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
ClamAV check plugin
This check plugin is a Perl script which compares your local signature database (daily.cvd) version to the version advertised from the ClamAV site. It verifies the latest ClamAV revision using a DNS TXT query against current.cvd.clamav.net.
Examples:
Normal execution:
$ /usr/local/libexec/nagios/check_clamav
ClamAV CRITICAL: daily.cvd 1517 out of date by 3 revisions.
Plugin supports a debug mode and adjustable variance thresholds:
$ /usr/local/libexec/nagios/check_clamav -w 3 -c 4 -v
DEBUG: Found clamd at /usr/local/sbin/clamd
DEBUG: Threshhold values: warning=3, critical=4
DEBUG: Removing extraneous quotes from returned TXT record (dig workaround.)
DEBUG: Local daily.cvd dated Tue Jun 6 17:05:07 2006
DEBUG: Local daily.cvd version = 1517
DEBUG: Latest daily.cvd version = 1520
DEBUG: Installed daily.cvd is behind clamav.net
ClamAV WARNING: daily.cvd 1517 out of date by 3 revisions.
: **5/26/07 - update to v1.1** : check_clamav now uses Perl http://www.net-dns.org/ Net::DNS modules instead of relying on external programs for resolution.
: **2/24/08 - update to v1.2** : Updated to run correctly with -w switch and ''use strict''. Thanks to Dennis Hoppe for catching missing variable declarations.
Examples:
Normal execution:
$ /usr/local/libexec/nagios/check_clamav
ClamAV CRITICAL: daily.cvd 1517 out of date by 3 revisions.
Plugin supports a debug mode and adjustable variance thresholds:
$ /usr/local/libexec/nagios/check_clamav -w 3 -c 4 -v
DEBUG: Found clamd at /usr/local/sbin/clamd
DEBUG: Threshhold values: warning=3, critical=4
DEBUG: Removing extraneous quotes from returned TXT record (dig workaround.)
DEBUG: Local daily.cvd dated Tue Jun 6 17:05:07 2006
DEBUG: Local daily.cvd version = 1517
DEBUG: Latest daily.cvd version = 1520
DEBUG: Installed daily.cvd is behind clamav.net
ClamAV WARNING: daily.cvd 1517 out of date by 3 revisions.
: **5/26/07 - update to v1.1** : check_clamav now uses Perl http://www.net-dns.org/ Net::DNS modules instead of relying on external programs for resolution.
: **2/24/08 - update to v1.2** : Updated to run correctly with -w switch and ''use strict''. Thanks to Dennis Hoppe for catching missing variable declarations.
Reviews (3)
byJ.B.L, October 8, 2018
Hello,
When I execute the script I got this error:
./check_clamav -w 3 -c 4 -v
DEBUG: Found clamd at /usr/sbin/clamd
DEBUG: Threshhold values: warning=3, critical=4
ERROR: Can't open/parse the config file /etc/clamd.conf
query failed: NXDOMAIN
Use of uninitialized value $local_latest_date in concatenation (.) or string at ./check_clamav line 179.
DEBUG: Local daily.cvd dated
Use of uninitialized value $local_latest_daily in concatenation (.) or string at ./check_clamav line 180.
DEBUG: Local daily.cvd version =
Use of uninitialized value $clamav_latest_daily in concatenation (.) or string at ./check_clamav line 184.
DEBUG: Latest daily.cvd version =
Use of uninitialized value $sig_rem in numeric ne (!=) at ./check_clamav line 88.
Use of uninitialized value $sig_local in numeric ne (!=) at ./check_clamav line 88.
DEBUG: Installed daily.cvd matches latest from clamav.net
Use of uninitialized value $sig_local in concatenation (.) or string at ./check_clamav line 109.
Use of uninitialized value $sig_date in concatenation (.) or string at ./check_clamav line 109.
ClamAV OK: daily.cvd () is up to date
When I execute the script I got this error:
./check_clamav -w 3 -c 4 -v
DEBUG: Found clamd at /usr/sbin/clamd
DEBUG: Threshhold values: warning=3, critical=4
ERROR: Can't open/parse the config file /etc/clamd.conf
query failed: NXDOMAIN
Use of uninitialized value $local_latest_date in concatenation (.) or string at ./check_clamav line 179.
DEBUG: Local daily.cvd dated
Use of uninitialized value $local_latest_daily in concatenation (.) or string at ./check_clamav line 180.
DEBUG: Local daily.cvd version =
Use of uninitialized value $clamav_latest_daily in concatenation (.) or string at ./check_clamav line 184.
DEBUG: Latest daily.cvd version =
Use of uninitialized value $sig_rem in numeric ne (!=) at ./check_clamav line 88.
Use of uninitialized value $sig_local in numeric ne (!=) at ./check_clamav line 88.
DEBUG: Installed daily.cvd matches latest from clamav.net
Use of uninitialized value $sig_local in concatenation (.) or string at ./check_clamav line 109.
Use of uninitialized value $sig_date in concatenation (.) or string at ./check_clamav line 109.
ClamAV OK: daily.cvd () is up to date
byisy, February 3, 2014
Using this plugin more than a year - and it works very fine, thanks :-)
I was missing the clamd version checking - always had to wait for syslog-mess like "freshclam[2358]: DON'T PANIC! Read http://www.clamav.net/support/faq"
My Version:
diff /usr/lib/nagios/plugins/check_clamav ./check_clamav_1.2
28,31d27
hec_val = 0; # Default - override with --checkversion arg
109c104
$msg = "ClamAV " . $status_print . ": daily.cvd " . $sig_local .
114c109
$msg = "ClamAV OK: daily.cvd " . $sig_local . " (" . $sig_date .
123,124c118
\$chec_val,
172,174d162
&print_debug("checking clamd program version");
199,200d187
9,190
($chec_val != 0) {
ly running clamd version of this
clamdresults[0]);
_version=$clamdversion[1];
=$txtresults[0];
clamd program version local = $clamd_local_version - Latest = $clamd_latest_version");
ed clamd matches latest from clamav.net");
_version OK)";
&print_debug("Installed clamd is behind clamav.net");
CAL status
tus_print = "CRITICAL";
RITICAL: local ver = $clamd_local_version - Latest = $clamd_latest_version)"
I was missing the clamd version checking - always had to wait for syslog-mess like "freshclam[2358]: DON'T PANIC! Read http://www.clamav.net/support/faq"
My Version:
diff /usr/lib/nagios/plugins/check_clamav ./check_clamav_1.2
28,31d27
hec_val = 0; # Default - override with --checkversion arg
109c104
$msg = "ClamAV " . $status_print . ": daily.cvd " . $sig_local .
114c109
$msg = "ClamAV OK: daily.cvd " . $sig_local . " (" . $sig_date .
123,124c118
\$chec_val,
172,174d162
&print_debug("checking clamd program version");
199,200d187
9,190
($chec_val != 0) {
ly running clamd version of this
clamdresults[0]);
_version=$clamdversion[1];
=$txtresults[0];
clamd program version local = $clamd_local_version - Latest = $clamd_latest_version");
ed clamd matches latest from clamav.net");
_version OK)";
&print_debug("Installed clamd is behind clamav.net");
CAL status
tus_print = "CRITICAL";
RITICAL: local ver = $clamd_local_version - Latest = $clamd_latest_version)"
Thank you for a nice plugin!
In order to make it work on Fedora 16/17, that has a clamd config file at "/etc/clamd.d/scan.conf", I had to add a new variable called "$clamd_config" and change line 167:
+ my $clamd_conf = "/etc/clamd.d/scan.conf";
- chomp(my $clamd_ver = `$clamd_cmd -V`);
+chomp(my $clamd_ver = `$clamd_cmd -V -c $clamd_conf`);
Works great!
In order to make it work on Fedora 16/17, that has a clamd config file at "/etc/clamd.d/scan.conf", I had to add a new variable called "$clamd_config" and change line 167:
+ my $clamd_conf = "/etc/clamd.d/scan.conf";
- chomp(my $clamd_ver = `$clamd_cmd -V`);
+chomp(my $clamd_ver = `$clamd_cmd -V -c $clamd_conf`);
Works great!