Resolution
https://access.redhat.com/discussions/917293
wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
yum -y install redhat-lsb libXScrnSaver
yum -y localinstall google-chrome-stable_current_x86_64.rpm
Master Linux, Cloud, and DevOps in one place. This blog provides expert DevOps best practices, Linux administration tips, and cloud infrastructure insights for IT professionals and engineers. Learn how to automate tasks, streamline deployments, and optimize AWS, Azure, and GCP environments using tools like Docker, Kubernetes, Terraform, and Ansible. Perfect for anyone building, scaling, or securing cloud-native systems.
https://access.redhat.com/discussions/917293
wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
yum -y install redhat-lsb libXScrnSaver
yum -y localinstall google-chrome-stable_current_x86_64.rpm
https://github.com/madisoft/s3-pit-restore
s3-pit-restore -b dev-aes-digital-habitat -B dev-aes-digital-habitat -t "02-14-2020 2:37:37 +2"
I want to monitor OS metrics and performance counters of my Amazon Elastic Compute Cloud (EC2) Linux instance. How can I do this using Amazon CloudWatch?
You can create a custom CloudWatch metric for your EC2 Linux instance statistics by creating a script through the AWS Command Line Interface (AWS CLI). Then, you can monitor that metric by pushing it to CloudWatch.
Before proceeding, be sure that you install and configure the AWS CLI for use with the instance that you want to monitor.
Create a custom CloudWatch metric
To create your custom metric:
Log in to the instance through the AWS CLI.
Copy the following bash script, and then save it to your instance (for example, mem.sh).
This example script shows the values that you can publish in CloudWatch. In this example, the put-metric-data API call is used to push the following values to CloudWatch:
========Sample script======
#!/bin/bash
USEDMEMORY=$(free -m | awk 'NR==2{printf "%.2f\t", $3*100/$2 }')
TCP_CONN=$(netstat -an | wc -l)
TCP_CONN_PORT_80=$(netstat -an | grep 80 | wc -l)
USERS=$(uptime |awk '{ print $6 }')
IO_WAIT=$(iostat | awk 'NR==4 {print $5}')
aws cloudwatch put-metric-data --metric-name memory-usage --dimensions Instance=i-0c51f9f1213e63159 --namespace "Custom" --value $USEDMEMORY
aws cloudwatch put-metric-data --metric-name Tcp_connections --dimensions Instance=i-0c51f9f1213e63159 --namespace "Custom" --value $TCP_CONN
aws cloudwatch put-metric-data --metric-name TCP_connection_on_port_80 --dimensions Instance=i-0c51f9f1213e63159 --namespace "Custom" --value $TCP_CONN_PORT_80
aws cloudwatch put-metric-data --metric-name No_of_users --dimensions Instance=i-0c51f9f1213e63159 --namespace "Custom" --value $USERS
aws cloudwatch put-metric-data --metric-name IO_WAIT --dimensions Instance=i-0c51f9f1213e63159 --namespace "Custom" --value $IO_WAIT
===============================================
$ chmod +x mem.sh
Push your metric to CloudWatch
$ crontab -e
*/1 * * * * /home/ec2-user/mem.sh
When the crontab is saved, crontab: installing new crontab appears.
Monitor your EC2 instance
Find your custom metric in the CloudWatch console:
Open the CloudWatch console.
Choose Metrics.
Choose the All Metrics tab.
Choose Custom.
Choose the dimension Instance.
Select your custom metric by its InstanceId and Metric Name.
View the graph of your metric.
Other uses
You can use this example to build your own logic to process multiple dimensions, and then push that metric data to CloudWatch.
For example, suppose that you benchmark your application. Then, you discover that when the I/O wait time and percentage memory usage reach a certain threshold, the system stops functioning properly. To address this problem, you can monitor both values simultaneously in a script. Store the logical AND of the values in a third variable that you push to CloudWatch.
c=0
if [[ $IO_WAIT > 70 && $USEDMEMORY > 80 ]]
then
c=1
fi
aws cloudwatch put-metric-data --metric-name danger --dimensions Instance=i-0c51f9f1213e63159 --namespace "Custom" --value $c
For normal conditions, this variable is 0 (zero). For situations when both conditions are met, the value is set to 1 (one). You can then build custom alarms around these parameters to warn of problematic situations for your system.
#!/bin/bash
PASSWORD="XXXXXXXXX"
RDS_ENDPOINT=XXXXXXXXXXXXXXXXX
PORT=5432
DUMPNAME=dev-api-db-psql-dump.sql
USER=postgres
DBNAME=dev_aes_database
TARFILENAME=dev-api-db-psql-dump-"$(date +"%d-%m-%Y--%H-%M")".sql.tar
S3_PATH=XXXXXXX
LOCALPATH=/opt/aes-np-api-db-psql-dump
LocalFile=dev-api-db-psql-dump*
cd $LOCALPATHPGPASSWORD=$PASSWORD pg_dump -h $RDS_ENDPOINT -p $PORT -f $DUMPNAME -U $USER $DBNAME
# Command to create DB dump from psql database
tar -czf $TARFILENAME $DUMPNAME
# This will create zipped tar file from DB dump
rm -rf $DUMPNAME
# This will remove dump file from server i.e. from /opt/aes-np-api-db-psql-dump
aws s3 mv $LOCALPATH/$LocalFile $S3_PATH
# copying local tar file to s3 bucket
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/mon-scripts.html#mon-scripts-getstarted
STEP 1:
To install the required packages on Red Hat Enterprise Linux 7
Log on to your instance. For more information, see Connect to Your Linux Instance.
At a command prompt, install packages as follows:
sudo yum install unzip perl-Switch perl-DateTime perl-Sys-Syslog perl-LWP-Protocol-https perl-Digest-SHA --enablerepo="rhui-REGION-rhel-server-optional" -y
STEP 2:
The following steps show you how to download, uncompress, and configure the CloudWatch Monitoring Scripts on an EC2 Linux instance.
To download, install, and configure the monitoring scripts
At a command prompt, move to a folder where you want to store the monitoring scripts and run the following command to download them:
sudo curl https://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.2.zip -O
Run the following commands to install the monitoring scripts you downloaded:
sudo unzip CloudWatchMonitoringScripts-1.2.2.zip
sudo rm CloudWatchMonitoringScripts-1.2.2.zip
sudo chown -R opsadminuser:opsadminuser aws-scripts-mon/
cd aws-scripts-mon
The package for the monitoring scripts contains the following files:
sudo corntab -e
First download the Oracle Java from Oracle website
https://www.oracle.com/technetwork/java/javase/downloads/index.html
then go to the server and SCP the jdk and installed the JAVA
sudo rpm -ivh jdk-8u211-linux-x64.rpm
sudo find / -name java
cd /usr/java/jdk1.8.0_211-amd64
pwd
vi ~/.bashrc
export JAVA_HOME=/usr/java/jdk1.8.0_211-amd64
source
~/.bashrc
java -version
https://docs.aws.amazon.com/cli/latest/userguide/install-bundle.html
If you don't have sudo permissions or want to install the AWS CLI only for the current user, you can use a modified version of the previous commands.
$ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
$ unzip awscli-bundle.zip
$ ./awscli-bundle/install -b ~/bin/aws
This installs the AWS CLI to the default location (~/.local/lib/aws) and creates a symbolic link (symlink) at ~/bin/aws. Make sure that ~/bin is in your PATH environment variable for the symlink to work.
$ echo $PATH | grep ~/bin // See if $PATH contains ~/bin (output will be empty if it doesn't)
$ export PATH=~/bin:$PATH // Add ~/bin to $PATH if necessary
Tip
To ensure that your $PATH settings are retained between sessions, add the export line to your shell profile (~/.profile, ~/.bash_profile, and so on).
The bundled installer doesn't put anything outside of the installation directory except the optional symlink, so uninstalling is as simple as deleting those two items.
$ sudo rm -rf /usr/local/aws'
$ sudo rm /usr/local/bin/aws
Install lvm2 through by YUM
sudo yum install lvm2* -y
//create a PV in machine
sudo pvcreate /dev/xvdb
sudo pvs
//create a VG in machine
sudo vgcreate vg-fusion-01 /dev/xvdb
sudo vgs
sudo vgdisplay
//create a LV in machine
sudo lvcreate -L 199G -n lv-fusion-01 vg-fusion-01
sudo lvs
sudo fdisk -l
sudo lvs
sudo lvdisplay
//create a FILESYSTEM in machine
sudo mkfs.ext4 -j /dev/vg-fusion-01/lv-fusion-01
lsblk
//MOUNT the LV
sudo mkdir -p /opt/lucidworks
//change the PERMISSION of FOLDER
sudo chown -R opsadminuser:opsadminuser lucidworks/
sudo chmod o+x lucidworks/
//Permanent mount
vi /etc/fstab
/dev/vg-solr-01/lv-solr-01 /opt/lucidworks/ ext4 defaults 0 0
Commands
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce=18.06.1~ce~3-0~ubuntu
sudo apt-mark hold docker-ce
sudo docker version
DevOps is about people, process and products. To realize the full benefits of DevOps we'll address all three aspects. We'll start with the products aspect of DevOps
DevOps is the union of people, process, and products to enable continuous delivery of value to our end users.
Make sure that the pipeline is running smoothly – This is one of the most important task of a DevOps engineer to make sure that CI/CD pipeline is intact and fixing any issue or failure with it is the #1 priority for the day. They often need to spend time on troubleshooting, analysing and providing fixes to issues.Interaction with other teams – Co-ordination and collaboration is the key for DevOps to be successful and hence daily integration with Dev and QA team, Program management, IT is always required.
Work on Automation Backlog – Automation is soul of DevOps so DevOps engineering need to plan it out and I can see DevOps engineer spending lots of time behind the keyboard working on Automating stuff on daily basis.
Infrastructure Management – DevOps engineer are also responsible for maintaining and managing the infrastructure required for CI/CD pipeline and making sure that its up and running and being used optimally is also part of their daily schedule. Ex. Working on Backup, High Availability, New Platform setup etc.
Dealing with Legacy stuff – Not everyone is lucky to work on latest and newest things and DevOps engineers are no exception hence they also need to spend time on legacy i.e. in terms of supporting it or migrating to the latest.
Exploration – DevOps leverage a lot from the various tools which are available, there are many options as open source so team need to regularly check on this to make sure the adoptions as required, this is something which also require some effort not on daily but regular basis. Ex. What are open source options available to keep the cost at minimum?
Removing bottleneck – DevOps primary purpose is identify the bottlenecks / Manual handshakes and work with everyone involved (Dev / QA and all other stakeholder) to remove them so team spend good amount of time in finding such things and build the Automation Backlog using this. Ex. How we can get builds faster?
Documentation – Though Agile / DevOps stresses less on the documentation, it is still the important one which DevOps engineer does on daily basis, Be it Server Information, Daily Week charted, Scrum / Kanban board or Simple steps to configure / backup or modify the infrastructure, you need to spent good amount of time in coming up these artifacts.
Training and Self Development – Self leaning and Training is very useful in getting better understanding and many organisations encourage their employee to take the time out and do some of these and same holds true for DevOps folks as well, So learn something new everyday...
Continuous Improvement as Practice – Last but not least, It’s up to the DevOps folks to build awareness on the potential of CI/CD and DevOps practices and building a culture of leveraging it for doing things better, reducing re-work, increasing the productivity and optimising the use of existing resources. Go and talk to people to build the DevOps and Continuous Improvement culture...Help design, build, test and configure our next generation containerized micro services platform (Docker)