웹사이트 검색

Ubuntu 20.04에서 Pandora FMS 모니터링 도구를 설치하는 방법


이 페이지에서

  1. 전제 조건
  2. 시작하기\n
  3. LAMP 서버 설치
  4. MariaDB 데이터베이스 구성
  5. 판도아 FMS 다운로드
  6. Pandora FMS용 Apache 구성
  7. Pandora FMS 액세스
  8. Lets Encrypt로 Pandora FMS 보호\n
  9. 결론

"Pandora Flexible Monitoring System"으로도 알려진 Pandora FMS는 서버, 네트워크, 애플리케이션 및 가상 인프라에 사용되는 모니터링 도구입니다. 단순하고 확장 가능하며 복잡하고 대규모 환경에 적합합니다. TCP, UDP, SNMP, HTTP 및 에이전트를 포함한 여러 프로토콜을 사용하여 다양한 메트릭을 수집합니다. Pandora FMS를 사용하여 웹 서버, 데이터베이스 서버, 응용 프로그램, 라우터 및 기타 네트워크 장치의 상태와 성능을 모니터링할 수 있습니다.

이 튜토리얼에서는 Ubuntu 20.04에서 Pandora FMS를 설치하고 구성하는 방법을 보여줍니다.

전제 조건

  • Ubuntu 20.04를 실행하는 서버.\n
  • 서버 IP를 가리키는 유효한 도메인 이름입니다.\n
  • 루트 암호는 서버에 구성됩니다.\n

시작하기

먼저 시스템 패키지를 업데이트된 버전으로 업데이트하는 것이 좋습니다. 다음 명령으로 업데이트할 수 있습니다.

apt-get update -y

모든 패키지가 업데이트되면 다음 명령을 사용하여 Pandora FMS에 필요한 모든 종속성을 설치합니다.

apt-get install snmp snmpd libnet-telnet-perl libgeo-ip-perl libtime-format-perl libxml-simple-perl libxml-twig-perl libdbi-perl libnetaddr-ip-perl libhtml-parser-perl xprobe2 nmap libmail-sendmail-perl traceroute libio-socket-inet6-perl libhtml-tree-perl libsnmp-perl snmp-mibs-downloader libio-socket-multicast-perl libsnmp-perl libjson-perl -y

램프 서버 설치

다음으로 Apache 서버, MariaDB, PHP 및 기타 필수 종속 항목을 시스템에 설치해야 합니다. 다음 명령을 사용하여 모두 설치할 수 있습니다.

apt-get install apache2 mariadb-server php php-common php-gmp php-curl php-mbstring php-xmlrpc php-mysql php-gd php-bcmath php-xml php-cli php-zip php-pear php-zip php-sqlite3 php-snmp php-db graphviz php-curl php-ldap dbconfig-common unzip git -y

모든 패키지를 설치한 후 php.ini 파일을 편집하고 권장 설정을 정의합니다.

nano /etc/php/7.4/apache2/php.ini

다음 줄을 변경합니다.

memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
max_input_vars = 2000
date.timezone = Asia/Kolkata

완료되면 다음 단계로 진행할 수 있습니다.

MariaDB 데이터베이스 구성

기본적으로 MariaDB 루트 암호는 설정되어 있지 않습니다. 따라서 시스템에서 설정해야 합니다. 다음 스크립트를 실행하여 이를 수행할 수 있습니다.

mysql_secure_installation

루트 암호를 설정하려면 아래와 같이 모든 질문에 답하십시오.

Enter current password for root (enter for none):
OK, successfully used password, moving on...
Set root password? [Y/n] Y
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

그런 다음 다음 명령을 사용하여 MariaDB 셸에 로그인합니다.

mysql -u root -p

프롬프트가 표시되면 루트 암호를 제공하고 다음 명령을 사용하여 mysql_native_password 플러그인을 활성화합니다.

MariaDB [(none)]> USE mysql; 
MariaDB [(none)]> UPDATE user SET plugin='mysql_native_password' WHERE User='root';

다음으로 다음 명령을 사용하여 Pandora용 데이터베이스와 사용자를 만듭니다.

MariaDB [(none)]> CREATE DATABASE pandora;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON pandora.* to 'localhost' IDENTIFIED BY 'pandora';

그런 다음 권한을 플러시하고 다음 명령을 사용하여 MariaDB 셸을 종료합니다.

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

다음으로 /etc/mysql/my.cnf 파일을 편집하고 sql_mode를 정의해야 합니다.

nano /etc/mysql/my.cnf

다음 줄을 추가합니다.

