Cloud Network

Networking | Support | Tricks | Troubleshoot | Tips

Buymecoffe

Buy Me A Coffee
Showing posts with label Linux Mint. Show all posts
Showing posts with label Linux Mint. Show all posts

Wednesday, September 2, 2020

How to Setup Monitoring for Docker Containers using Prometheus on Ubuntu 18.04

September 02, 2020
How to Setup Monitoring for Docker Containers using Prometheus on Ubuntu 18.04

 Requirment 

1. docker should be installed

2. docker-compose also be installed


Installation of docker

1.  sudo apt-get install docker.io or sudo apt  install docker.io

2. docker --version

3. sudo apt-get install docker-compose

 

Creating a Configuration files of prometheus

1. create a new file prometheus.yml and copy paste below

sudo nano ~/ prometheus.yml  or sudo nano /etc/prometheus/prometheus.yml

# prometheus.yml
global:
 scrape_interval: 5s
 external_labels:
   monitor: 'my-monitor'
rule_files:
 - 'alert.rules'
scrape_configs:
 - job_name: 'prometheus'
   static_configs:
     - targets: ['your_server_ip:9090']

2. create a new file docker-compose.yml and copy paste below

sudo nano ~/docker-compose.yml or sudo nano /etc/prometheus/docker-compose.yml

# docker-compose.yml
version: '2'
services:
  prometheus:
     image: prom/prometheus:latest
     volumes:
       - ./prometheus.yml:/etc/prometheus/prometheus.yml            
     command:
       - '--config.file=/etc/prometheus/prometheus.yml'
     ports:
       - '9090:9090'

 3. Run the docker compose file

cd /etc/prometheus/ or sudo ~/docker-compose up

sudo docker-compose up

 4. Open browser

http://your_server_ip:9090

 5. Install Node exporter

sudo nano ~/docker-compose.yml or sudo nano /etc/prometheus/docker-compose.yml
 
copy paste at last line
node-exporter:
     image: prom/node-exporter
     ports:
       - '9100:9100'
 sudo nano ~/ prometheus.yml  or sudo nano /etc/prometheus/prometheus.yml
 
copy paste at last line 
- job_name: 'node-exporter'
   static_configs:
     - targets: ['node-exporter:9100'] 

 6. Restart docker-composer

cd /etc/prometheus/ or sudo ~/docker-compose restart

sudo docker-compose restart

7. Install Grafana

sudo nano ~/docker-compose.yml or sudo nano /etc/prometheus/docker-compose.yml

copy paste at last line  

grafana:
     image: grafana/grafana
     user: "0" #[ Execute  id -u in terminal to find the user id from where you are invoking docker compose]
     volumes:
       - ./grafana_db:/var/lib/grafana
     environment:
       - GF_SECURITY_ADMIN_PASSWORD=yourpass
     depends_on:
       - prometheus
     ports:
       - '3000:3000'

 4. Open browser

http://your_server_ip:3000

 

 

Monday, March 30, 2020

How to Install IntelliJ IDEA on Ubuntu 18.04 LTS, Debian and Linux Mint

March 30, 2020
How to Install IntelliJ IDEA on Ubuntu 18.04 LTS, Debian and Linux Mint
How to Install IntelliJ IDEA on Ubuntu 18.04 LTS, Debian and Linux Mint

Requirment
    login: user with root privileges
    OS: Ubuntu 18.04 64-bit
    RAM: Minimum 2 GB RAM, 8 GB RAM recommended
    Harddisk Space: 1.5 GB hard disk space, 5 GB + at least 1 GB for caches
    CPU: 2
    screen resolution: 1024x768 minimum
    Download Size : 774MB

Offically Website of IntelliJ IDEA
https://www.jetbrains.com/idea/download/#section=linux

Offically Website of jetbrains
https://www.jetbrains.com/toolbox-app/

    IntelliJ IDEA Community Edition (Free)
    IntelliJ IDEA Ultimate Edition (Paid version with extra features)
    IntelliJ IDEA Educational (Ultimate Edition but free for students and faculty members)

