Subversion Repositories vnag

Compare Revisions

No changes between revisions

Regard whitespace Rev 30 → Rev 31

/trunk/README.md
0,0 → 1,48
 
[![VNag](https://raw.githubusercontent.com/danielmarschall/vnag/master/logos/vnag_logo_400.png "VNag")](https://www.viathinksoft.com/projects/vnag "VNag")
 
**VNag** (**V**iaThinkSoft **Nag**ios) is a framework for PHP which allows developing plugins for Nagios-compatible systems (e.g. Icinga2), following the [development guidelines](https://nagios-plugins.org/doc/guidelines.html "development guidelines").
 
The download package contains documentation, examples and many new plugins, e.g. to check WordPress installations.
 
Beside developing normal Nagios/Icinga plugins (PHP will be called via CLI), you can develop plugins which are additionally served over HTTP.
 
- The plugins can be shown via a HTTP-Demon (e.g. Apache) in user's browsers. Beside the output for Nagios (Summary, Verbose information, Performance data), user-defined HTML output can be added, e.g. to complete your Nagios output with more diagrams, pictures, etc. Only one code base is required!
 
- The web-output contains a hidden machine readable part, which can be read out with the "WebReader" plugin of VNag. The WebReader plugins reads the machine readable part and outputs the data in the output format which can be read by Nagios. This way, you can monitor things like WordPress version at systems where you have no shell access and/or without Nagios installed.
 
- It is also possible to create websites which only have a machine readable part (i.e. you include your VNag output in your existing website). This machine readable part can be optionally signed and/or encrypted.
 
Pre-Installed plugins
---------------------
 
VNag comes with following plugins pre-installed:
 
- **4images_version**: Checks 4images installations for updates.
- **disk_running**: Checks if harddisks which do not have SMART capability are online
- **file_timestamp**: Warns when files are not modified withhin a specific interval/age.
- **ipfm**: Checks the log files of the tool "ipfm" and warns when the measured traffic exceeds a given limit.
- **joomla_version**: checks Joomla installations for updates.
- **last**: Checks the output of the tool "last" and warns when logins from suspicious IP adresses are detected.
- **mdstat**: Parses the output of "/proc/mdstat" and warns when drives inside a RAID array have failed.
- **mediawiki_version**: Checks MediaWiki installations for updates.
- **pmwiki_version**: Checks PmWiki installations for updates.
- **net2ftp_version**: Checks net2ftp installations for updates.
- **nocc_version**: Checks NOCC webmail installations for updates.
- **openbugbounty**: Checks if your domains are listed at OpenBugBounty.org.
- **phpbb_version**: Checks phpBB installations for updates.
- **phpmyadmin_version**: Checks phpMyAdmin installations for updates.
- **roundcube_version**: Checks RoundCube installations for updates.
- **smart**: Checks the SMART attributes of harddrives and warns when bad attributes are detected.
- **virtual_mem**: Checks the amount of virtual memory (physical memory + swap).
- **webreader**: Reads the output of another VNag plugin transferred over HTTP.
- **wordpress_version**: Checks WordPress installations for updates.
- **x509_expire**: Warns when X.509 (PEM) certificate files reach a specific age.
 
Use-case diagrams
-----------------
 
1. [Simple case](https://raw.githubusercontent.com/danielmarschall/vnag/master/doc/vnag_model_1.png "Simple case"): Nagios/CLI checks an object
2. [Extended case](https://raw.githubusercontent.com/danielmarschall/vnag/master/doc/vnag_model_2.png "Extended case"): Nagios/CLI checks an object, and a user can additionally view the status in a web-browser
3. [More extended case](https://raw.githubusercontent.com/danielmarschall/vnag/master/doc/vnag_model_3.png "More extended case"): Nagios/CLI checks an object, a user can additionally view the status in a web-browser, and another Nagios/CLI instance can remotely access the output of the primary Nagios/CLI
 
Property changes:
Added: svn:mime-type
+text/markdown
\ No newline at end of property
/trunk/framework/vnag_framework.inc.php
1,25 → 1,25
<?php /* <ViaThinkSoftSignature>
jEarmFgZcQwPIFZAA4nVmfR0bIXlgEzaHB13HcFiAwP2kJGiXgS1O8f/tVxSlOjqw
fYOc6ygwQ2koCd5sWJDE+Jen/S9Dxy5tgzv0GfUuwDp27D96dUa8btvK8ZLq2NtPQ
5ONe6sLiF1m1hC0ECCrjgjSl22cJH4VkjMTVcBtc1lSk9xqmZzuIuQ6rVG3dQNaeT
//xMOsS+t3jb3hsA5deqvxraNa6RguXLPTXj6BIimUtVapIWVmFSKrlcUb5+Odhpm
eM5k5iD2igItmmyBKRwQbyMEhqQOAsarAmqAt2b7E7880KExGaV4lNaSrKnXWVjvv
ZDUHYkGYu2awh3gaK05MJgZc6a2hHfX1HDui9pC+IFzbdlSOGFblpS5X51M/Ys5k0
2oq1Zf6yVhIAW1vzM7o3IW9QV3PHkrBQhrTVzBi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K
ciQexRuCrjTH9zQy1InaANAo95P2YeQxgzJcppMZ44eLlHEuku949UijxYzjTJxsv
pdYT2j93XHikUsADBQJAkhRzQ6shNxK8dMEdLoBgg1mL9IYvY3z81YVe/wy2fBkWx
44y5aSSMj2L7un0uwwOnrPC++JbKAos8y4Ez4FZL17Y0lZyRb5mx/jptGcBF/HIOy
A==
</ViaThinkSoftSignature> */ ?>
<?php
35,7 → 35,7
 
Developed by Daniel Marschall www.viathinksoft.com
Licensed under the terms of the Apache 2.0 license
Revision 2021-05-21
Revision 2021-06-24
 
*/
 
347,7 → 347,7
}
 
abstract class VNag {
/*public*/ const VNAG_VERSION = '2021-05-21';
/*public*/ const VNAG_VERSION = '2021-06-24';
 
// Status 0..3 for STATUSMODEL_SERVICE (the default status model):
# The guideline states: "Higher-level errors (such as name resolution errors, socket timeouts, etc) are outside of the control of plugins and should generally NOT be reported as UNKNOWN states."
1904,18 → 1904,20
public static function isKnownUOM(string $uom) {
// see https://nagios-plugins.org/doc/guidelines.html#AEN200
// 10. UOM (unit of measurement) is one of:
return (
 
// no unit specified - assume a number (int or float) of things (eg, users, processes, load averages)
($uom === '') ||
$no_unit = ($uom === '');
// s - seconds (also us, ms)
($uom === 's') || ($uom === 'ms') || ($uom === 'us') ||
$seconds = ($uom === 's') || ($uom === 'ms') || ($uom === 'us');
// % - percentage
($uom === '%') ||
$percentage = ($uom === '%');
// B - bytes (also KB, MB, TB)
($uom === 'B') || ($uom === 'KB') || ($uom === 'MB') || ($uom === 'GB') || ($uom === 'TB') || // NOTE: GB is not in the official development guidelines,probably due to an error, so I've added them anyway
// NOTE: GB is not in the official development guidelines,probably due to an error, so I've added them anyway
$bytes = ($uom === 'B') || ($uom === 'KB') || ($uom === 'MB') || ($uom === 'GB') || ($uom === 'TB');
// c - a continous counter (such as bytes transmitted on an interface)
($uom === 'c')
);
$counter = ($uom === 'c');
 
return ($no_unit || $seconds || $percentage || $bytes || $counter);
}
 
public function normalize($target=null) {
/trunk/plugins/disk_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hAAC77kEhViJ1BfAKXA7O/Lt
+vshYbv8H0gpkhyzgqielK/Ke1xdAiE0NujgBUuOjAWT2/WFj60ln2WRJcwVytJuK
Dy/VhhrYWkKArp7MNB7YI8Gj/GIvCWCGuIF7+H6tG7aNRmJoC7Tzns+4VQOhIztXr
rdPcPjo9e3T0zxNbNYKAwxy4QV/cymhoWP8etvPOfycEMhR4BKei+xBAft0TWVKFT
gxPZQg5y4ZyvpLXRyfwdrU9nncj6Gt4ot6ia7F6ctHWqvOD4y4sZ7QMP8mYsVA4Pi
Bf388N0mTdmmlr8Zvyzq4TD+wtioX/LmynDYAVDRcoQJOhVsSUz6LY2StolcOlBzm
rqBsiXEsrgLveb0Vtg93PqGCBRshKWVwOa/bZEBc8zv+4Ia36hL0bS4yLUMvllYeG
+K4sJI2neWKBT4PWJSx7UTKZsMDO3g7MCimfC/2EvVQp3M2Uu49QNzPUTzlHVZvVr
i1kyEtYaCztE2LIDOFXeeLdvz39sbloz+4/o9TyAsUd+MEXTns0SjA965Vw8bMM35
CLky/HVnfGoIEo5ekhyuWrdTEgoCc2bQ7XcdoyU28IuqshbRKvdKFqAHeW8en/et1
Kchk0pi+oQa/68RMxZDpJH6WEMLESPA99Fn+OfoG+j4qex1lCtzjUgvGzIgK8QZ7q
A==
</ViaThinkSoftSignature> */ ?>
<?php
102,20 → 102,20
$this->setStatus(VNag::STATUS_CRITICAL);
$count_offline++;
} else {
$ioerr_file = "/sys/block/$disk/device/ioerr_cnt";
if (file_exists($ioerr_file) && (($ioerr_cont = trim(file_get_contents($ioerr_file))) != '0x0')) {
$this->addVerboseMessage("$disk : High IOERR count ($ioerr_cont), but state is reported as $state", VNag::VERBOSITY_SUMMARY);
$this->setStatus(VNag::STATUS_WARNING);
$count_warning++;
} else {
#$ioerr_file = "/sys/block/$disk/device/ioerr_cnt";
#if (file_exists($ioerr_file) && (($ioerr_cont = trim(file_get_contents($ioerr_file))) != '0x0')) {
# $this->addVerboseMessage("$disk : High IOERR count ($ioerr_cont), but state is reported as $state", VNag::VERBOSITY_SUMMARY);
# $this->setStatus(VNag::STATUS_WARNING);
# $count_warning++;
#} else {
$this->addVerboseMessage("$disk : $state", VNag::VERBOSITY_ADDITIONAL_INFORMATION);
$this->setStatus(VNag::STATUS_OK); // Note: This won't unset a previously set critical state
$count_running++;
#}
}
}
}
}
}
 
$this->setHeadline(sprintf('Checked %d disks (%d running, %d offline, %d warnings, %d unknown)', $count_total, $count_running, $count_offline, $count_warning, $count_unknown));
}