[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION

완료되면 파일을 저장하고 닫은 다음 MariaDB 서비스를 다시 시작하여 변경 사항을 적용합니다.

systemctl restart mariadb

판도아 FMS 다운로드

다음으로 Git 저장소에서 판도라 FMS 최신 버전을 다운로드해야 합니다. 다음 명령으로 다운로드할 수 있습니다.

cd /var/www/html/
git clone https://github.com/pandorafms/pandorafms.git

다음으로 다운로드한 디렉터리에 적절한 권한과 소유권을 부여합니다.

chown -R www-data:www-data /var/www/html/pandorafms
chown -R www-data:www-data /var/www/html/pandorafms/pandora_console/
chmod -R 775 /var/www/html/pandorafms/pandora_console/

다음으로 Pandora 구성 파일을 편집합니다.

nano /var/www/html/pandorafms/pandora_console/include/config.inc.php

주석을 제거하고 데이터베이스 설정에 따라 다음 행을 변경하십시오.

// Default values
 $config["dbname"]="pandora";
 $config["dbuser"]="pandora";
 $config["dbpass"]="pandora";
 $config["dbhost"]="localhost";
// This is used for reporting, please add "/" character at the end
// $config["homedir"]="/var/www/pandora_console/";
// $config["homeurl"]="/pandora_console/";
 $config["auth"]["scheme"] = "mysql";

완료되면 파일을 저장하고 닫습니다.

Pandora FMS용 Apache 구성

다음으로 Pandora FMS를 제공하기 위해 새로운 Apache 가상 호스트 구성 파일을 생성해야 합니다. 다음 명령으로 만들 수 있습니다.

nano /etc/apache2/sites-available/pandora.conf

다음 줄을 추가합니다.

<VirtualHost *:80>
ServerAdmin 
ServerName pandora.linuxbuz.com
DocumentRoot /var/www/html/pandorafms/pandora_console
<Directory /var/www/html/pandorafms/pandora_console>
AllowOverride All
</Directory>
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
</VirtualHost>

파일을 저장하고 닫은 다음 다음 명령을 사용하여 Pandora 가상 호스트를 활성화합니다.

a2ensite pandora

다음으로 Apache 서비스를 다시 로드하여 구성 변경 사항을 적용합니다.

systemctl restart apache2

판도라 FMS에 액세스

이제 웹 브라우저를 열고 URL http://pandora.linuxbuz.com/install.php를 입력하여 Pandora FMS에 액세스하십시오. 아래와 같이 Pandora FMS 웹 설치 마법사가 표시되어야 합니다.

다음 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

"예, 라이선스 조건에 동의합니다"를 클릭합니다. 다음 페이지가 표시됩니다.

모든 PHP 확장이 설치되었는지 확인하고 다음 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

루트 사용자 이름, MariaDB 루트 암호, 데이터베이스 이름, Pandora의 경로를 제공하고 다음 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

이렇게 하면 Pandora 데이터베이스 사용자의 비밀번호가 변경됩니다. 따라서 config.php 파일에서 원래 Pandora 데이터베이스 암호를 정의해야 합니다.

터미널을 열고 config.php 파일을 편집합니다.

nano /var/www/html/pandorafms/pandora_console/include/config.php

원래 암호로 "$config["dbpass"]" 필드를 변경합니다.

// Begin of automatic config file
$config["dbtype"] = "mysql"; //DB type (mysql, postgresql...in future others)
$config["mysqli"] = true;
$config["dbname"]="pandora";
$config["dbuser"]="pandora";
$config["dbpass"]="pandora";
$config["dbhost"]="localhost"; 

파일을 저장하고 닫습니다. 그런 다음 Pandora 설치 마법사로 돌아가서 다음 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

그런 다음 터미널을 다시 열고 install.php 파일을 제거합니다.

rm -rf /var/www/html/pandorafms/pandora_console/install.php

그런 다음 Pandora FMS 설치 마법사로 돌아가서 "여기를 클릭하여 Pandora FMS 콘솔에 액세스"를 클릭하십시오. Pandora FMS 로그인 화면이 표시되어야 합니다.

기본 관리자 사용자 이름을 admin으로, 비밀번호를 pandora로 입력한 다음 로그인 버튼을 클릭합니다. 다음 화면에 Pandora 대시보드가 표시되어야 합니다.

Lets Encrypt로 안전한 Pandora FMS

다음으로 Lets Encrypt SSL로 웹 사이트를 보호하는 것이 좋습니다. 먼저 다음 명령을 사용하여 Certbot 클라이언트를 설치합니다.

apt-get install python3-certbot-apache -y

설치가 완료되면 다음 명령을 실행하여 Lets Encrypt SSL로 웹 사이트를 보호하십시오.

certbot --apache -d pandora.linuxbuz.com

아래와 같이 이메일을 제공하고 서비스 약관에 동의하라는 메시지가 표시됩니다.

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Plugins selected: Authenticator apache, Installer apache
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for pandora.linuxbuz.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/pandora-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/pandora-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/pandora-le-ssl.conf

다음으로 아래와 같이 HTTP 트래픽을 HTTPS로 리디렉션할지 여부를 선택합니다.

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

2를 입력하고 Enter 키를 눌러 웹사이트에 Lets Encrypt SSL을 설치합니다.

Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/pandora.conf to ssl vhost in /etc/apache2/sites-available/pandora-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://pandora.linuxbuz.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=pandora.linuxbuz.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/pandora.linuxbuz.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/pandora.linuxbuz.com/privkey.pem
   Your cert will expire on 2020-10-23. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

이제 URL https://pandora.linuxbuz.com을 사용하여 Pandora FMS에 안전하게 액세스할 수 있습니다.

결론

축하합니다! Apache와 함께 Pandora FMS 모니터링 도구를 성공적으로 설치했으며 Ubuntu 20.04 서버에서 SSL을 암호화할 수 있습니다. 이제 클라이언트 시스템을 추가하고 Pandora FMS에서 모니터링을 시작할 수 있습니다.