Method 1
Install using the Snap
Installing IntelliJ IDEA community Edition
Step1 :- sudo snap install intellij-idea-community --classic

Installing IntelliJ IDEA Educational Edition
Step1 :- sudo snap install intellij-idea-educational --classic

Installing IntelliJ IDEA Ultimate Edition 30Day
Step1 :- sudo snap install intellij-idea-Ultimate --classic

After Successful Installation
Step2 :- intellij-idea-community

Method 2
Install using the Toolbox App
Step1 :- sudo apt update
Step2 :- sudo wget https://download.jetbrains.com/toolbox/jetbrains-toolbox-1.16.6319.tar.gz
Step3 :- cd /tmp  OR  cd /opt
Step4 :- sudo tar -xzf jetbrains-toolbox-1.16.6319.tar.gz -C /opt

Need to Register in IntelliJ IDEA
  

Method 3
Using Official Package or Standalone installation of community or Ultimate Edition
Step1 :- sudo apt update
Step2 :- sudo wget https://download.jetbrains.com/idea/ideaIU-2019.3.4.tar.gz
Step3 :- cd /tmp  OR  cd /opt
Step4 :- sudo tar -xzf ideaIU.tar.gz -C /opt

How To Install Git and Git-Gui on Ubuntu 18.04 LTS, Debian and Linux Mint

March 30, 2020
How To Install Git and Git-Gui on Ubuntu 18.04 LTS, Debian and Linux Mint
How To Install Git and Git-Gui on Ubuntu 18.04 LTS, Debian and Linux Mint

Offically Website of GitHub
https://github.com/git/git

Offically Website of Git
https://git-scm.com/downloads

Method 1
Installing Git
Step1 :- sudo apt update
Step2 :- sudo apt install git  OR  sudo apt-get install git-gui

Verify
Step3 :- git --version

Method 2
Installing Git from Source
Step1 :- sudo apt update
Step2 :- sudo apt install make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip
Step3 :- cd /tmp  OR  cd /usr/src/
Step4 :- sudo wget https://github.com/git/git/archive/v2.26.0.zip -O git.zip  
      OR sudo wget https://github.com/git/git/archive/v2.26.0.tar.gz -O git.tar.gz    
Step5 :- sudo unzip git.zip
      OR sudo tar -xf git.tar.gz
Step6 :- cd git-*
Step7 :- sudo make prefix=/usr/local all
Step8 :- sudo make prefix=/usr/local install
 
ERROR
cache.h:21:10: fatal error: zlib.h: No such file or directory
 #include <zlib.h>
          ^~~~~~~~
compilation terminated.
Makefile:2387: recipe for target 'fuzz-commit-graph.o' failed
make: *** [fuzz-commit-graph.o] Error 1

SOLUTIONS   
Step1 :- sudo apt-get install libz-dev
Step2 :- sudo apt install zlib1g-dev

Step9 :- git --version

Clone the Git
Step10 :- cd ~
Step11 :- git clone https://github.com/git/git.git  OR  git clone https://github.com/git/git
Step12 :- cd git
Step13 :- sudo make prefix=/usr/local all
Step14 :- sudo make prefix=/usr/local install

Configuring Git
Step15 :- git config --global user.name "Cloud Network"
Step16 :- git config --global user.email "itcloudnet@gmail.com"

Verify
Step17 :- git config --list

configuration file of Git
Step18 :- nano ~/.gitconfig

Sunday, March 29, 2020

How To Install Node.js and npm Ubuntu 18.04, Debian and Linux Mint

March 29, 2020
How To Install Node.js and npm Ubuntu 18.04, Debian and Linux Mint
How To Install Node.js and npm Ubuntu 18.04, Debian and Linux Mint

Officially Website
https://nodejs.org/en/download/

Stable release: 12.15.0

Offically Github
https://github.com/nvm-sh/nvm

METHOD 1
Step1 :- sudo apt-get update

Step2 :- sudo apt install nodejs

Step3 :- node -v OR node --version OR nodejs -v

Step4 :- npm -v OR npm --version

