Expleo

Grafana https://docs.grootwell.shop/last-day/technologies/monitoring/grafana/custom-dashboard

how alerting works https://docs.grootwell.shop/last-day/technologies/monitoring/prometheus/alertmanager/files-and-flow

promql query https://docs.grootwell.shop/last-day/technologies/monitoring/prometheus/promql

exporter https://docs.grootwell.shop/last-day/technologies/monitoring/prometheus/architecture

linux commands https://docs.grootwell.shop/last-day/experience/expleo https://docs.grootwell.shop/last-day/technologies/linux

jenkins https://docs.grootwell.shop/last-day/technologies/cicd/definition

docker https://docs.grootwell.shop/last-day/technologies/docker/architecture

nginx https://medium.com/@techwithpatil/nginx-use-cases-that-every-engineer-must-know-6b830fb9ed02s

Git https://111762582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaCdv9WDSezCGxI7lGNTt%2Fuploads%2FhQr7Qz7yBLXxV6jOlbbE%2F______Git%20Commands______.pdf?alt=media&token=fe3af523-7911-4526-b05b-56b53cdce36b

kubernetes https://docs.grootwell.shop/last-day/technologies/kubernetes

port and version https://docs.grootwell.shop/last-day/technologies/others/port-and-version

No programming, No cloud

Unix - pkg installation

Linux process and CPU consumption

chevron-rightCPU CMD'shashtag

lscpu or cat /proc/cpuinfo - cpu related all details

nproc - find number of core avaiable

top - View real-time CPU/Memory usage

htop - advanced version of top - colorfull view

ps aux | grep java

vmstat 1 5 - Displays system performance (CPU, memory, disk usage) every 1 second for 5 times.

uptime - total time during which server is active and cpu load

cat /proc/loadavg - show cpu load average

ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | head - Lists processes sorted by highest CPU usage.

dmesg | grep -i cpu - Shows kernel logs related to the CPU.

journalctl -k | grep -i cpu - Checks system logs for CPU errors.

docker stats - Container CPU/Memory Usage

docker top <container_id> display the running processes within a Docker container.

Fix Application or Process Issues

  • Restart high-CPU-consuming processes.

  • Optimize application code (profiling, caching, efficient queries).

  • Use load balancing to distribute traffic.

  • Scale Container - docker-compose up --scale app=3 -d

  • define replicas in docker-compose.yml

  • If a process is stuck, consider killing it:

    kill -9 <PID>   // Application Stops Immediately
chevron-rightMemory CMD'shashtag

free -h - display memory usage

cat /proc/meminfo - display memory info

vmstat 1 5 - show real-time cpu/memory usage

top/htop - show memory usage by process

docker stats

docker top container -id

journalctl -k | grep -i oom

swapon -s - display swap memory usage

Optimize Memory Usage

