Skip to content

matoH12/MRTG-admin-DASHBOARD

Repository files navigation

MRTG,switchmap php admin

MRTG admin structure

Install package debian/ubuntu:

apt install mrtg apache2 php php-mysql mariadb-server mariadb-client composser

Install script for generate MRTG configuration from MySQL database:

mkdir /var/www/mrtg

Web admin install: Copy data from git to web root directrory.

cd /var/www/
git clone https://github.com/matoH12/MRTG-admin-DASHBOARD.git .
mysql -u root mrtgadmin < admin/mrtgadmin.sql

Setting password for MYSQL in file:

  1. index.php
function lokalita($id_budova)
{
$mysqli = new mysqli("localhost", "admin", 'yabFidth3', "mrtgadmin");
...
  1. admin/config/config.php
|--------------------------------------------------------------------------
| DATABASE CONFIGURATION
|--------------------------------------------------------------------------
 */

define('DB_HOST', "localhost");
define('DB_USER', "admin");
define('DB_PASSWORD', "yadFidth");
define('DB_NAME', "mrtgadmin");

Default credential for local account:

User: admin
Password: admin

MYSQL config admin account

For authenticate you can use keaycloak sso system over openid protocol. Configure credential in:

authenticate.php

$provider = new Stevenmaguire\OAuth2\Client\Provider\Keycloak([
    'authServerUrl'         => 'https://sso.local.sk/auth',
    'realm'                 => 'realm1',
    'clientId'              => 'mrtg.local.sk',
    'clientSecret'          => '39d50b9d-22a4-49af-9049-587547247391',
    'redirectUri'           => 'https://mrtg.local.sk/admin/authenticate.php',
//    'encryptionAlgorithm'   => 'RS256',                             // optional
//    'encryptionKeyPath'     => '../key.pem'                         // optional
//    'encryptionKey'         => 'contents_of_key_or_certificate'     // optional
]);

This project use for authenticate this dictiornary:

https://github.com/stevenmaguire/oauth2-keycloak

Cron settings:

30 0 * * * php /var/www/html/mrtg.local.sk/admin/script/mrtggen.php
30 1 * * * php /var/www/html/mrtg.local.sk/admin/script/scansnmp.php

30 1 * * * php /var/www/html/local.sk/admin/script/scansnmp.php
1 2 * * * php /script/switchmapfrommysql.php
44 * * * * /var/www/html/switchmap.local.sk/ScanSwitch.pl
49 * * * * /var/www/html/switchmap.local.sk/GetArp.pl
01 3 * * * /var/www/html/switchmap.local.sk/SwitchMap.pl

Title page MRTG

Administration:

Administration