METHOD 2
Installing Using PPA
sudo apt-get update

sudo apt-get upgrade

sudo apt-get install python-software-properties

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
OR
curl -sL https://deb.nodesource.com/setup_12.x -o nodesource_setup.sh

sudo apt install nodejs

node --version
nvm --version

sudo apt install build-essential

METHOD 3
Installing Using NVM
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.3/install.sh | bash
nvm ls  OR nvm ls-remote
nvm install (Latest LTS)  OR nvm install --lts
nvm use (Latest LTS)
node --version
nvm ls
nvm alias default (Latest LTS)
nvm use default
nvm install node
npm install express
npm install -g express
npm link express
nvm help
nvm --version

Removing Node.js
sudo apt remove nodejs
sudo apt purge nodejs
sudo apt autoremove
sudo apt remove nodejs npm

nvm current
nvm uninstall node_version
nvm deactivate

How to Install and Configure pgAdmin 4 v4.19 on Ubuntu 18.04, Debian and Linux Mint

March 29, 2020
How to Install and Configure pgAdmin 4 v4.19 on Ubuntu 18.04, Debian and Linux Mint
How to Install and Configure pgAdmin 4 v4.19 on Ubuntu 18.04, Debian and Linux Mint

Visit the Pgadmin 4 Ubuntu download site:
https://www.pgadmin.org/download/

METHOD 1
Importing GPG key
sudo apt install wget ca-certificates

Install Pgadmin4 from Ubuntu repositories
Step1 :- wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

Add PostgreSQL APT repository
Step2 :- sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'

Updating
Step3 :- sudo apt update

Installation pgadmin4
Step4 :- sudo apt install pgadmin4 pgadmin4-apache2 -y  OR  sudo apt-get install pgadmin4 pgadmin4-apache2

Check Status
Step :- systemctl status apache2

UFW Firewall Configured
Step :- sudo ufw allow http
Step :- sudo ufw allow https

Verify Open Browser
http://[SERVERIP OR LOCALHOST OR DOMAIN]/pgadmin4/

Login with your email address and password.
Email Address :- itcloudnet@gmail.com
Password :- STRONGPASSWORD
===================================================================================================================================

METHOD 2
Creating a New User
Step5 :- useradd -m -s /bin/bash itcloudnet
Step6 :- passwd STRONGPASSWORD

Creating Log Directory
Step7 :- sudo mkdir -p /var/log/pgadmin4/ OR  sudo mkdir /var/log/pgadmin4
Step8 :- sudo mkdir -p /var/lib/pgadmin4/{sessions,storage}
OR
Step8 :- sudo mkdir -p /var/lib/pgadmin4/sessions
Step8 :- sudo mkdir /var/lib/pgadmin4/storage

Changing the Owner of all Directory
Step9 :- sudo chown -R itcloudnet:itcloudnet /var/log/pgadmin4/ /var/lib/pgadmin4/

Install Dependencies
Step10 :- sudo apt install build-essential libssl-dev libffi-dev libgmp3-dev virtualenv python-pip libpq-dev python-dev -y

Install Apache2
Step11 :- sudo apt install apache2 apache2-utils libapache2-mod-wsgi libexpat1 ssl-cert python -y

Creating Virtual Env
Step11 :- su - itcloudnet
Step12 :- virtualenv pgadmin4
Step13 :- cd pgadmin4/
Step14 :- source bin/activate

Installation pgadmin4
Step15 :- wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v3.6/pip/pgadmin4-4.19-py2.py3-none-any.whl

Install Package through pip command
sudo apt-get install python-pip
Step16 :- pip install pgadmin4-4.19-py2.py3-none-any.whl

Creating New Configuration file
Step17 :- cd lib/python2.7/site-packages/pgadmin4/
Step18 :- nano config_local.py

Now Copy & Paste
LOG_FILE = '/var/log/pgadmin4/pgadmin4.log'
SQLITE_PATH = '/var/lib/pgadmin4/pgadmin4.db'
SESSION_DB_PATH = '/var/lib/pgadmin4/sessions'
STORAGE_DIR = '/var/lib/pgadmin4/storage'
SERVER_MODE = True

