Ubuntu

libreNMS install for Ubuntu 20.04

Naan 2021. 10. 15. 11:33
반응형

https://docs.librenms.org/Installation/Install-LibreNMS/

 

Install LibreNMS - LibreNMS Docs

vi /etc/nginx/conf.d/librenms.conf Add the following config, edit server_name as required: server { listen 80; server_name librenms.example.com; root /opt/librenms/html; index index.php; charset utf-8; gzip on; gzip_types text/css application/javascript te

docs.librenms.org

위에 잘 나와 있다 자신의 환경에 맞춰 설정 하면 된다.(ubuntu 20.04, Centos8, Debian 10)

중간에 timedatect set-timezone 은 timedatectl set-timezone Asia/Seoul 해주면 된다.

모든 작업 다 마추고 설정 화면으로 들어가자.

http://localhost

접속하면 위와 같이 화면을 볼수 있다.

mysql 아까 암호 입력 했던걸 입력 하고 다음

build database 눌러서 다음

계정 생성 ~

계정 생성

문제 해결 페이지 들어가서 나머지 문제 해결

 

 

오류가 좀 있긴 한데.. 디바이스 추가 하면 

http://localhost/addhqst 

디바이스 추가

정상 작동 된다.

정상적으로 데이터들이 올라온다.

 

장비 상태 점검은

sudo su - librenms

root 권한으로 안된다.

/opt/librenms

$ ./validate.php
====================================
Component | Version
--------- | -------
LibreNMS  | 21.9.0-79-g436487f5f
DB Schema | 2021_25_01_0129_isis_adjacencies_nullable (221)
PHP       | 7.4.3
Python    | 3.8.10
MySQL     | 10.3.31-MariaDB-0ubuntu0.20.04.1
RRDTool   | 1.7.2
SNMP      | NET-SNMP 5.8
====================================

[OK]    Composer Version: 2.1.9
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[FAIL]  Database: incorrect column (notifications/datetime)
[FAIL]  Database: incorrect column (users/created_at)
[FAIL]  We have detected that your database schema may be wrong
        [FIX]:
        Run the following SQL statements to fix it
        SQL Statements:
         SET TIME_ZONE='+00:00';
         ALTER TABLE `notifications` CHANGE `datetime` `datetime` timestamp NOT NULL DEFAULT '1970-01-02 00:00:00' ;
         ALTER TABLE `users` CHANGE `created_at` `created_at` timestamp NOT NULL DEFAULT '1970-01-02 00:00:01' ;

에러 난것 처럼 mysql 들어가서 위 명령어 쳐주면 정상적으로 작동 된다.

MariaDB [librenms]> SET TIME_ZONE='+00:00';
Query OK, 0 rows affected (0.000 sec)

MariaDB [librenms]> ALTER TABLE `notifications` CHANGE `datetime` `datetime` timestamp NOT NULL DEFAULT '1970-01-02 00:00:00' ;
Query OK, 0 rows affected (0.001 sec)
Records: 0  Duplicates: 0  Warnings: 0

MariaDB [librenms]> ALTER TABLE `users` CHANGE `created_at` `created_at` timestamp NOT NULL DEFAULT '1970-01-02 00:00:01' ;
Query OK, 0 rows affected (0.001 sec)
Records: 0  Duplicates: 0  Warnings: 0

MariaDB [librenms]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.000 sec)

MariaDB [librenms]> quit
Bye

$ cd /opt/librenms/
librenms@librenms-virtual-machine:/opt/librenms$ ./validate.php
====================================
Component | Version
--------- | -------
LibreNMS  | 21.9.0-79-g436487f5f
DB Schema | 2021_25_01_0129_isis_adjacencies_nullable (221)
PHP       | 7.4.3
Python    | 3.8.10
MySQL     | 10.3.31-MariaDB-0ubuntu0.20.04.1
RRDTool   | 1.7.2
SNMP      | NET-SNMP 5.8
====================================

[OK]    Composer Version: 2.1.9
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database schema correct

모든 작업이 끝!~

추가로 device import 나 export  지원이 안된는듯 하다.

수동으로 device host 등록 가능하다.

/opt/librenms$ ./addhost.php 192.168.050 v2c public

Added device 192.168.0.50 (29)

또한 snmp-scan 을 이용해서 모든 장비를 한꺼번에 다 가져올 수 있다.

librenms@librenms-virtual-machine:/opt/librenms$ ./snmp-scan.py 192.168.0.0/24
Scanning IPs:
*.....*.......***++++++++++*++++*++*+*+*+***+*++++++-++++++++++++++++++++++++++++++---

Scanned 254 IPs: 220 known devices, added 51 devices, failed to add 00 devices
Runtime: 180.45 seconds

편하다... 그룹핑은.... 노가다...

 

추가로 add type 을 할수가 없다.

group 만 새로 만들어서 넣으면 되긴 한데 노가다를 해야 하는거라

edit 해서 type 을 수정한걸 넣으면 관리가 편하다.

이걸 수정하기 위해서는 json 파일을 수정 하면된다.

/misc/config_definitions.json

위 이미지처럼 { }, 를 추가 해주면 된다 이미지는 기존게 그대로 쓰던지 아니면 새로 생성하면 된다.

 

문제 있는지 없는지 확인 하는 방법은..

# sudo su - librenms

# cd /opt/librenms/

# ./validate.php

서버 상태 확인 가능

반응형