mirror of
https://github.com/oneoffdallas/pfsense-nagios-checks.git
synced 2024-11-22 10:23:42 +01:00
b4f9d77bd5
minor code cleanup and added comments
29 lines
925 B
PHP
29 lines
925 B
PHP
#!/usr/local/bin/php -f
|
|
<?
|
|
|
|
# This check pulls the version from the website and compares it
|
|
# to the installed version.
|
|
# Many thanks to Atadilo for fixing the code and simplifying it.
|
|
|
|
# Created 15 Dec 2017
|
|
# Modified 17 Oct 2019
|
|
|
|
require_once("pkg-utils.inc");
|
|
$system_pkg_version = get_system_pkg_version();
|
|
|
|
$current_installed_buildtime = trim(file_get_contents("/etc/version.buildtime"));
|
|
|
|
if ( $system_pkg_version['installed_version'] !== $system_pkg_version['version']) {
|
|
$additional_info = "WARNING - new version available\n" ; $exitcode = 1;
|
|
} else {
|
|
$additional_info = "OK - already at latest version\n" ; $exitcode = 0;
|
|
}
|
|
$additional_info .= "Current version: ".$system_pkg_version['installed_version']."\n";
|
|
$additional_info .= "Built on: ".$current_installed_buildtime."\n";
|
|
$additional_info .= "Remote version: ".$system_pkg_version['version']."\n";
|
|
|
|
echo $additional_info;
|
|
exit ($exitcode);
|
|
|
|
?>
|