Run
Step19 :- python setup.py

Step20 :- pip install psycopg2-binary
Step21 :- sudo chown -R www-data:www-data /var/lib/pgadmin4/ OR sudo chown -R itcloudnet:itcloudnet /var/lib/pgadmin4
Step22 :- sudo chown -R www-data:www-data /var/log/pgadmin4/ OR sudo chown -R itcloudnet:itcloudnet /var/log/pgadmin4

Configure Apache2
Step23 :- cd /etc/apache2/sites-available/

Change the 'ServerName' with your own domain name
Step24 :- sudo nano pgadmin4.conf
          ServerName pgadmin.itcloudnet.blogspot.com

Now test the configuration and activate the pgAdmin4 virtual hosts
Step25 :- apachectl configtest
Step26 :- a2ensite pgadmin4

Restart Apache2 Service
Step27 :- systemctl restart apache2

URL Access
http://pgadmin.itcloudnet.blogspot.com

===================================================================================================================================
HOW TO CONNECT POSTGRESQL DB VIA or WITH PGADMIN4

Login with your email address and password
Email Address :- itcloudnet@gmail.com
Password :- STRONGPASSWORD

Step28 :- "Add New Server" Button then type PostgreSQL Server or Local details and then save.

Click on General -->
Name : postgresql-local OR localhost
Server group : Servers
Comments : Local PostgreSQl Server

Click on Connection -->
Maintenance : postgres (DB host)
Username : postgres (DB name)
password : itcloudnet$123! (DB passwrod)

Save

Thats it.........

How To Install Elasticsearch, Logstash and Kibana on Ubuntu 18.04

March 29, 2020
How To Install Elasticsearch, Logstash and Kibana on Ubuntu 18.04
How To Install Elasticsearch, Logstash and Kibana on Ubuntu 18.04

Requirment
    login: user with root privileges
    OS: Ubuntu 18.04
    RAM: 4GB
    CPU: 2
    Java: Oracle JDK 8 version

The same instructions apply for Ubuntu 17.04/16.04, Linux Mint, Debian, Kubuntu and Elementary OS

Update/upgrade
1. sudo apt update
2. sudo apt-get upgrade -y
-------------------------------------------------------
Install dependencies and java 8
1. sudo add-apt-repository ppa:webupd8team/java
2. sudo apt-get update OR sudo apt update
3. sudo apt install openjdk-8-jdk

Verify the Java
1. java -version
-------------------------------------------------------
ELASTICSEARCH

Install and configure Elasticsearch
1. cd /tmp
2. wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.5.2-amd64.deb
3. sudo dpkg -i elasticsearch-7.5.2-amd64.deb

Elasticsearch configuration file
1. sudo nano /etc/elasticsearch/elasticsearch.yml
network.host to [local, eth0]
nano /etc/init.d/elasticsearch

Locate the line:
# network.host: localhost

start and enable the service
1. sudo systemctl enable elasticsearch.service
2. sudo systemctl start elasticsearch.service
       sudo systemctl status elasticsearch.service
OR
/etc/init.d/elasticsearch start
3. /etc/init.d/elasticsearch status


Verify Elasticsearch
1. curl -X GET "localhost:9200/"

open web browser
1. http://server_ip:9200/ or http://localhost:9200/

docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:5.0.0
-------------------------------------------------------
KIBANA

Now, Install and configure Kibana
1. cd /tmp
2. wget https://artifacts.elastic.co/downloads/kibana/kibana-7.5.2-amd64.deb
3. sudo dpkg -i kibana-7.5.2-amd64.deb

Configuration file Kibana
1. sudo nano /etc/kibana/kibana.yml

    Locate the following lines:
#server.host: "localhost"
#elasticsearch.url: "http://localhost:9200"
to
Change those lines to:
server.host: "SERVER_IP"
elasticsearch.hosts: "http://SERVER_IP:9200"

1. sudo sysctl -w vm.max_map_count=262144