sync; echo 3 > /proc/sys/vm/drop_caches Clear page cache, dentries, and inodes (can free some memory

Create Swap memory - Swap memory allows your system to move inactive pages from RAM to a designated space on disk that acts as virtual memory

The system moves inactive processes or memory pages that are not frequently used to the swap space to free up RAM

sudo fallocate -l 2G /swapfile2

sudo chmod 600 /swapfile2

sudo mkswap /swapfile2

sudo swapon /swapfile2

sudo sed -i 's#/swapfile2#/swapfile2 none swap sw 0 0#' /etc/fstab

chevron-rightDisk CMD'shashtag

disk space refers to the storage available for the operating system, applications, and user data

When your disk becomes full, it can cause system instability, slow performance, and even application crashes.

df -h - show disk usage for all mounted filesystems (-h for human-readable)

lsblk - show mounted devices and filesystem

du -sh /path/to/directory - disk usage by directory (-s for total disk usage)

dmesg | grep -i "disk" Check the system logs for disk-related issues:

Clean Up Disk Space

sudo apt-get clean

sudo yum clean all

docker system prune -a # Be cautious, this will remove unused containers and images

sudo rm -rf /var/log/*.gz

sudo rm -rf /var/log/*.[0-9]

sudo rm -rf /var/cache/apt/archives/* # Ubuntu/Debian

sudo rm -rf /var/cache/yum/* # CentOS/RedHat

sudo apt autoremove

sudo yum autoremove Remove orphaned packages (dependencies no longer needed)

If your disk is full but you have available space elsewhere or another disk, you may want to resize partitions or add more disk space.

sudo fdisk -l - to view partition (fdisk - utility in Linux used for managing disk partitions.)

sudo fdisk /dev/sda (enter command mode to create, delete, or modify /dev/sda partition)

sudo resize2fs /dev/vda - to resize external filesystem

  • du -sh: Shows the disk usage of a directory or file.

  • sudo mkfs.ext4: Formats a disk or partition with the ext4 filesystem.

  • sudo mount: Mounts a device or partition to a directory.

  • sudo umount: Unmounts a mounted disk or partition.

  • iostat -x: Provides real-time disk I/O statistics.

  • sudo lvextend and sudo resize2fs: Used for managing LVM logical volumes and resizing the filesystem after extension

chevron-rightImportant fileshashtag

Here’s a list of files that you can use to persist various system configurations, processes, and environment settings across reboots:

  1. /etc/environment

    • Used to set environment variables globally for all users.

  2. /etc/fstab

    • Defines how disk partitions, network shares, and file systems are mounted during system boot.

  3. /etc/rc.local

    • A script that can be used to run commands or scripts at the end of the boot process (older systems, may not exist on all distributions).

  4. /etc/init.d/

    • Contains initialization scripts for services that run during startup and shutdown. Custom scripts can be added here.

  5. /etc/systemd/system/

    • This directory holds systemd unit files. You can create a custom service here to run scripts after reboot using systemd.

  6. /etc/crontab

    • A system-wide cron file that can be used to schedule tasks. You can add an @reboot entry to run a script at reboot.

  7. /etc/cron.d/

    • Similar to /etc/crontab, you can place scripts here and use the @reboot directive to schedule them after reboot.

  8. /etc/cron.daily/, /etc/cron.hourly/, /etc/cron.monthly/

    • These directories contain scripts that are run on a daily, hourly, or monthly basis. You can add a script in these directories to run on a regular schedule after reboot.

  9. /etc/profile

    • A system-wide initialization script that sets environment variables and runs commands for all users when they log in.

  10. /etc/bash.bashrc

  • Used for setting environment variables and running commands for all users interacting with Bash.

  1. ~/.bashrc

  • A user-specific script that runs each time a user logs in interactively via Bash.

  1. ~/.profile

  • Another user-specific initialization file that runs when a user logs in. It’s used to set environment variables and run commands.

  1. /etc/hostname

  • Contains the system’s hostname. While not directly related to processes, it's used to set the system's name.

  1. /etc/hosts

  • This file is used to map hostnames to IP addresses locally. It is often used for network configurations that should persist.

  1. /etc/ssh/sshd_config

  • Configures the OpenSSH server. You can modify settings to ensure persistent access via SSH.

  1. /etc/sudoers

  • Defines which users can execute commands with elevated privileges (via sudo), ensuring persistent user permissions.

  1. /etc/security/limits.conf

  • Defines resource limits (like CPU and memory) for users and groups, which persist after reboot.

  1. /etc/smartd.conf

  • Configures SMART (Self-Monitoring, Analysis, and Reporting Technology) settings for hard drives, ensuring persistent monitoring settings.

  1. /etc/apt/sources.list

  • Specifies repositories for package managers like apt. It persists the sources for installing packages.

  1. /etc/yum.repos.d/

  • Contains repository configuration files for YUM-based systems, ensuring persistent access to package sources.

  1. /etc/sysctl.conf

  • Configures kernel parameters at boot. Modifications here will persist across reboots.

  1. /etc/at.deny

  • Specifies which users are not allowed to use the at command (for scheduling one-time tasks).

These files ensure that your system configurations, user preferences, environment settings, and processes persist even after a reboot.

chevron-rightPackage Managementhashtag

RPM is Red Hat Package Manager. developed by Red Hat and is now widely used across many Linux distributions, including Fedora, CentOS, and OpenSUSE,

Debian-based systems (debian package) and package manager dpkg, apt, apt-get in Ubuntu.

Files and Directories for Persisting Processes/Scripts After Reboot:

Redhat (rpm)

Debium (dpkg)

sudo rpm -i package.rpm

sudo dpkg -i package.deb

sudo yum install package.rpm

sudo apt install package.deb

/etc/systemd/system/

For newer systems using systemd, this directory contains service unit files. You can create a custom service to run your script after reboot.

Purpose

RedHat (YUM/DNF)

Ubuntu (APT)

Install a package

sudo yum install package

sudo apt install package

Remove a package

sudo yum remove package

sudo apt remove package

Update package list

sudo yum check-update

sudo apt update

Upgrade installed packages

sudo yum update

sudo apt upgrade

Upgrade full system

sudo yum upgrade

sudo apt full-upgrade

List installed packages

rpm -qa or yum list installed

dpkg -l or apt list --installed

Check if a package is installed

rpm -q package

`dpkg -l

Find package providing a file

rpm -qf /path/to/file

dpkg -S /path/to/file

Show package details

yum info package

apt show package

Download a package without installing

yumdownloader package

apt download package

Clean package cache

sudo yum clean all

sudo apt clean

Remove unused dependencies

sudo yum autoremove

sudo apt autoremove

Enable a repository

sudo yum-config-manager --enable repo

sudo add-apt-repository ppa:repo

Disable a repository

sudo yum-config-manager --disable repo

sudo add-apt-repository --remove ppa:repo

Search for a package

yum search package

apt search package

docker manage and install

chevron-rightInstallhashtag

nginx and proxy for the Java app

jenkins

git commands and conflict

k8s commands and kind

load balancer

etcd

gateway and logs

dockerhub

argocd - k8s

NO CLOUD

On-Premises

linux - basic commands

df -h

check cpu memory

installation of rpm package

chevron-rightRPMhashtag

Here’s a table summarizing RPM package installation and the key package manager commands for yum, dnf, and rpm on Red Hat-based systems.

Action

Command

Description

Install an RPM package

sudo rpm -i package.rpm

Installs a .rpm package manually.

Install an RPM package (with dependencies)

sudo yum localinstall package.rpm

Installs a .rpm package along with its dependencies (useful if the package is not in the repository).

Install an RPM package (with dependencies)

sudo dnf install package.rpm

Installs a .rpm package along with its dependencies (preferred for RHEL 8+).

Install a package (from repositories)

sudo yum install package_name

Installs a package from the configured repositories (RHEL 7 and earlier).

Install a package (from repositories)

sudo dnf install package_name

Installs a package from the configured repositories (RHEL 8+).

Remove a package

sudo yum remove package_name

Removes a package and its dependencies (RHEL 7 and earlier).

Remove a package

sudo dnf remove package_name

Removes a package and its dependencies (RHEL 8+).

Update a package

sudo yum update package_name

Updates an installed package to the latest version from the repository (RHEL 7 and earlier).

Update a package

sudo dnf update package_name

Updates an installed package to the latest version from the repository (RHEL 8+).

Upgrade all packages

sudo yum upgrade

Upgrades all installed packages to the latest available version from the repository (RHEL 7 and earlier).

Upgrade all packages

sudo dnf upgrade

Upgrades all installed packages to the latest available version from the repository (RHEL 8+).

Search for a package

sudo yum search package_name

Searches for packages by name or description (RHEL 7 and earlier).

Search for a package

sudo dnf search package_name

Searches for packages by name or description (RHEL 8+).

List installed packages

sudo yum list installed

Lists all installed packages (RHEL 7 and earlier).

List installed packages

sudo dnf list installed

Lists all installed packages (RHEL 8+).

Check for package updates

sudo yum check-update

Checks if any updates are available for installed packages (RHEL 7 and earlier).

Check for package updates

sudo dnf check-update

Checks if any updates are available for installed packages (RHEL 8+).

Display package information

sudo yum info package_name

Displays detailed information about a package (RHEL 7 and earlier).

Display package information

sudo dnf info package_name

Displays detailed information about a package (RHEL 8+).

Verify an installed package

sudo rpm -V package_name

Verifies an installed package to check for any missing files, altered files, etc.

Query a package (installed or available)

sudo rpm -q package_name

Queries whether a package is installed or available in the RPM database.

List files in an installed package

sudo rpm -ql package_name

Lists all the files installed by a specific package.

Remove a package using RPM

sudo rpm -e package_name

Removes an installed package (without dependency handling, unlike yum/dnf).

Clean the cache

sudo yum clean all

Clears all cached files, metadata, and packages stored by yum.

Clean the cache

sudo dnf clean all

Clears all cached files, metadata, and packages stored by dnf.

Update the package list

sudo yum makecache

Downloads the metadata for all repositories and updates the local cache (RHEL 7 and earlier).

Update the package list

sudo dnf makecache

Downloads the metadata for all repositories and updates the local cache (RHEL 8+).

Notes:

  • yum is used in RHEL 7 and earlier versions, while dnf is used in RHEL 8+ as the default package manager.

  • rpm is the lower-level package manager used for installing, querying, and removing individual RPM packages, without dependency handling like yum or dnf.

you should be aware of basic 25 commands used on daily basis

jenkins - installation

backup

pipeline

stages of pipeline

docker - important

create file

how to run command to run docker volume

how to attach volume and how it works

you have to be used to for those commands

k8s - architecture

basic only

prometheus grafana -

how it monitors what used for exporting data and how data displayed on grafana

how alert manager works .

how can you setup alerts

create custom dashboards on grafaba

Last updated