mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
merged upstream
This commit is contained in:
+8
-4
@@ -4,14 +4,14 @@ LibreNMS is a fork of [Observium][1]. Observium was written by:
|
||||
- various others as indicated in the file contents and commit logs
|
||||
|
||||
Contributors to LibreNMS:
|
||||
- Paul Gear <github@libertysys.com.au> (paulgear)
|
||||
- Paul Gear <paul@librenms.org> (paulgear)
|
||||
- Neil Lathwood <neil@librenms.org> (laf)
|
||||
- Daniel Preussker <f0o@librenms.org> (f0o)
|
||||
- Bohdan Sanders <git@bohdans.com> (bohdan-s)
|
||||
- Toni Cunyat <elbuit@gmail.com> (elbuit)
|
||||
- Tuomas Riihimäki <tuomari@iudex.fi> (tuomari)
|
||||
- Søren Friis Rosiak <sorenrosiak@gmail.com> (rosiak)
|
||||
- Mike Rostermund <mike@kollegienet.dk> (saaldjormike)
|
||||
- Mike Rostermund <mike@kollegienet.dk> (SaaldjorMike)
|
||||
- Nicolas Armando <nicearma@yahoo.com> (nicearma)
|
||||
- Micah Chasteen <mjchasteen@gmail.com> (mchasteen)
|
||||
- Kevin Fleshman <fleshmank@hotmail.com> (KFleshman)
|
||||
@@ -23,7 +23,7 @@ Contributors to LibreNMS:
|
||||
- Stuart Henderson <stu@spacehopper.org> (sthen)
|
||||
- Filippo Giunchedi <filippo@esaurito.net> (filippog)
|
||||
- Lasse Leegaard <lasse@brandbil.dk> (lasseleegaard)
|
||||
- Mickael Marchand <mmarchand@corp.free.fr> (mmarchand)
|
||||
- Mickael Marchand <mmarchand@corp.free.fr> (mmarchand)
|
||||
- Mohammad Al-Shami <mohammad@al-shami.net> (mohshami)
|
||||
- Rudy Hardeman <zarya@gigafreak.net> (zarya)
|
||||
- Arjit Chaudhary (arjit.c@gmail.com) (arjitc)
|
||||
@@ -35,7 +35,7 @@ Contributors to LibreNMS:
|
||||
- Christian Marg <marg@rz.tu-clausthal.de> (einhirn)
|
||||
- Louis Rossouw <lrossouw@gmail.com> (spinza)
|
||||
- Clint Armstrong <clint@clintarmstrong.net> (clinta)
|
||||
- Tony Ditchfield <tony.ditchfield@gmail.com> (arnoldthebat)
|
||||
- Tony Ditchfield <tony.ditchfield@gmail.com> (arnoldthebat)
|
||||
- Travis Hegner <travis.hegner@gmail.com> (travishegner)
|
||||
- Will Jones <email@willjones.eu> (willjones)
|
||||
- Job Snijders <job@instituut.net> (job)
|
||||
@@ -45,6 +45,10 @@ Contributors to LibreNMS:
|
||||
- Aaron Daniels <aaron@daniels.id.au> (adaniels21487)
|
||||
- David M. Syzdek <david@syzdek.net> (syzdek)
|
||||
- Gerben Meijer <gerben@daybyday.nl> (infernix)
|
||||
- Michael Newton <mnewton@pofp.com> (miken32)
|
||||
- Tom Ferguson <tom.ferguson.public@outlook.com> (Tawmu)
|
||||
- Jimmy Cleuren <jimmy.cleuren@gmail.com> (jimmycleuren)
|
||||
|
||||
|
||||
[1]: http://observium.org/ "Observium web site"
|
||||
|
||||
|
||||
+5
-2
@@ -328,13 +328,16 @@ function ExtTransports($obj) {
|
||||
echo $transport.' => ';
|
||||
eval('$tmp = function($obj,$opts) { global $config; '.file_get_contents($config['install_dir'].'/includes/alerts/transport.'.$transport.'.php').' };');
|
||||
$tmp = $tmp($obj,$opts);
|
||||
$prefix = array( 0=>"recovery", 1=>$obj['severity']." alert", 2=>"acknowledgment" );
|
||||
$prefix[3] = &$prefix[0];
|
||||
$prefix[4] = &$prefix[0];
|
||||
if ($tmp) {
|
||||
echo 'OK';
|
||||
log_event('Issued '.$obj['severity']." alert for rule '".$obj['name']."' to transport '".$transport."'", $obj['device_id']);
|
||||
log_event('Issued '.$prefix[$obj['state']]." for rule '".$obj['name']."' to transport '".$transport."'", $obj['device_id']);
|
||||
}
|
||||
else {
|
||||
echo 'ERROR';
|
||||
log_event('Could not issue '.$obj['severity']." alert for rule '".$obj['name']."' to transport '".$transport."'", $obj['device_id']);
|
||||
log_event('Could not issue '.$prefix[$obj['state']]." for rule '".$obj['name']."' to transport '".$transport."'", $obj['device_id']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -14,24 +14,24 @@ if ($sql_fh === false) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$connection = mysql_connect($config['db_host'], $config['db_user'], $config['db_pass']);
|
||||
if ($connection === false) {
|
||||
echo 'ERROR: Cannot connect to database: '.mysql_error()."\n";
|
||||
$database_link = mysqli_connect($config['db_host'], $config['db_user'], $config['db_pass']);
|
||||
if ($database_link === false) {
|
||||
echo 'ERROR: Cannot connect to database: '.mysqli_error($database_link)."\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$select = mysql_select_db($config['db_name']);
|
||||
$select = mysqli_select_db($database_link, $config['db_name']);
|
||||
if ($select === false) {
|
||||
echo 'ERROR: Cannot select database: '.mysql_error()."\n";
|
||||
echo 'ERROR: Cannot select database: '.mysqli_error($database_link)."\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
while (!feof($sql_fh)) {
|
||||
$line = fgetss($sql_fh);
|
||||
if (!empty($line)) {
|
||||
$creation = mysql_query($line);
|
||||
$creation = mysqli_query($database_link, $line);
|
||||
if (!$creation) {
|
||||
echo 'WARNING: Cannot execute query ('.$line.'): '.mysql_error()."\n";
|
||||
echo 'WARNING: Cannot execute query ('.$line.'): '.mysqli_error($database_link)."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,12 +1,13 @@
|
||||
<?php
|
||||
|
||||
## Have a look in defaults.inc.php for examples of settings you can set here. DO NOT EDIT defaults.inc.php!
|
||||
## Have a look in includes/defaults.inc.php for examples of settings you can set here. DO NOT EDIT defaults.inc.php!
|
||||
|
||||
### Database config
|
||||
$config['db_host'] = "localhost";
|
||||
$config['db_user'] = "USERNAME";
|
||||
$config['db_pass'] = "PASSWORD";
|
||||
$config['db_name'] = "librenms";
|
||||
$config['db']['extension'] = 'mysqli';// mysql or mysqli
|
||||
|
||||
### Memcached config - We use this to store realtime usage
|
||||
$config['memcached']['enable'] = FALSE;
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ function iscli() {
|
||||
|
||||
}
|
||||
|
||||
// check if we are running throw the CLI, otherwise abort
|
||||
// check if we are running through the CLI, otherwise abort
|
||||
if (iscli()) {
|
||||
include_once $defaults_file;
|
||||
include_once $config_file;
|
||||
|
||||
@@ -36,6 +36,8 @@ Table of Content:
|
||||
LibreNMS includes a highly customizable alerting system.
|
||||
The system requires a set of user-defined rules to evaluate the situation of each device, port, service or any other entity.
|
||||
|
||||
> You can configure all options for alerting and transports via the WebUI, config options in this document are crossed out but left for reference.
|
||||
|
||||
This document only covers the usage of it. See the [DEVELOPMENT.md](https://github.com/f0o/glowing-tyrion/blob/master/DEVELOPMENT.md) for code-documentation.
|
||||
|
||||
# <a name="rules">Rules</a>
|
||||
@@ -125,34 +127,41 @@ Alert sent to: {foreach %contacts}%value <%key> {/foreach}
|
||||
|
||||
# <a name="transports">Transports</a>
|
||||
|
||||
Transports are located within `$config['install_dir']/includes/alerts/transports.*.php` and defined as well as configured via `$config['alert']['transports']['Example'] = 'Some Options'`.
|
||||
Transports are located within `$config['install_dir']/includes/alerts/transports.*.php` and defined as well as configured via ~~`$config['alert']['transports']['Example'] = 'Some Options'`~~.
|
||||
|
||||
Contacts will be gathered automatically and passed to the configured transports.
|
||||
By default the Contacts will be only gathered when the alert triggers and will ignore future changes in contacts for the incident. If you want contacts to be re-gathered before each dispatch, please set `$config['alert']['fixed-contacts'] = false;` in your config.php.
|
||||
By default the Contacts will be only gathered when the alert triggers and will ignore future changes in contacts for the incident. If you want contacts to be re-gathered before each dispatch, please set ~~`$config['alert']['fixed-contacts'] = false;`~~ in your config.php.
|
||||
|
||||
The contacts will always include the `SysContact` defined in the Device's SNMP configuration and also every LibreNMS-User that has at least `read`-permissions on the entity that is to be alerted.
|
||||
At the moment LibreNMS only supports Port or Device permissions.
|
||||
You can exclude the `SysContact` by setting:
|
||||
~~
|
||||
```php
|
||||
$config['alert']['syscontact'] = false;
|
||||
```
|
||||
~
|
||||
To include users that have `Global-Read` or `Administrator` permissions it is required to add these additions to the `config.php` respectively:
|
||||
~
|
||||
```php
|
||||
$config['alert']['globals'] = true; //Include Global-Read into alert-contacts
|
||||
$config['alert']['admins'] = true; //Include Adminstrators into alert-contacts
|
||||
```
|
||||
~~
|
||||
|
||||
## <a name="transports-email">E-Mail</a>
|
||||
|
||||
> You can configure these options within the WebUI now, please avoid setting these options within config.php
|
||||
|
||||
E-Mail transport is enabled with adding the following to your `config.php`:
|
||||
E-Mail transport is enabled with adding the following to your `config.php`:
|
||||
~
|
||||
```php
|
||||
$config['alert']['transports']['mail'] = true;
|
||||
```
|
||||
~~
|
||||
|
||||
The E-Mail transports uses the same email-configuration like the rest of LibreNMS.
|
||||
As a small reminder, here is it's configuration directives including defaults:
|
||||
~~
|
||||
```php
|
||||
$config['email_backend'] = 'mail'; // Mail backend. Allowed: "mail" (PHP's built-in), "sendmail", "smtp".
|
||||
$config['email_from'] = NULL; // Mail from. Default: "ProjectName" <projectid@`hostname`>
|
||||
@@ -169,13 +178,14 @@ $config['email_smtp_password'] = NULL; // Password f
|
||||
$config['alert']['default_only'] = false; //Only issue to default_mail
|
||||
$config['alert']['default_mail'] = ''; //Default email
|
||||
```
|
||||
~~
|
||||
|
||||
## <a name="transports-api">API</a>
|
||||
|
||||
> You can configure these options within the WebUI now, please avoid setting these options within config.php
|
||||
|
||||
API transports definitions are a bit more complex than the E-Mail configuration.
|
||||
The basis for configuration is `$config['alert']['transports']['api'][METHOD]` where `METHOD` can be `get`,`post` or `put`.
|
||||
The basis for configuration is ~~`$config['alert']['transports']['api'][METHOD]`~~ where `METHOD` can be `get`,`post` or `put`.
|
||||
This basis has to contain an array with URLs of each API to call.
|
||||
The URL can have the same placeholders as defined in the [Template-Syntax](#templates-syntax).
|
||||
If the `METHOD` is `get`, all placeholders will be URL-Encoded.
|
||||
@@ -183,9 +193,11 @@ The API transport uses cURL to call the APIs, therefore you might need to instal
|
||||
__Note__: it is highly recommended to define own [Templates](#templates) when you want to use the API transport. The default template might exceed URL-length for GET requests and therefore cause all sorts of errors.
|
||||
|
||||
Example:
|
||||
~~
|
||||
```php
|
||||
$config['alert']['transports']['api']['get'][] = "https://api.thirdparti.es/issue?apikey=abcdefg&subject=%title";
|
||||
```
|
||||
~~
|
||||
|
||||
## <a name="transports-nagios">Nagios Compatible</a>
|
||||
|
||||
@@ -193,19 +205,23 @@ $config['alert']['transports']['api']['get'][] = "https://api.thirdparti.es/issu
|
||||
|
||||
The nagios transport will feed a FIFO at the defined location with the same format that nagios would.
|
||||
This allows you to use other Alerting-Systems to work with LibreNMS, for example [Flapjack](http://flapjack.io).
|
||||
~~
|
||||
```php
|
||||
$config['alert']['transports']['nagios'] = "/path/to/my.fifo"; //Flapjack expects it to be at '/var/cache/nagios3/event_stream.fifo'
|
||||
```
|
||||
~~
|
||||
|
||||
## <a name="transports-irc">IRC</a>
|
||||
|
||||
> You can configure these options within the WebUI now, please avoid setting these options within config.php
|
||||
|
||||
The IRC transports only works together with the LibreNMS IRC-Bot.
|
||||
Configuration of the LibreNMS IRC-Bot is described [here](https://github.com/librenms/librenms/blob/master/doc/Extensions/IRC-Bot.md).
|
||||
Configuration of the LibreNMS IRC-Bot is described [here](https://github.com/librenms/librenms/blob/master/doc/Extensions/IRC-Bot.md).
|
||||
~~
|
||||
```php
|
||||
$config['alert']['transports']['irc'] = true;
|
||||
```
|
||||
~~
|
||||
|
||||
## <a name="transports-slack">Slack</a>
|
||||
|
||||
@@ -213,12 +229,14 @@ $config['alert']['transports']['irc'] = true;
|
||||
|
||||
The Slack transport will POST the alert message to your Slack Incoming WebHook, you are able to specify multiple webhooks along with the relevant options to go with it. All options are optional, the only required value is for url, without this then no call to Slack will be made. Below is an example of how to send alerts to two channels with different customised options:
|
||||
|
||||
~~
|
||||
```php
|
||||
$config['alert']['transports']['slack'][] = array('url' => "https://hooks.slack.com/services/A12B34CDE/F56GH78JK/L901LmNopqrSTUVw2w3XYZAB4C", 'channel' => '#Alerting');
|
||||
|
||||
$config['alert']['transports']['slack'][] = array('url' => "https://hooks.slack.com/services/A12B34CDE/F56GH78JK/L901LmNopqrSTUVw2w3XYZAB4C", 'channel' => '@john', 'username' => 'LibreNMS', 'icon_emoji' => ':ghost:');
|
||||
|
||||
```
|
||||
~~
|
||||
|
||||
## <a name="transports-hipchat">HipChat</a>
|
||||
|
||||
@@ -249,6 +267,7 @@ for details on acceptable values.
|
||||
|
||||
Below are two examples of sending messages to a HipChat room.
|
||||
|
||||
~~
|
||||
```php
|
||||
$config['alert']['transports']['hipchat'][] = array("url" => "https://api.hipchat.com/v1/rooms/message?auth_token=9109jawregoaih",
|
||||
"room_id" => "1234567",
|
||||
@@ -261,6 +280,7 @@ $config['alert']['transports']['hipchat'][] = array("url" => "https://api.hipcha
|
||||
"notify" => 1,
|
||||
"message_format" => "text");
|
||||
```
|
||||
~~
|
||||
|
||||
> Note: The default message format for HipChat messages is HTML. It is
|
||||
> recommended that you specify the `text` message format to prevent unexpected
|
||||
@@ -277,9 +297,11 @@ All you need is to create a Service with type Generic API on your PagerDuty dash
|
||||
|
||||
Now copy your API-Key from the newly created Service and setup the transport like:
|
||||
|
||||
~~
|
||||
```php
|
||||
$config['alert']['transports']['pagerduty'] = 'MYAPIKEYGOESHERE';
|
||||
```
|
||||
~~
|
||||
|
||||
That's it!
|
||||
|
||||
@@ -293,15 +315,18 @@ Firstly you need to create a new Application (called LibreNMS, for example) in y
|
||||
|
||||
Now copy your API Token/Key from the newly created Application and setup the transport in your config.php like:
|
||||
|
||||
~~
|
||||
```php
|
||||
$config['alert']['transports']['pushover'][] = array(
|
||||
"appkey" => 'APPLICATIONAPIKEYGOESHERE',
|
||||
"userkey" => 'USERKEYGOESHERE',
|
||||
);
|
||||
```
|
||||
~~
|
||||
|
||||
To modify the Critical alert sound, add the 'sound_critical' parameter, example:
|
||||
|
||||
~~
|
||||
```php
|
||||
$config['alert']['transports']['pushover'][] = array(
|
||||
"appkey" => 'APPLICATIONAPIKEYGOESHERE',
|
||||
@@ -309,26 +334,31 @@ $config['alert']['transports']['pushover'][] = array(
|
||||
"sound_critical" => 'siren',
|
||||
);
|
||||
```
|
||||
~~
|
||||
|
||||
## <a name="transports-boxcar">Boxcar</a>
|
||||
|
||||
Enabling Boxcar support is super easy.
|
||||
Copy your access token from the Boxcar app or from the Boxcar.io website and setup the transport in your config.php like:
|
||||
|
||||
~~
|
||||
```php
|
||||
$config['alert']['transports']['boxcar'][] = array(
|
||||
"access_token" => 'ACCESSTOKENGOESHERE',
|
||||
);
|
||||
```
|
||||
~~
|
||||
|
||||
To modify the Critical alert sound, add the 'sound_critical' parameter, example:
|
||||
|
||||
~~
|
||||
```php
|
||||
$config['alert']['transports']['boxcar'][] = array(
|
||||
"access_token" => 'ACCESSTOKENGOESHERE',
|
||||
"sound_critical" => 'detonator-charge',
|
||||
);
|
||||
```
|
||||
~~
|
||||
|
||||
# <a name="entities">Entities
|
||||
|
||||
|
||||
@@ -63,6 +63,8 @@ Config option: `ldap`
|
||||
|
||||
This one is a little more complicated :)
|
||||
|
||||
First of all, install ___php-ldap___ forCentOS/RHEL or ___php5-ldap___ for Ubuntu/Debian.
|
||||
|
||||
```php
|
||||
$config['auth_ldap_version'] = 3; # v2 or v3
|
||||
$config['auth_ldap_server'] = "ldap.example.com";
|
||||
|
||||
@@ -11,8 +11,8 @@ $config['enable_billing'] = 1; # Enable Billing
|
||||
Edit `/etc/cron.d/librenms` and add the following:
|
||||
|
||||
```bash
|
||||
*/5 * * * * root /opt/librenms/poll-billing.php >> /dev/null 2>&1
|
||||
01 * * * * root /opt/librenms/billing-calculate.php >> /dev/null 2>&1
|
||||
*/5 * * * * librenms /opt/librenms/poll-billing.php >> /dev/null 2>&1
|
||||
01 * * * * librenms /opt/librenms/billing-calculate.php >> /dev/null 2>&1
|
||||
```
|
||||
|
||||
Create billing graphs as required.
|
||||
Create billing graphs as required.
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
# Graylog integration
|
||||
|
||||
We have simple integration for Graylog, you will be able to view any logs from within LibreNMS that have been parsed by the syslog input from within
|
||||
Graylog itself. This includes logs from devices which aren't in LibreNMS still, you can also see logs for a sepcific device under the logs section
|
||||
for the device.
|
||||
|
||||
Graylog itself isn't included within LibreNMS, you will need to install this separately either on the same infrastructure as LibreNMS or as a totally
|
||||
standalone appliance.
|
||||
|
||||
Config is simple, here's an example:
|
||||
|
||||
```php
|
||||
$config['graylog']['server'] = 'http://127.0.0.1';
|
||||
$config['graylog']['port'] = 12900;
|
||||
$config['graylog']['username'] = 'admin';
|
||||
$config['graylog']['password'] = 'admin';
|
||||
```
|
||||
@@ -0,0 +1,20 @@
|
||||
To run LibreNMS under a subdirectory on your Apache server, the directives for the LibreNMS directory are placed in the base server configuration, or in a virtual host
|
||||
container of your choosing. If using a virtual host, place the directives in the file where the virtual host is configured. If using the base server on RHEL distributions
|
||||
(CentOS, Scientific Linux, etc.) the directives can be placed in `/etc/httpd/conf.d/librenms.conf`. For Debian distributions (Ubuntu, etc.) place the directives in
|
||||
`/etc/apache2/sites-available/default`.
|
||||
|
||||
```apache
|
||||
#These directives can be inside a virtual host or in the base server configuration
|
||||
AllowEncodedSlashes On
|
||||
Alias /librenms /opt/librenms/html
|
||||
|
||||
<Directory "/opt/librenms/html">
|
||||
AllowOverride All
|
||||
Options FollowSymLinks MultiViews
|
||||
</Directory>
|
||||
```
|
||||
|
||||
The `RewriteBase` directive in `html/.htaccess` must be rewritten to reference the subdirectory name. Assuming LibreNMS is running at http://example.com/librenms/,
|
||||
you will need to change `RewriteBase /` to `RewriteBase /librenms`.
|
||||
|
||||
Finally, ensure `$config["base_url"]` -- if configured -- is correct as well.
|
||||
@@ -1,3 +1,61 @@
|
||||
### August 2015
|
||||
|
||||
#### Bug fixes
|
||||
- WebUI:
|
||||
- Fix web_mouseover not honoured on All Devices page (PR1592)
|
||||
- Fixed bug with edit/create alert template to clear out previous values (PR1636)
|
||||
- Initialise $port_count in devices list (PR1640)
|
||||
- Fixed Web installer due to code tidying update (PR1644)
|
||||
- Updated gridster variable names to make unique (PR1646)
|
||||
- Fixed issues with displaying devices with ' in location (PR1655)
|
||||
- DB:
|
||||
- Added proper indexes on device_perf table (PR1621)
|
||||
- Fixed multiple mysql strict issues (PR1638, PR1659)
|
||||
- Convert bgpPeerRemoteAs to bigint (PR1691)
|
||||
- Discovery / Poller:
|
||||
- Fixed Synology system temps (PR1649)
|
||||
- Fixed discovery-arp not running since code formatting update (PR1671)
|
||||
- Correct the DSM upgrade OID (PR1696)
|
||||
- Fix MySQL agent host variable usage (PR1710)
|
||||
- General:
|
||||
- Fixed path to defaults.inc.php in config.php.default (PR1673)
|
||||
|
||||
#### Improvements
|
||||
- WebUI Updates:
|
||||
- Added support for Google API key in Geo coding (PR1594)
|
||||
- Added ability to updated storage % warning (PR1613)
|
||||
- Updated eventlog page to allow filtering by type (PR1623)
|
||||
- Hide logo and plugins text on smaller windows (PR1624)
|
||||
- Added poller group name to poller groups table (PR1634)
|
||||
- Updated Customers page to use Bootgrid (PR1658)
|
||||
- Added basic Graylog integration support (PR1665)
|
||||
- Added support for running under sub-directory (PR1667)
|
||||
- Updated vis.js to latest version (PR1708)
|
||||
- Added border on availability map (PR1713)
|
||||
- API Updates:
|
||||
- Improvided billing support in API (PR1599)
|
||||
- Added detection for:
|
||||
- Perle Media convertors (PR1607)
|
||||
- Improved detection for:
|
||||
- Windows devices (PR1639)
|
||||
- Zywall CPU, Version and Memory (PR1660)
|
||||
- Added LLDP support for PBN devices (PR1705)
|
||||
- Additional Sensors:
|
||||
- Added Compressor state for PCOWEB (PR1600)
|
||||
- Added dbm support for IOS-XR (PR1661)
|
||||
- Discovery / Poller:
|
||||
- Updated autodiscovery function to log new type (PR1623)
|
||||
- DB:
|
||||
- Added MySQLi support (PR1647)
|
||||
- Documentation:
|
||||
- Added docs on MySQL strict mode (PR1635)
|
||||
- Updated billing docs to use librenms user in cron (PR1676)
|
||||
- Updated LDAP docs to indicate php-ldap module needs installing (PR1716)
|
||||
- Alerting:
|
||||
- Reformatted eventlog message to show state for alerts (PR1685)
|
||||
- General:
|
||||
- Added more debugging and checks to discovery-protocols (PR1590)
|
||||
|
||||
### July 2015
|
||||
|
||||
#### Bug fixes
|
||||
|
||||
@@ -19,6 +19,22 @@ $config['log_dir'] = "/opt/librenms/logs";
|
||||
```
|
||||
Log files created by LibreNMS will be stored within this directory.
|
||||
|
||||
#### Database config
|
||||
|
||||
These are the configuration options you will need to use to specify to get started.
|
||||
|
||||
```php
|
||||
$config['db_host'] = "127.0.0.1";
|
||||
$config['db_user'] = "";
|
||||
$config['db_pass'] = "";
|
||||
$config['db_name'] = "";
|
||||
```
|
||||
|
||||
You can also select between the mysql and mysqli php extensions:
|
||||
|
||||
```php
|
||||
$config['db']['extension'] = 'mysqli';
|
||||
```
|
||||
|
||||
#### Progams
|
||||
|
||||
@@ -260,10 +276,6 @@ Please see [Billing](http://docs.librenms.org/Extensions/Billing-Module/) sectio
|
||||
|
||||
```php
|
||||
$config['enable_bgp'] = 1; # Enable BGP session collection and display
|
||||
$config['enable_rip'] = 1; # Enable RIP session collection and display
|
||||
$config['enable_ospf'] = 1; # Enable OSPF session collection and display
|
||||
$config['enable_isis'] = 1; # Enable ISIS session collection and display
|
||||
$config['enable_eigrp'] = 1; # Enable EIGRP session collection and display
|
||||
$config['enable_syslog'] = 0; # Enable Syslog
|
||||
$config['enable_inventory'] = 1; # Enable Inventory
|
||||
$config['enable_pseudowires'] = 1; # Enable Pseudowires
|
||||
|
||||
@@ -33,6 +33,8 @@ if ($type == 'placeholder') {
|
||||
}
|
||||
elseif (is_file('includes/common/'.$type.'.inc.php')) {
|
||||
|
||||
$results_limit = 10;
|
||||
$no_form = true;
|
||||
include 'includes/common/'.$type.'.inc.php';
|
||||
$output = implode('', $common_output);
|
||||
$status = 'ok';
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@ if (!$_SESSION['authenticated']) {
|
||||
}
|
||||
|
||||
if (preg_match('/^[a-zA-Z0-9\-]+$/', $_POST['type']) == 1) {
|
||||
if (file_exists('forms/'.$_POST['type'].'.inc.php')) {
|
||||
include_once 'forms/'.$_POST['type'].'.inc.php';
|
||||
if (file_exists('includes/forms/'.$_POST['type'].'.inc.php')) {
|
||||
include_once 'includes/forms/'.$_POST['type'].'.inc.php';
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ ul ul ul { list-style: square outside; }
|
||||
}
|
||||
|
||||
.submit {
|
||||
background-image: url('/images/submitbg.png');
|
||||
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAATCAIAAAA4QDsKAAAABGdBTUEAALGPC/xhBQAAAEZJREFUeJyVjMEJACEQA2dlSxD7r2/xcdhAfNwJig/PfJIhISaJocQk/9ccwTDAEYAQ4K99sylfXm+gtbFl1p4WNUouUaMDPUI2q6SigUIAAAAASUVORK5CYII=');
|
||||
background-position: 0 100%;
|
||||
border-color: #B2B2B2 #525252 #525252 #B2B2B2;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ if ($vars['page'] == 'logout' && $_SESSION['authenticated']) {
|
||||
setcookie('auth', '', (time() - 60 * 60 * 24 * $config['auth_remember']), '/');
|
||||
session_destroy();
|
||||
$auth_message = 'Logged Out';
|
||||
header('Location: /');
|
||||
header('Location: ' . $config['base_url']);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ var alerts_grid = $("#alerts").bootgrid({
|
||||
device_id: \'' . $device['device_id'] .'\'
|
||||
};
|
||||
},
|
||||
url: "/ajax_table.php",
|
||||
url: "ajax_table.php",
|
||||
formatters: {
|
||||
"status": function(column,row) {
|
||||
return "<h4><span class=\'label label-"+row.extra+" threeqtr-width\'>" + row.msg + "</span></h4>";
|
||||
@@ -70,7 +70,7 @@ var alerts_grid = $("#alerts").bootgrid({
|
||||
var state = $(this).data("state");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/ajax_form.php",
|
||||
url: "ajax_form.php",
|
||||
data: { type: "ack-alert", alert_id: alert_id, state: state },
|
||||
success: function(msg){
|
||||
$("#message").html(\'<div class="alert alert-info">\'+msg+\'</div>\');
|
||||
|
||||
@@ -42,7 +42,7 @@ foreach(dbFetchRows($sql, $param) as $device) {
|
||||
$temp_output[] = '<a href="' . generate_url(array(
|
||||
'page' => 'device',
|
||||
'device' => $device['device_id']
|
||||
)) . '" role="button" class="btn ' . $btn_type . ' btn-xs" title="' . $device['hostname'] . '" style="min-height:25px; min-width:25px; border-radius:0px; border:0px; margin:0; padding:0;"></a>';
|
||||
)) . '" role="button" class="btn ' . $btn_type . ' btn-xs" title="' . $device['hostname'] . '" style="min-height:25px; min-width:25px; border-radius:0px; margin:0; padding:0;"></a>';
|
||||
}
|
||||
|
||||
$temp_rows = count($temp_output);
|
||||
|
||||
@@ -24,7 +24,7 @@ var eventlog_grid = $("#eventlog").bootgrid({
|
||||
type: "' .mres($vars['type']) .'",
|
||||
};
|
||||
},
|
||||
url: "/ajax_table.php"
|
||||
url: "ajax_table.php"
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if (empty($results_limit)) {
|
||||
$results_limit = 25;
|
||||
}
|
||||
$tmp_output = '<h3>Graylog</h3>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table id="graylog" class="table table-hover table-condensed graylog">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="timestamp">Timestamp</th>
|
||||
<th data-column-id="source">Source</th>
|
||||
<th data-column-id="message">Message</th>
|
||||
<th data-column-id="facility" data-visible="false">Facility</th>
|
||||
<th data-column-id="level" data-visible="false">Level</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
searchbar = "<div id=\"{{ctx.id}}\" class=\"{{css.header}}\"><div class=\"row\">"+
|
||||
"<div class=\"col-sm-8\"><form method=\"post\" action=\"\" class=\"form-inline\">"+
|
||||
"Filter: "+
|
||||
';
|
||||
|
||||
if (!empty($filter_device)) {
|
||||
$tmp_output .= '
|
||||
"<input type=\"hidden\" name=\"hostname\" id=\"hostname\" value=\"'. $filter_device .'\">"+
|
||||
';
|
||||
}
|
||||
else {
|
||||
$tmp_output .= '
|
||||
"<div class=\"form-group\"><select name=\"hostname\" id=\"hostname\" class=\"form-control input-sm\">"+
|
||||
"<option value=\"\">All devices</option>"+
|
||||
';
|
||||
|
||||
if (is_admin() === true || is_read() === true) {
|
||||
$results = dbFetchRows("SELECT `hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`");
|
||||
}
|
||||
else {
|
||||
$results = dbFetchRows("SELECT `D`.`hostname` FROM `devices` AS `D`, `devices_perms` AS `P` WHERE `P`.`user_id` = ? AND `P`.`device_id` = `D`.`device_id` GROUP BY `hostname` ORDER BY `hostname`", array($_SESSION['user_id']));
|
||||
}
|
||||
|
||||
foreach ($results as $data) {
|
||||
$tmp_output .= '"<option value=\"'.$data['hostname'].'\""+';
|
||||
if ($data['hostname'] == $vars['hostname']) {
|
||||
$tmp_output .= '"selected"+';
|
||||
}
|
||||
$tmp_output .= '">'.$data['hostname'].'</option>"+';
|
||||
}
|
||||
|
||||
$tmp_output .= '
|
||||
"</select> </div>"+
|
||||
';
|
||||
|
||||
}
|
||||
|
||||
if (empty($filter_device)) {
|
||||
$filter_device = mres($_POST['hostname']);
|
||||
}
|
||||
|
||||
$tmp_output .= '
|
||||
"<div class=\"form-group\"><select name=\"range\" class=\"form-group input-sm\">"+
|
||||
"<option value=\"300\">Search last 5 minutes</option>"+
|
||||
"<option value=\"900\">Search last 15 minutes</option>"+
|
||||
"<option value=\"1800\">Search last 30 minutes</option>"+
|
||||
"<option value=\"3600\">Search last 1 hour</option>"+
|
||||
"<option value=\"7200\">Search last 2 hours</option>"+
|
||||
"<option value=\"28800\">Search last 8 hours</option>"+
|
||||
"<option value=\"86400\">Search last 1 day</option>"+
|
||||
"<option value=\"172800\">Search last 2 days</option>"+
|
||||
"<option value=\"432000\">Search last 5 days</option>"+
|
||||
"<option value=\"604800\">Search last 7 days</option>"+
|
||||
"<option value=\"1209600\">Search last 14 days</option>"+
|
||||
"<option value=\"2592000\">Search last 30 days</option>"+
|
||||
"<option value=\"0\">Search all time</option>"+
|
||||
"</select> </div>"+
|
||||
"<button type=\"submit\" class=\"btn btn-success btn-sm\">Filter</button> "+
|
||||
"</form></div>"+
|
||||
"<div class=\"col-sm-4 actionBar\"><p class=\"{{css.search}}\"></p><p class=\"{{css.actions}}\"></p></div></div></div>"
|
||||
|
||||
var graylog_grid = $("#graylog").bootgrid({
|
||||
ajax: true,
|
||||
rowCount: ['. $results_limit .', 25,50,100,250,-1],
|
||||
';
|
||||
|
||||
if ($no_form !== true) {
|
||||
$tmp_output .= '
|
||||
templates: {
|
||||
header: searchbar
|
||||
},
|
||||
';
|
||||
}
|
||||
|
||||
$tmp_output .= '
|
||||
post: function ()
|
||||
{
|
||||
return {
|
||||
id: "graylog",
|
||||
hostname: "' . $filter_device . '",
|
||||
range: "' . mres($_POST['range']) . '"
|
||||
};
|
||||
},
|
||||
url: "/ajax_table.php",
|
||||
});
|
||||
</script>
|
||||
|
||||
';
|
||||
|
||||
$common_output[] = $tmp_output;
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
$sql = "SELECT *, DATE_FORMAT(timestamp, '".$config['dateformat']['mysql']['compact']."') AS date from syslog ORDER BY timestamp DESC LIMIT 20";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
$syslog_output = '
|
||||
<div class="container-fluid">
|
||||
|
||||
@@ -12,4 +12,8 @@
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if(is_admin() === false) {
|
||||
die('ERROR: You need to be admin');
|
||||
}
|
||||
|
||||
dbUpdate(array('value' => '2'), 'callback', '`name` = "enabled"', array());
|
||||
+4
@@ -12,6 +12,10 @@
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if(is_admin() === false) {
|
||||
die('ERROR: You need to be admin');
|
||||
}
|
||||
|
||||
if ($_POST['state'] == 'true') {
|
||||
$state = 1;
|
||||
}
|
||||
+5
@@ -13,6 +13,11 @@
|
||||
*/
|
||||
|
||||
// FUA
|
||||
|
||||
if(is_admin() === false) {
|
||||
die('ERROR: You need to be admin');
|
||||
}
|
||||
|
||||
if (!is_numeric($_POST['config_id'])) {
|
||||
echo 'error with data';
|
||||
exit;
|
||||
@@ -13,6 +13,11 @@
|
||||
*/
|
||||
|
||||
// FUA
|
||||
|
||||
if(is_admin() === false) {
|
||||
die('ERROR: You need to be admin');
|
||||
}
|
||||
|
||||
if (!is_numeric($_POST['config_id']) || empty($_POST['data'])) {
|
||||
echo 'error with data';
|
||||
exit;
|
||||
+5
@@ -1,6 +1,11 @@
|
||||
<?php
|
||||
|
||||
// FUA
|
||||
|
||||
if(is_admin() === false) {
|
||||
die('ERROR: You need to be admin');
|
||||
}
|
||||
|
||||
$device['device_id'] = $_POST['device_id'];
|
||||
$module = 'discover_'.$_POST['discovery_module'];
|
||||
|
||||
@@ -13,6 +13,11 @@
|
||||
*/
|
||||
|
||||
// FUA
|
||||
|
||||
if(is_admin() === false) {
|
||||
die('ERROR: You need to be admin');
|
||||
}
|
||||
|
||||
if (!is_numeric($_POST['device_id']) || !is_numeric($_POST['sensor_id']) || (empty($_POST['data']) || !isset($_POST['data']))) {
|
||||
echo 'error with data';
|
||||
exit;
|
||||
+4
@@ -12,6 +12,10 @@
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if(is_admin() === false) {
|
||||
die('ERROR: You need to be admin');
|
||||
}
|
||||
|
||||
if (!is_numeric($_POST['group_id'])) {
|
||||
echo 'error with data';
|
||||
exit;
|
||||
+4
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
if(is_admin() === false) {
|
||||
die('ERROR: You need to be admin');
|
||||
}
|
||||
|
||||
// FUA
|
||||
$device['device_id'] = $_POST['device_id'];
|
||||
$module = 'poll_'.$_POST['poller_module'];
|
||||
@@ -12,6 +12,15 @@
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if (is_admin() === false) {
|
||||
$response = array(
|
||||
'status' => 'error',
|
||||
'message' => 'Need to be admin',
|
||||
);
|
||||
echo _json_encode($response);
|
||||
exit;
|
||||
}
|
||||
|
||||
// FIXME: Make this part of the API instead of a standalone function
|
||||
if (!is_numeric($_POST['device_id'])) {
|
||||
$status = 'error';
|
||||
@@ -13,6 +13,11 @@
|
||||
*/
|
||||
|
||||
// FUA
|
||||
|
||||
if(is_admin() === false) {
|
||||
die('ERROR: You need to be admin');
|
||||
}
|
||||
|
||||
for ($x = 0; $x < count($_POST['sensor_id']); $x++) {
|
||||
dbUpdate(array('sensor_limit' => $_POST['sensor_limit'][$x], 'sensor_limit_low' => $_POST['sensor_limit_low'][$x], 'sensor_alert' => $_POST['sensor_alert'][$x]), 'sensors', '`sensor_id` = ?', array($_POST['sensor_id'][$x]));
|
||||
}
|
||||
+5
@@ -13,6 +13,11 @@
|
||||
*/
|
||||
|
||||
// FUA
|
||||
|
||||
if(is_admin() === false) {
|
||||
die('ERROR: You need to be admin');
|
||||
}
|
||||
|
||||
if (isset($_POST['sub_type']) && !empty($_POST['sub_type'])) {
|
||||
dbUpdate(array('sensor_custom' => 'No'), 'sensors', '`sensor_id` = ?', array($_POST['sensor_id']));
|
||||
}
|
||||
@@ -12,6 +12,15 @@
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if (is_admin() === false) {
|
||||
$response = array(
|
||||
'status' => 'error',
|
||||
'message' => 'Need to be admin',
|
||||
);
|
||||
echo _json_encode($response);
|
||||
exit;
|
||||
}
|
||||
|
||||
$status = 'error';
|
||||
$message = 'Error updating storage information';
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if (is_admin() === false) {
|
||||
die('ERROR: You need to be admin');
|
||||
}
|
||||
|
||||
$transport = mres($_POST['transport']);
|
||||
|
||||
$obj = array(
|
||||
'contacts' => $config['alert']['default_mail'],
|
||||
'title' => 'Testing transport from ' . $config['project_name'],
|
||||
'msg' => 'This is a test alert',
|
||||
'severity' => 'critical',
|
||||
'state' => 'critical',
|
||||
'hostname' => 'testing',
|
||||
'name' => 'Testing rule',
|
||||
);
|
||||
|
||||
unset($obj);
|
||||
$obj['contacts'] = 'test';
|
||||
$obj['title'] = 'test';
|
||||
$obj['msg'] = 'test';
|
||||
$obj['severity'] = 'test';
|
||||
$obj['state'] = 'test';
|
||||
$obj['hostname'] = 'test';
|
||||
$obj['name'] = 'test';
|
||||
|
||||
$status = 'error';
|
||||
|
||||
if (file_exists($config['install_dir']."/includes/alerts/transport.$transport.php")) {
|
||||
$opts = $config['alert']['transports'][$transport];
|
||||
if ($opts) {
|
||||
eval('$tmp = function($obj,$opts) { global $config; '.file_get_contents($config['install_dir'].'/includes/alerts/transport.'.$transport.'.php').' };');
|
||||
$tmp = $tmp($obj,$opts);
|
||||
if ($tmp) {
|
||||
$status = 'ok';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo _json_encode(array('status' => $status));
|
||||
@@ -12,6 +12,10 @@
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if(is_admin() === false) {
|
||||
die('ERROR: You need to be admin');
|
||||
}
|
||||
|
||||
if (!is_numeric($_POST['user_id']) || !isset($_POST['token'])) {
|
||||
echo 'ERROR: error with data, please ensure a valid user and token have been specified.';
|
||||
exit;
|
||||
@@ -12,6 +12,10 @@
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if(is_admin() === false) {
|
||||
die('ERROR: You need to be admin');
|
||||
}
|
||||
|
||||
if (!is_numeric($_POST['token_id'])) {
|
||||
echo 'error with data';
|
||||
exit;
|
||||
@@ -12,6 +12,10 @@
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if(is_admin() === false) {
|
||||
die('ERROR: You need to be admin');
|
||||
}
|
||||
|
||||
if (!is_numeric($_POST['token_id'])) {
|
||||
echo 'error with data';
|
||||
exit;
|
||||
@@ -1,5 +1,14 @@
|
||||
<?php
|
||||
|
||||
if (is_admin() === false) {
|
||||
$response = array(
|
||||
'status' => 'error',
|
||||
'message' => 'Need to be admin',
|
||||
);
|
||||
echo _json_encode($response);
|
||||
exit;
|
||||
}
|
||||
|
||||
$status = 'error';
|
||||
$message = 'Error with config';
|
||||
|
||||
@@ -15,7 +15,7 @@ else {
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
$rrd_options .= " COMMENT:'$units_descr Current Average Maximum'";
|
||||
$rrd_options .= " COMMENT:'$units_descr Now Avg Max'";
|
||||
if (!$nototal) {
|
||||
$rrd_options .= " COMMENT:'Total'";
|
||||
}
|
||||
@@ -74,7 +74,7 @@ foreach ($rrd_list as $rrd) {
|
||||
$stack = 'STACK';
|
||||
}
|
||||
|
||||
$rrd_options .= ' AREA:inbits'.$i.'#'.$colour_in.":'".rrdtool_escape($rrd['descr'], 10)."In ':$stack";
|
||||
$rrd_options .= ' AREA:inbits'.$i.'#'.$colour_in.":'".rrdtool_escape($rrd['descr'], 9)."In ':$stack";
|
||||
$rrd_options .= ' GPRINT:inbits'.$i.':LAST:%6.2lf%s';
|
||||
$rrd_options .= ' GPRINT:inbits'.$i.':AVERAGE:%6.2lf%s';
|
||||
$rrd_options .= ' GPRINT:inbits'.$i.':MAX:%6.2lf%s';
|
||||
@@ -85,7 +85,7 @@ foreach ($rrd_list as $rrd) {
|
||||
|
||||
$rrd_options .= " COMMENT:'\\n'";
|
||||
$rrd_optionsb .= ' AREA:outbits'.$i.'_neg#'.$colour_out."::$stack";
|
||||
$rrd_options .= ' HRULE:999999999999999#'.$colour_out.":'".str_pad('', 11)."Out':";
|
||||
$rrd_options .= ' HRULE:999999999999999#'.$colour_out.":'".str_pad('', 10)."Out':";
|
||||
$rrd_options .= ' GPRINT:outbits'.$i.':LAST:%6.2lf%s';
|
||||
$rrd_options .= ' GPRINT:outbits'.$i.':AVERAGE:%6.2lf%s';
|
||||
$rrd_options .= ' GPRINT:outbits'.$i.':MAX:%6.2lf%s';
|
||||
@@ -141,21 +141,21 @@ if (!$args['nototal']) {
|
||||
|
||||
$rrd_options .= " COMMENT:' \\n'";
|
||||
|
||||
$rrd_options .= " HRULE:999999999999999#FFFFFF:'".str_pad('Total', 11)."In ':";
|
||||
$rrd_options .= " HRULE:999999999999999#FFFFFF:'".str_pad('Total', 10)."In ':";
|
||||
$rrd_options .= ' GPRINT:inbits:LAST:%6.2lf%s';
|
||||
$rrd_options .= ' GPRINT:inbits:AVERAGE:%6.2lf%s';
|
||||
$rrd_options .= ' GPRINT:inbits:MAX:%6.2lf%s';
|
||||
$rrd_options .= " GPRINT:totin:%6.2lf%s$total_units";
|
||||
$rrd_options .= " COMMENT:'\\n'";
|
||||
|
||||
$rrd_options .= " HRULE:999999999999990#FFFFFF:'".str_pad('', 11)."Out':";
|
||||
$rrd_options .= " HRULE:999999999999990#FFFFFF:'".str_pad('', 10)."Out':";
|
||||
$rrd_options .= ' GPRINT:outbits:LAST:%6.2lf%s';
|
||||
$rrd_options .= ' GPRINT:outbits:AVERAGE:%6.2lf%s';
|
||||
$rrd_options .= ' GPRINT:outbits:MAX:%6.2lf%s';
|
||||
$rrd_options .= " GPRINT:totout:%6.2lf%s$total_units";
|
||||
$rrd_options .= " COMMENT:'\\n'";
|
||||
|
||||
$rrd_options .= " HRULE:999999999999990#FFFFFF:'".str_pad('', 11)."Agg':";
|
||||
$rrd_options .= " HRULE:999999999999990#FFFFFF:'".str_pad('', 10)."Agg':";
|
||||
$rrd_options .= ' GPRINT:bits:LAST:%6.2lf%s';
|
||||
$rrd_options .= ' GPRINT:bits:AVERAGE:%6.2lf%s';
|
||||
$rrd_options .= ' GPRINT:bits:MAX:%6.2lf%s';
|
||||
|
||||
@@ -26,7 +26,7 @@ if (1) {
|
||||
$rrd_list[4]['colour_area_out'] = 'c0a060';
|
||||
|
||||
$units = '';
|
||||
$units_descr = 'Packets/sec';
|
||||
$units_descr = 'Packets';
|
||||
$total_units = 'B';
|
||||
$colours_in = 'purples';
|
||||
$multiplier = '1';
|
||||
|
||||
@@ -102,7 +102,7 @@ $('#schedule-maintenance').on('show.bs.modal', function (event) {
|
||||
if (schedule_id > 0) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/ajax_form.php",
|
||||
url: "ajax_form.php",
|
||||
data: { type: "schedule-maintenance", sub_type: "parse-maintenance", schedule_id: schedule_id },
|
||||
dataType: "json",
|
||||
success: function(output) {
|
||||
@@ -124,7 +124,7 @@ $('#sched-submit').click('', function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/ajax_form.php",
|
||||
url: "ajax_form.php",
|
||||
data: $('form.schedule-maintenance-form').serialize(),
|
||||
dataType: "json",
|
||||
success: function(data){
|
||||
|
||||
@@ -107,7 +107,7 @@ $('#alert-template').on('show.bs.modal', function (event) {
|
||||
$('#template_id').val(template_id);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/ajax_form.php",
|
||||
url: "ajax_form.php",
|
||||
data: { type: "parse-alert-template", template_id: template_id },
|
||||
dataType: "json",
|
||||
success: function(output) {
|
||||
@@ -125,7 +125,7 @@ $('#create-template').click('', function(e) {
|
||||
var name = $("#name").val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/ajax_form.php",
|
||||
url: "ajax_form.php",
|
||||
data: { type: "alert-templates", template: template , name: name, template_id: template_id},
|
||||
dataType: "html",
|
||||
success: function(msg){
|
||||
|
||||
@@ -60,7 +60,7 @@ $('#attach-alert-template').on('show.bs.modal', function(e) {
|
||||
$("#template_id").val(template_id);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/ajax_form.php",
|
||||
url: "ajax_form.php",
|
||||
data: { type: "parse-template-rules", template_id: template_id },
|
||||
dataType: "json",
|
||||
success: function(output) {
|
||||
@@ -88,7 +88,7 @@ $('#alert-template-attach').click('', function(event) {
|
||||
var rules = items.join(',');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/ajax_form.php',
|
||||
url: 'ajax_form.php',
|
||||
data: { type: "attach-alert-template", template_id: template_id, rule_id: rules },
|
||||
dataType: "html",
|
||||
success: function(msg) {
|
||||
|
||||
@@ -50,7 +50,7 @@ $('#alert-map-removal').click('', function(event) {
|
||||
var map_id = $("#map_id").val();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/ajax_form.php',
|
||||
url: 'ajax_form.php',
|
||||
data: { type: "delete-alert-map", map_id: map_id },
|
||||
dataType: "html",
|
||||
success: function(msg) {
|
||||
|
||||
@@ -50,7 +50,7 @@ $('#alert-rule-removal').click('', function(event) {
|
||||
var alert_id = $("#alert_id").val();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/ajax_form.php',
|
||||
url: 'ajax_form.php',
|
||||
data: { type: "delete-alert-rule", alert_id: alert_id },
|
||||
dataType: "html",
|
||||
success: function(msg) {
|
||||
|
||||
@@ -50,7 +50,7 @@ $('#alert-template-removal').click('', function(event) {
|
||||
var template_id = $("#template_id").val();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/ajax_form.php',
|
||||
url: 'ajax_form.php',
|
||||
data: { type: "delete-alert-template", template_id: template_id },
|
||||
dataType: "html",
|
||||
success: function(msg) {
|
||||
|
||||
@@ -50,7 +50,7 @@ $('#device-group-removal').click('', function(event) {
|
||||
var group_id = $("#group_id").val();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/ajax_form.php',
|
||||
url: 'ajax_form.php',
|
||||
data: { type: "delete-device-group", group_id: group_id },
|
||||
dataType: "html",
|
||||
success: function(msg) {
|
||||
|
||||
@@ -57,7 +57,7 @@ $('#create-map').on('show.bs.modal', function (event) {
|
||||
$('#map_id').val(map_id);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/ajax_form.php",
|
||||
url: "ajax_form.php",
|
||||
data: { type: "parse-alert-map", map_id: map_id },
|
||||
dataType: "json",
|
||||
success: function(output) {
|
||||
@@ -166,7 +166,7 @@ $('#map-submit').click('', function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/ajax_form.php",
|
||||
url: "ajax_form.php",
|
||||
data: $('form.maps-form').serialize(),
|
||||
success: function(msg){
|
||||
$("#message").html('<div class="alert alert-info">'+msg+'</div>');
|
||||
|
||||
@@ -184,7 +184,7 @@ $('#create-alert').on('show.bs.modal', function (event) {
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/ajax_form.php",
|
||||
url: "ajax_form.php",
|
||||
data: { type: "parse-alert-rule", alert_id: alert_id },
|
||||
dataType: "json",
|
||||
success: function(output) {
|
||||
@@ -347,7 +347,7 @@ $('#rule-submit').click('', function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/ajax_form.php",
|
||||
url: "ajax_form.php",
|
||||
data: $('form.alerts-form').serialize(),
|
||||
success: function(msg){
|
||||
if(msg.indexOf("ERROR:") <= -1) {
|
||||
|
||||
@@ -119,7 +119,7 @@ $('#create-group').on('show.bs.modal', function (event) {
|
||||
});
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/ajax_form.php",
|
||||
url: "ajax_form.php",
|
||||
data: { type: "parse-device-group", group_id: group_id },
|
||||
dataType: "json",
|
||||
success: function(output) {
|
||||
@@ -192,7 +192,7 @@ $('#group-submit').click('', function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/ajax_form.php",
|
||||
url: "ajax_form.php",
|
||||
data: $('form.group-form').serialize(),
|
||||
success: function(msg){
|
||||
if(msg.indexOf("ERROR:") <= -1) {
|
||||
|
||||
@@ -93,7 +93,7 @@ $('#group-removal').click('', function(e) {
|
||||
group_id = $("#group_id").val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/ajax_form.php",
|
||||
url: "ajax_form.php",
|
||||
data: $('form.remove_group_form').serialize() ,
|
||||
success: function(msg) {
|
||||
$("#thanks").html('<div class="alert alert-info">'+msg+'</div>');
|
||||
@@ -115,7 +115,7 @@ $('#poller-groups').on('show.bs.modal', function (event) {
|
||||
$('#group_id').val(group_id);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/ajax_form.php",
|
||||
url: "ajax_form.php",
|
||||
data: { type: "parse-poller-groups", group_id: group_id },
|
||||
dataType: "json",
|
||||
success: function(output) {
|
||||
@@ -133,7 +133,7 @@ $('#create-group').click('', function(e) {
|
||||
var group_id = $('#group_id').val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/ajax_form.php",
|
||||
url: "ajax_form.php",
|
||||
data: { type: "poller-groups", group_name: group_name, descr: descr, group_id: group_id },
|
||||
dataType: "html",
|
||||
success: function(msg){
|
||||
|
||||
@@ -52,7 +52,7 @@ $('#sched-maintenance-removal').click('', function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/ajax_form.php",
|
||||
url: "ajax_form.php",
|
||||
data: $('form.schedule-maintenance-del').serialize(),
|
||||
dataType: "json",
|
||||
success: function(data){
|
||||
|
||||
@@ -268,7 +268,7 @@ $('#ack-alert').click('', function(e) {
|
||||
var alert_id = $(this).data("alert_id");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/ajax_form.php",
|
||||
url: "ajax_form.php",
|
||||
data: { type: "ack-alert", alert_id: alert_id },
|
||||
success: function(msg){
|
||||
$("#message").html('<div class="alert alert-info">'+msg+'</div>');
|
||||
@@ -294,7 +294,7 @@ $('input[name="alert-rule"]').on('switchChange.bootstrapSwitch', function(event
|
||||
var orig_class = $(this).data("orig_class");
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/ajax_form.php',
|
||||
url: 'ajax_form.php',
|
||||
data: { type: "update-alert-rule", alert_id: alert_id, state: state },
|
||||
dataType: "html",
|
||||
success: function(msg) {
|
||||
|
||||
@@ -30,7 +30,7 @@ else {
|
||||
}
|
||||
|
||||
if (dbFetchCell('SELECT COUNT(*) FROM `mac_accounting` WHERE `port_id` = ?', array($port['port_id']))) {
|
||||
$mac = "<a href='".generate_port_url($port, array('view' => 'macaccounting'))."'><img src='/images/16/chart_curve.png' align='absmiddle'></a>";
|
||||
$mac = "<a href='".generate_port_url($port, array('view' => 'macaccounting'))."'><img src='images/16/chart_curve.png' align='absmiddle'></a>";
|
||||
}
|
||||
else {
|
||||
$mac = '';
|
||||
|
||||
@@ -77,9 +77,17 @@ if ($_SESSION['userlevel'] >= '10') {
|
||||
</li>
|
||||
<li role="presentation" class="divider"></li>
|
||||
<li><a href="<?php echo(generate_url(array('page'=>'eventlog'))); ?>"><i class="fa fa-book fa-fw fa-lg"></i> Eventlog</a></li>
|
||||
<?php if (isset($config['enable_syslog']) && $config['enable_syslog']) {
|
||||
echo(' <li><a href="'.generate_url(array('page'=>'syslog')).'"><i class="fa fa-book fa-fw fa-lg"></i> Syslog</a></li>');
|
||||
} ?>
|
||||
<?php
|
||||
|
||||
if (isset($config['enable_syslog']) && $config['enable_syslog']) {
|
||||
echo ' <li><a href="'.generate_url(array('page'=>'syslog')).'"><i class="fa fa-book fa-fw fa-lg"></i> Syslog</a></li>';
|
||||
}
|
||||
|
||||
if (isset($config['graylog']['server']) && isset($config['graylog']['port'])) {
|
||||
echo ' <li><a href="'.generate_url(array('page'=>'graylog')).'"><i class="fa fa-book fa-fw fa-lg"></i> Graylog</a></li>';
|
||||
}
|
||||
|
||||
?>
|
||||
<li><a href="<?php echo(generate_url(array('page'=>'inventory'))); ?>"><i class="fa fa-cube fa-fw fa-lg"></i> Inventory</a></li>
|
||||
<li role="presentation" class="divider"></li>
|
||||
<li role="presentation" class="dropdown-header"> Search</li>
|
||||
@@ -489,12 +497,12 @@ if ($_SESSION['userlevel'] >= '10') {
|
||||
<li class="dropdown-submenu">
|
||||
<a href="#"><i class="fa fa-clock-o fa-fw fa-lg"></i> Pollers</a>
|
||||
<ul class="dropdown-menu scrollable-menu">
|
||||
<li><a href="/poll-log/"><i class="fa fa-exclamation fa-fw fa-lg"></i> Poll-log</a></li>');
|
||||
<li><a href="poll-log/"><i class="fa fa-exclamation fa-fw fa-lg"></i> Poll-log</a></li>');
|
||||
|
||||
if($config['distributed_poller'] === TRUE) {
|
||||
echo ('
|
||||
<li><a href="/pollers/tab=pollers/"><i class="fa fa-clock-o fa-fw fa-lg"></i> Pollers</a></li>
|
||||
<li><a href="/pollers/tab=groups/"><i class="fa fa-gears fa-fw fa-lg"></i> Groups</a></li>');
|
||||
<li><a href="pollers/tab=pollers/"><i class="fa fa-clock-o fa-fw fa-lg"></i> Pollers</a></li>
|
||||
<li><a href="pollers/tab=groups/"><i class="fa fa-gears fa-fw fa-lg"></i> Groups</a></li>');
|
||||
}
|
||||
echo ('
|
||||
</ul>
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
if (!is_array($config['customers_descr'])) {
|
||||
$config['customers_descr'] = array($config['customers_descr']);
|
||||
}
|
||||
|
||||
$descr_type = "'".implode("', '", $config['customers_descr'])."'";
|
||||
|
||||
$i = 0;
|
||||
|
||||
$sql = ' FROM `ports` LEFT JOIN `devices` AS `D` ON `ports`.`device_id` = `D`.`device_id` WHERE `port_descr_type` IN (?)';
|
||||
$param[] = array($descr_type);
|
||||
if (isset($searchPhrase) && !empty($searchPhrase)) {
|
||||
$sql .= " AND (`port_descr_descr` LIKE '%$searchPhrase%' OR `ifName` LIKE '%$searchPhrase%' OR `ifDescr` LIKE '%$searchPhrase%' OR `ifAlias` LIKE '%$searchPhrase%' OR `D`.`hostname` LIKE '%$searchPhrase%' OR `port_descr_speed` LIKE '%$searchPhrase%' OR `port_descr_notes` LIKE '%$searchPhrase%')";
|
||||
}
|
||||
|
||||
$count_sql = "SELECT COUNT(DISTINCT(`port_descr_descr`)) $sql";
|
||||
|
||||
$sql .= ' GROUP BY `port_descr_descr`';
|
||||
|
||||
$total = dbFetchCell($count_sql,$param);
|
||||
if (empty($total)) {
|
||||
$total = 0;
|
||||
}
|
||||
|
||||
if (!isset($sort) || empty($sort)) {
|
||||
$sort = '`port_descr_descr`';
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY $sort";
|
||||
|
||||
if (isset($current)) {
|
||||
$limit_low = ($current * $rowCount) - ($rowCount);
|
||||
$limit_high = $rowCount;
|
||||
}
|
||||
|
||||
if ($rowCount != -1) {
|
||||
$sql .= " LIMIT $limit_low,$limit_high";
|
||||
}
|
||||
|
||||
$sql = "SELECT * $sql";
|
||||
|
||||
foreach (dbFetchRows($sql, $param) as $customer) {
|
||||
$i++;
|
||||
|
||||
$customer_name = $customer['port_descr_descr'];
|
||||
|
||||
foreach (dbFetchRows('SELECT * FROM `ports` WHERE `port_descr_type` IN (?) AND `port_descr_descr` = ?', array(array($descr_type), $customer['port_descr_descr'])) as $port) {
|
||||
$device = device_by_id_cache($port['device_id']);
|
||||
|
||||
$ifname = fixifname($device['ifDescr']);
|
||||
$ifclass = ifclass($port['ifOperStatus'], $port['ifAdminStatus']);
|
||||
|
||||
if ($device['os'] == 'ios') {
|
||||
if ($port['ifTrunk']) {
|
||||
$vlan = '<span class=box-desc><span class=red>'.$port['ifTrunk'].'</span></span>';
|
||||
}
|
||||
else if ($port['ifVlan']) {
|
||||
$vlan = '<span class=box-desc><span class=blue>VLAN '.$port['ifVlan'].'</span></span>';
|
||||
}
|
||||
else {
|
||||
$vlan = '';
|
||||
}
|
||||
}
|
||||
|
||||
$response[] = array(
|
||||
'port_descr_descr' => $customer_name,
|
||||
'device_id' => generate_device_link($device),
|
||||
'ifDescr' => generate_port_link($port, makeshortif($port['ifDescr'])),
|
||||
'port_descr_speed' => $port['port_descr_speed'],
|
||||
'port_descr_circuit' => $port['port_descr_circuit'],
|
||||
'port_descr_notes' => $port['port_descr_notes'],
|
||||
|
||||
);
|
||||
|
||||
unset($customer_name);
|
||||
}
|
||||
|
||||
|
||||
$graph_array['type'] = 'customer_bits';
|
||||
$graph_array['height'] = '100';
|
||||
$graph_array['width'] = '220';
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $customer['port_descr_descr'];
|
||||
|
||||
$return_data = true;
|
||||
include 'includes/print-graphrow.inc.php';
|
||||
$response[] = array(
|
||||
'port_descr_descr' => $graph_data[0],
|
||||
'device_id' => $graph_data[1],
|
||||
'ifDescr' => '',
|
||||
'port_descr_speed' => '',
|
||||
'port_descr_circuit' => $graph_data[2],
|
||||
'port_descr_notes' => $graph_data[3],
|
||||
);
|
||||
}
|
||||
|
||||
$output = array(
|
||||
'current' => $current,
|
||||
'rowCount' => $rowCount,
|
||||
'rows' => $response,
|
||||
'total' => $total,
|
||||
);
|
||||
|
||||
echo _json_encode($output);
|
||||
@@ -79,8 +79,7 @@ if (!empty($_POST['location']) && $_POST['location'] == 'Unset') {
|
||||
|
||||
if (!empty($_POST['location'])) {
|
||||
$sql .= " AND `location` = ?";
|
||||
$param[] = mres($_POST['location']);
|
||||
$param[] = mres($_POST['location']);
|
||||
$param[] = $_POST['location'];
|
||||
}
|
||||
|
||||
if (!empty($_POST['group'])) {
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
$filter_hostname = mres($_POST['hostname']);
|
||||
$filter_range = mres($_POST['range']);
|
||||
|
||||
if (isset($searchPhrase) && !empty($searchPhrase)) {
|
||||
$query = 'message:"'.$searchPhrase.'"';
|
||||
}
|
||||
else {
|
||||
$query = '*';
|
||||
}
|
||||
|
||||
if (isset($current)) {
|
||||
$offset = ($current * $rowCount) - ($rowCount);
|
||||
$limit = $rowCount;
|
||||
}
|
||||
|
||||
if ($rowCount != -1) {
|
||||
$extra_query = "&limit=$limit&offset=$offset";
|
||||
}
|
||||
|
||||
if (!empty($filter_hostname)) {
|
||||
if (!empty($query)) {
|
||||
$query .= ' && ';
|
||||
}
|
||||
$ip = gethostbyname($filter_hostname);
|
||||
$query .= 'source:"'.$filter_hostname.'" || source:"'.$ip.'"';
|
||||
}
|
||||
|
||||
$graylog_url = $config['graylog']['server'] . ':' . $config['graylog']['port'] . '/search/universal/relative?query=' . urlencode($query) . '&range='. $filter_range . $extra_query;
|
||||
|
||||
$context = stream_context_create(array(
|
||||
'http' => array(
|
||||
'header' => "Authorization: Basic " . base64_encode($config['graylog']['username'].':'.$config['graylog']['password']) . "\r\n" .
|
||||
"Accept: application/json",
|
||||
)
|
||||
));
|
||||
|
||||
$messages = json_decode(file_get_contents($graylog_url, false, $context),true);
|
||||
|
||||
foreach ($messages['messages'] as $message) {
|
||||
$response[] = array(
|
||||
'timestamp' => $message['message']['timestamp'],
|
||||
'source' => '<a href="'.generate_url(array('page'=>'device', 'device'=>$message['message']['source'])).'">'.$message['message']['source'].'</a>',
|
||||
'message' => $message['message']['message'],
|
||||
'facility' => $message['message']['facility'],
|
||||
'level' => $message['message']['level'],
|
||||
);
|
||||
}
|
||||
|
||||
if (empty($messages['total_results'])) {
|
||||
$total = 0;
|
||||
}
|
||||
else {
|
||||
$total = $messages['total_results'];
|
||||
}
|
||||
|
||||
$output = array('current'=>$current,'rowCount'=>$rowCount,'rows'=>$response,'total'=>$total);
|
||||
echo _json_encode($output);
|
||||
@@ -11,7 +11,14 @@ foreach ($_GET as $key => $get_var) {
|
||||
}
|
||||
}
|
||||
|
||||
$segments = explode('/', trim($_SERVER['REQUEST_URI'], '/'));
|
||||
$base_url = parse_url($config["base_url"]);
|
||||
// don't parse the subdirectory, if there is one in the path
|
||||
if (strlen($base_url["path"]) > 1) {
|
||||
$segments = explode('/', trim(str_replace($base_url["path"], "", $_SERVER['REQUEST_URI']), '/'));
|
||||
}
|
||||
else {
|
||||
$segments = explode('/', trim($_SERVER['REQUEST_URI'], '/'));
|
||||
}
|
||||
|
||||
foreach ($segments as $pos => $segment) {
|
||||
$segment = urldecode($segment);
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ $msg_box = array();
|
||||
// Check for install.inc.php
|
||||
if (!file_exists('../config.php') && $_SERVER['PATH_INFO'] != '/install.php') {
|
||||
// no config.php does so let's redirect to the install
|
||||
header('Location: /install.php');
|
||||
header('Location: install.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -29,7 +29,7 @@ if($stage == "4" || $stage == "3") {
|
||||
|
||||
require '../includes/defaults.inc.php';
|
||||
// Work out the install directory
|
||||
$cur_dir = explode('/',$_SERVER['DOCUMENT_ROOT']);
|
||||
$cur_dir = explode('/',__DIR__);
|
||||
$check = end($cur_dir);
|
||||
if( empty($check) ) {
|
||||
$install_dir = array_pop($cur_dir);
|
||||
@@ -90,7 +90,6 @@ $complete = 1;
|
||||
<html>
|
||||
<head>
|
||||
<title><?php echo($config['page_title_prefix']); ?></title>
|
||||
<base href="<?php echo($config['base_url']); ?>" />
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||
<meta http-equiv="content-language" content="en-us" />
|
||||
@@ -301,13 +300,14 @@ elseif($stage == "2") {
|
||||
<div class="col-md-3">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<h5 class="text-center">Importing MySQL DB - Do not close this page or interupt the import</h5>
|
||||
<h5 class="text-center">Importing MySQL DB - Do not close this page or interrupt the import</h5>
|
||||
<?php
|
||||
// Ok now let's set the db connection up
|
||||
$config['db_host']=$dbhost;
|
||||
$config['db_user']=$dbuser;
|
||||
$config['db_pass']=$dbpass;
|
||||
$config['db_name']=$dbname;
|
||||
$config['db']['extension']='mysqli';
|
||||
$sql_file = '../build.sql';
|
||||
require '../build-base.php';
|
||||
?>
|
||||
@@ -352,6 +352,7 @@ $config_file = <<<"EOD"
|
||||
\$config\['db_user'\] = "$dbuser";
|
||||
\$config\['db_pass'\] = "$dbpass";
|
||||
\$config\['db_name'\] = "$dbname";
|
||||
\$config\['db'\]\['extension'\] = "mysqli";// mysql or mysqli
|
||||
|
||||
### Memcached config - We use this to store realtime usage
|
||||
\$config\['memcached'\]\['enable'\] = FALSE;
|
||||
|
||||
@@ -212,7 +212,6 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format'])) {
|
||||
}
|
||||
|
||||
if ($where == '') {
|
||||
# $maptool = $config['unflatten'] . ' -f -l 5 | ' . $config['sfdp'] . ' -Gpack -Goverlap=prism -Gcharset=latin1 | dot';
|
||||
$maptool = $config['sfdp'] . ' -Gpack -Goverlap=prism -Gcharset=latin1 -Gsize=20,20';
|
||||
$maptool = $config['dot'];
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ echo "
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/ajax_form.php',
|
||||
url: 'ajax_form.php',
|
||||
data: { type: "callback-statistics", state: state},
|
||||
dataType: "html",
|
||||
success: function(data){
|
||||
@@ -222,7 +222,7 @@ echo "
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/ajax_form.php',
|
||||
url: 'ajax_form.php',
|
||||
data: { type: "callback-clear"},
|
||||
dataType: "html",
|
||||
success: function(data){
|
||||
|
||||
@@ -72,7 +72,7 @@ foreach (get_all_devices() as $hostname) {
|
||||
device_id: '<?php echo htmlspecialchars($_POST['device_id']); ?>'
|
||||
};
|
||||
},
|
||||
url: "/ajax_table.php"
|
||||
url: "ajax_table.php"
|
||||
}).on("loaded.rs.jquery.bootgrid", function() {
|
||||
|
||||
var results = $("div.infos").text().split(" ");
|
||||
|
||||
@@ -73,7 +73,7 @@ var grid = $("#alert-schedule").bootgrid({
|
||||
id: "alert-schedule",
|
||||
};
|
||||
},
|
||||
url: "/ajax_table.php"
|
||||
url: "ajax_table.php"
|
||||
}).on("loaded.rs.jquery.bootgrid", function()
|
||||
{
|
||||
/* Executes after data is loaded and rendered */
|
||||
|
||||
@@ -160,7 +160,7 @@ foreach (dbFetchRows('SELECT `AT`.*,`U`.`username` FROM `api_tokens` AS AT JOIN
|
||||
var token_id = $(this).data("token_id");
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/ajax_form.php',
|
||||
url: 'ajax_form.php',
|
||||
data: { type: "token-item-disable", token_id: token_id, state: state},
|
||||
dataType: "html",
|
||||
success: function(data){
|
||||
@@ -180,7 +180,7 @@ foreach (dbFetchRows('SELECT `AT`.*,`U`.`username` FROM `api_tokens` AS AT JOIN
|
||||
token_id = $("#token_id").val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/ajax_form.php",
|
||||
url: "ajax_form.php",
|
||||
data: $('form.remove_token_form').serialize() ,
|
||||
success: function(msg){
|
||||
$("#thanks").html('<div class="alert alert-info">'+msg+'</div>');
|
||||
@@ -197,7 +197,7 @@ foreach (dbFetchRows('SELECT `AT`.*,`U`.`username` FROM `api_tokens` AS AT JOIN
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/ajax_form.php",
|
||||
url: "ajax_form.php",
|
||||
data: $('form.create_token_form').serialize(),
|
||||
success: function(msg){
|
||||
$("#thanks").html('<div class="alert alert-info">'+msg+'</div>');
|
||||
|
||||
@@ -146,7 +146,7 @@ if (bill_permitted($bill_id)) {
|
||||
}
|
||||
}//end if
|
||||
|
||||
echo '<div style="font-weight: bold; float: right;"><a href="'.generate_url(array('page' => 'bills')).'/"><img align=absmiddle src="/images/16/arrow_left.png"> Back to Bills</a></div>';
|
||||
echo '<div style="font-weight: bold; float: right;"><a href="'.generate_url(array('page' => 'bills')).'/"><img align=absmiddle src="images/16/arrow_left.png"> Back to Bills</a></div>';
|
||||
|
||||
print_optionbar_end();
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ else if ($vars['view'] == 'add') {
|
||||
}
|
||||
}
|
||||
|
||||
echo '<div style="font-weight: bold; float: right;"><a href="'.generate_url(array('page' => 'bills')).'/"><img align=absmiddle src="/images/16/arrow_left.png"> Back to Bills</a></div>';
|
||||
echo '<div style="font-weight: bold; float: right;"><a href="'.generate_url(array('page' => 'bills')).'/"><img align=absmiddle src="images/16/arrow_left.png"> Back to Bills</a></div>';
|
||||
print_optionbar_end();
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,87 +1,34 @@
|
||||
<?php
|
||||
|
||||
echo '<table border=0 cellspacing=0 cellpadding=2 class=devicetable width=100%>';
|
||||
|
||||
echo "
|
||||
<tr bgcolor='$list_colour_a'>
|
||||
<th width='7'></th>
|
||||
<th width='250'><span style='font-weight: bold;' class=interface>Customer</span></th>
|
||||
<th width='150'>Device</th>
|
||||
<th width='100'>Interface</th>
|
||||
<th width='100'>Speed</th>
|
||||
<th width='100'>Circuit</th>
|
||||
<th>Notes</th>
|
||||
</tr>
|
||||
";
|
||||
|
||||
$i = 1;
|
||||
|
||||
$pagetitle[] = 'Customers';
|
||||
|
||||
if (!is_array($config['customers_descr'])) {
|
||||
$config['customers_descr'] = array($config['customers_descr']);
|
||||
}
|
||||
?>
|
||||
|
||||
$descr_type = "'".implode("', '", $config['customers_descr'])."'";
|
||||
<div class="table-responsive">
|
||||
<table id="customers" class="table table-hover table-condensed table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="port_descr_descr" data-order="asc">Customer</th>
|
||||
<th data-column-id="device_id">Device</th>
|
||||
<th data-column-id="ifDescr">Interface</th>
|
||||
<th data-column-id="port_descr_speed">Speed</th>
|
||||
<th data-column-id="port_descr_circuit">Circuit</th>
|
||||
<th data-column-id="port_descr_notes">Notes</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
foreach (dbFetchRows('SELECT * FROM `ports` WHERE `port_descr_type` IN (?) GROUP BY `port_descr_descr` ORDER BY `port_descr_descr`', array(array($descr_type))) as $customer) {
|
||||
$i++;
|
||||
<script>
|
||||
|
||||
$customer_name = $customer['port_descr_descr'];
|
||||
|
||||
if (!is_integer($i / 2)) {
|
||||
$bg_colour = $list_colour_a;
|
||||
}
|
||||
else {
|
||||
$bg_colour = $list_colour_b;
|
||||
}
|
||||
|
||||
foreach (dbFetchRows('SELECT * FROM `ports` WHERE `port_descr_type` IN (?) AND `port_descr_descr` = ?', array(array($descr_type), $customer['port_descr_descr'])) as $port) {
|
||||
$device = device_by_id_cache($port['device_id']);
|
||||
|
||||
unset($class);
|
||||
|
||||
$ifname = fixifname($device['ifDescr']);
|
||||
$ifclass = ifclass($port['ifOperStatus'], $port['ifAdminStatus']);
|
||||
|
||||
if ($device['os'] == 'ios') {
|
||||
if ($port['ifTrunk']) {
|
||||
$vlan = '<span class=box-desc><span class=red>'.$port['ifTrunk'].'</span></span>';
|
||||
}
|
||||
else if ($port['ifVlan']) {
|
||||
$vlan = '<span class=box-desc><span class=blue>VLAN '.$port['ifVlan'].'</span></span>';
|
||||
}
|
||||
else {
|
||||
$vlan = '';
|
||||
}
|
||||
}
|
||||
|
||||
echo "
|
||||
<tr bgcolor='$bg_colour'>
|
||||
<td width='7'></td>
|
||||
<td width='250'><span style='font-weight: bold;' class=interface>".$customer_name."</span></td>
|
||||
<td width='150'>".generate_device_link($device)."</td>
|
||||
<td width='100'>".generate_port_link($port, makeshortif($port['ifDescr']))."</td>
|
||||
<td width='100'>".$port['port_descr_speed']."</td>
|
||||
<td width='100'>".$port['port_descr_circuit'].'</td>
|
||||
<td>'.$port['port_descr_notes'].'</td>
|
||||
</tr>
|
||||
';
|
||||
|
||||
unset($customer_name);
|
||||
}
|
||||
|
||||
echo "<tr bgcolor='$bg_colour'><td></td><td colspan=6>";
|
||||
|
||||
$graph_array['type'] = 'customer_bits';
|
||||
$graph_array['height'] = '100';
|
||||
$graph_array['width'] = '220';
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $customer['port_descr_descr'];
|
||||
|
||||
include 'includes/print-graphrow.inc.php';
|
||||
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
var grid = $("#customers").bootgrid({
|
||||
ajax: true,
|
||||
post: function ()
|
||||
{
|
||||
return {
|
||||
id: "customers",
|
||||
};
|
||||
},
|
||||
url: "/ajax_table.php"
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -149,7 +149,7 @@ if ($unknown) {
|
||||
var device_id = $(this).data("device_id");
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/ajax_form.php',
|
||||
url: 'ajax_form.php',
|
||||
data: { type: "rediscover-device", device_id: device_id },
|
||||
dataType: "json",
|
||||
success: function(data){
|
||||
|
||||
@@ -101,7 +101,7 @@ $('#newThread').on('click', function(e){
|
||||
var form = $('#alert-reset');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/ajax_form.php',
|
||||
url: 'ajax_form.php',
|
||||
data: form.serialize(),
|
||||
dataType: "html",
|
||||
success: function(data){
|
||||
@@ -125,7 +125,7 @@ $( ".sensor" ).blur(function() {
|
||||
var $this = $(this);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/ajax_form.php',
|
||||
url: 'ajax_form.php',
|
||||
data: { type: "health-update", device_id: device_id, data: data, sensor_id: sensor_id , value_type: value_type},
|
||||
dataType: "html",
|
||||
success: function(data){
|
||||
@@ -155,7 +155,7 @@ $('input[name="alert-status"]').on('switchChange.bootstrapSwitch', function(eve
|
||||
var sensor_id = $(this).data("sensor_id");
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/ajax_form.php',
|
||||
url: 'ajax_form.php',
|
||||
data: { type: "sensor-alert-update", device_id: device_id, sensor_id: sensor_id, state: state},
|
||||
dataType: "html",
|
||||
success: function(data){
|
||||
@@ -172,7 +172,7 @@ $("[name='remove-custom']").on('click', function(event) {
|
||||
var sensor_id = $(this).data("sensor_id");
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/ajax_form.php',
|
||||
url: 'ajax_form.php',
|
||||
data: { type: "sensor-alert-update", sensor_id: sensor_id, sub_type: "remove-custom" },
|
||||
dataType: "html",
|
||||
success: function(data){
|
||||
|
||||
@@ -153,7 +153,7 @@ echo('
|
||||
var device_id = $(this).data("device_id");
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/ajax_form.php',
|
||||
url: 'ajax_form.php',
|
||||
data: { type: "poller-module-update", poller_module: poller_module, device_id: device_id, state: state},
|
||||
dataType: "html",
|
||||
success: function(data){
|
||||
@@ -184,7 +184,7 @@ echo('
|
||||
var device_id = $(this).data("device_id");
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/ajax_form.php',
|
||||
url: 'ajax_form.php',
|
||||
data: { type: "discovery-module-update", discovery_module: discovery_module, device_id: device_id, state: state},
|
||||
dataType: "html",
|
||||
success: function(data){
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/ajax_form.php",
|
||||
url: "ajax_form.php",
|
||||
data: $('form#ignoreport').serialize(),
|
||||
dataType: "json",
|
||||
success: function(data){
|
||||
@@ -108,6 +108,6 @@
|
||||
device_id: "<?php echo $device['device_id']; ?>"
|
||||
};
|
||||
},
|
||||
url: "/ajax_table.php"
|
||||
url: "ajax_table.php"
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -30,9 +30,21 @@ if (isset($config['enable_syslog']) && $config['enable_syslog'] == 1) {
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($config['graylog']['server']) && isset($config['graylog']['port'])) {
|
||||
echo ' | ';
|
||||
if ($vars['section'] == 'graylog') {
|
||||
echo '<span class="pagemenu-selected">';
|
||||
}
|
||||
echo generate_link('Graylog', $vars, array('section' => 'graylog'));
|
||||
if ($vars['section'] == 'graylog') {
|
||||
echo '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
switch ($vars['section']) {
|
||||
case 'syslog':
|
||||
case 'eventlog':
|
||||
case 'graylog':
|
||||
include 'pages/device/logs/'.$vars['section'].'.inc.php';
|
||||
break;
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
$filter_device = $device['hostname'];
|
||||
require_once 'includes/common/graylog.inc.php';
|
||||
echo implode('',$common_output);
|
||||
@@ -192,7 +192,7 @@ if (dbFetchCell("SELECT COUNT(*) FROM juniAtmVp WHERE port_id = '".$port['port_i
|
||||
echo "<span class='pagemenu-selected'>";
|
||||
}
|
||||
|
||||
echo "<a href='/device/device=".$device['device_id'].'/tab=port/port='.$port['port_id']."/junose-atm-vp/bits/'>Bits</a>";
|
||||
echo "<a href='" . generate_url(array('page'=>'device','device'=>$device['device_id'], 'tab'=>'port', 'port'=>$port['port_id'])) . "/junose-atm-vp/bits/'>Bits</a>";
|
||||
if ($vars['view'] == 'junose-atm-vp' && $vars['graph'] == 'bits') {
|
||||
echo '</span>';
|
||||
}
|
||||
@@ -202,7 +202,7 @@ if (dbFetchCell("SELECT COUNT(*) FROM juniAtmVp WHERE port_id = '".$port['port_i
|
||||
echo "<span class='pagemenu-selected'>";
|
||||
}
|
||||
|
||||
echo "<a href='device/device=".$device['device_id'].'/tab=port/port='.$port['port_id']."/junose-atm-vp/packets/'>Packets</a>";
|
||||
echo "<a href='" . generate_url(array('page'=>'device','device'=>$device['device_id'], 'tab'=>'port', 'port'=>$port['port_id'])) . "/junose-atm-vp/packets/'>Packets</a>";
|
||||
if ($vars['view'] == 'junose-atm-vp' && $vars['graph'] == 'bits') {
|
||||
echo '</span>';
|
||||
}
|
||||
@@ -212,7 +212,7 @@ if (dbFetchCell("SELECT COUNT(*) FROM juniAtmVp WHERE port_id = '".$port['port_i
|
||||
echo "<span class='pagemenu-selected'>";
|
||||
}
|
||||
|
||||
echo "<a href='device/device=".$device['device_id'].'/tab=port/port='.$port['port_id']."/junose-atm-vp/cells/'>Cells</a>";
|
||||
echo "<a href='" . generate_url(array('page'=>'device','device'=>$device['device_id'], 'tab'=>'port', 'port'=>$port['port_id'])) . "/junose-atm-vp/cells/'>Cells</a>";
|
||||
if ($vars['view'] == 'junose-atm-vp' && $vars['graph'] == 'bits') {
|
||||
echo '</span>';
|
||||
}
|
||||
@@ -222,14 +222,14 @@ if (dbFetchCell("SELECT COUNT(*) FROM juniAtmVp WHERE port_id = '".$port['port_i
|
||||
echo "<span class='pagemenu-selected'>";
|
||||
}
|
||||
|
||||
echo "<a href='device/device=".$device['device_id'].'/tab=port/port='.$port['port_id']."/junose-atm-vp/errors/'>Errors</a>";
|
||||
echo "<a href='" . generate_url(array('page'=>'device','device'=>$device['device_id'], 'tab'=>'port', 'port'=>$port['port_id'])) . "/junose-atm-vp/errors/'>Errors</a>";
|
||||
if ($vars['view'] == 'junose-atm-vp' && $vars['graph'] == 'bits') {
|
||||
echo '</span>';
|
||||
}
|
||||
}//end if
|
||||
|
||||
if ($_SESSION['userlevel'] >= '10') {
|
||||
echo "<span style='float: right;'><a href='bills/view=add/port=".$port['port_id']."/'><img src='images/16/money.png' border='0' align='absmiddle'> Create Bill</a></span>";
|
||||
echo "<span style='float: right;'><a href='" . generate_url(array('page'=>'bills', 'view'=>'add', 'port'=>$port['port_id'])) . "'><img src='images/16/money.png' border='0' align='absmiddle'> Create Bill</a></span>";
|
||||
}
|
||||
|
||||
print_optionbar_end();
|
||||
|
||||
@@ -85,7 +85,7 @@ foreach ($heads as $head => $extra) {
|
||||
$icon .= "'";
|
||||
}
|
||||
|
||||
echo '<th><a href="/device/device='.$device['device_id'].'/tab=processes/order='.$lhead.'/by='.$bhead.'"><span'.$icon.'> ';
|
||||
echo '<th><a href="' . generate_url(array('page'=>'device','device'=>$device['device_id'], 'tab'=>'processes', 'order'=>$lhead, 'by'=>$bhead)) . '"><span'.$icon.'> ';
|
||||
if (!empty($extra)) {
|
||||
echo "<abbr title='$extra'>$head</abbr>";
|
||||
}
|
||||
|
||||
@@ -435,7 +435,7 @@ var grid = $("#devices").bootgrid({
|
||||
group: '<?php echo mres($vars['group']); ?>',
|
||||
};
|
||||
},
|
||||
url: "/ajax_table.php"
|
||||
url: "ajax_table.php"
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user