start and enable the service
1. sudo systemctl enable kibana.service
2. sudo systemctl start kibana.service
3. sudo systemctl status kibana.service

open web browser
1. http://server_ip:5601/ or ip_address:5601
-------------------------------------------------------

LOGSTASH

Now, Install and configure Logstash
1. cd /tmp
2. wget https://artifacts.elastic.co/downloads/logstash/logstash-7.5.2.deb
3. sudo dpkg -i logstash-7.5.2.deb

Configuration file logstash
1. sudo nano /etc/logstash/logstash.yml

Locate the line:
# http.host: "127.0.0.1"

start and enable the service
1. sudo systemctl enable logstash.service
2. sudo systemctl start logstash.service
3. sudo systemctl status logstash.service

Thursday, October 24, 2019

How to Install Icinga 2 and Icinga Web 2 on Ubuntu and Linux Mint

October 24, 2019
How to Install Icinga 2 and Icinga Web 2 on Ubuntu and Linux Mint

Install Icinga and Icinga Web Monitoring Tool on Ubuntu



For Download Icinga Repositories : - https://icinga.com/download/

Login to root user:
$ su

Enter the command to install dbconfig-common package:
# apt-get install dbconfig-common


Add Icinga Repository
If ‘add-apt-repository’ command doesn’t work, install the following package:
# apt-get install python-software-properties

Add Icinga repository with command on Ubuntu:
# add-apt-repository ppa:formorer/icinga

Update sources list:
# apt-get update

Now install Icinga and its dependencies with following command:
# apt-get install icinga icinga-idoutils mysql-server libdbd-mysql mysql-client

Configure idoutils

Create a file /etc/icinga/modules/idoutils.cfg
sudo nano /etc/icinga/modules/idoutils.cfg
Add the following lines:

define module{
        module_name     idomod
        module_type     neb
        path            /usr/lib/icinga/idomod.so
        args            config_file=/etc/icinga/idomod.cfg
        }


Create symbolic links with following command:
# ln -s /usr/lib/icinga/idomod.so /usr/sbin/

Configure ido2db
Open the file /etc/default/icinga:
# nano /etc/default/icinga

Find the line:
# start ido2db daemon (no/yes)
IDO2DB=no

Change the value ‘no’ to ‘yes’:
# start ido2db daemon (no/yes)
IDO2DB=yes

Now start ido2db and restart icinga services:
# /etc/init.d/ido2db start
# /etc/init.d/icinga restart

Monitor Remote Hosts with Icinga

Install nrpe and nagios plugins in your remote system.

To install nrpe & nagios-plugins, enter the command:
$ sudo apt-get install openssl nagios-nrpe-server nagios-plugins nagios-plugins-basic nagios-plugins-standard

Now open /etc/nagios/nrpe.cfg file:
$ sudo nano /etc/nagios/nrpe.cfg

Find the line:
# server_address=127.0.0.1

Uncomment and add your Icinga server IP address as shown below:
server_address=127.0.0.1 192.168.1.201

Here 192.168.1.201 is my Icinga server IP address. Restart nrpe to save changes:
$ sudo /etc/init.d/nagios-nrpe-server restart

Add Remote Hosts to Icinga Server
Now go back to Icinga server side and do the following steps. Open the file /etc/icinga/objects/localhost_icinga.cfg:
# nano /etc/icinga/objects/localhost_icinga.cfg



Add the following lines next to the localhost template:
define host{
        use                     generic-host            ; Name of host template$
        host_name               ubuntu    
        alias                   ubuntu    
        address                 192.168.1.100
        }

Here 192.168.1.100 is my local ubuntu 18.04 desktop.

Add Services for Remote Hosts in Icinga Server

To add a service scroll down further in icinga configuration file. You will find a service templates as shown below. Just add your remote hostname to be monitored separated with comma(,).

define service{
        use                             generic-service         ; Name of servi$
        host_name                       localhost
        service_description             Disk Space
        check_command                   check_all_disks!20%!10%
        }

Now restart icinga services:
# /etc/init.d/icinga restart