As a contributor in the feenixdv, my responsibilities have encompassed Requirement Analysis, Application Development, Production Support,, and Testing. These tasks have been integral parts of my assignments, and I have been actively engaged in each of these areas to deliver successful outcomes.
Month: August 2018
Customer Message
Custom Nagios Report In Excel-Sheet
Report like:-
Date Time Critical Warning Unknown HostUnreachable Total Hosts
2014-01-15 06:31 3 6 0 0 103
2014-01-15 06:31 3 6 0 0 103
2014-01-15 11:38 12 13 0 0 103
– Put this shell script and save it
# vi Report.sh
date=`date +%Y-%m-%d`;
time=`date +%H:%M`;
#Tolal Service CRITICAL WARNING UNKNOWN
wget –user nagios_user –password 'password' –no-check-certificate -O ./Service_Alerts.html "http://XXXXXXXX/nagios//cgi-bin/summary.cgi?report=1&displaytype=1&timeperiod=today&hostgroup=all&servicegroup=all&host=all&alerttypes=2&statetypes=2&hoststates=3&servicestates=56" >>/dev/null 2>/dev/null
#Tolal host Unreachable or Down
wget –user nagios_user –password 'password' –no-check-certificate -O ./Host_Alerts.html "http://XXXXXXXX/nagios//cgi-bin/summary.cgi?report=1&displaytype=1&timeperiod=today&hostgroup=all&servicegroup=all&host=all&alerttypes=1&statetypes=2&hoststates=3&servicestates=56" >>/dev/null 2>/dev/null
#Total host
wget –user nagios_user –password 'password' –no-check-certificate -O ./Host_All.html "http://XXXXXXXX/nagios/cgi-bin/avail.cgi?show_log_entries=&timeperiod=today&host=all&rpttimeperiod=&assumeinitialstates=yes&assumestateretention=yes&assumestatesduringnotrunning=yes&includesoftstates=no&initialassumedhoststate=3&initialassumedservicestate=6&backtrack=4" >>/dev/null 2>/dev/null
echo $date >data
echo $time >>data
cat Service_Alerts.html |grep CRITICAL |wc -l >>data
cat Service_Alerts.html |grep WARNING |wc -l >>data
cat Service_Alerts.html |grep UNKNOWN |wc -l >>data
cat Host_Alerts.html |grep CRITICAL |wc -l >>data
cat Host_All.html |grep host |wc -l >>data
awk -vRS="\n" -vORS="\t" '1' data >>Report.xls
echo "" >>Report.xls
echo "done"
– Now you can set Cron job to scheduel it.
RHEL 7 Article
ACCESS CONTROL LIST (ACL)
We assign permission to the specific file to providing security, but still it has some limitation just like if we set 777 permission for a file, it set for all the user, but now if we have a need that just user1 can execute the file then it will be problematic so we cannot assign different permissions for different users so ACL comes in.
Now we set permission for file.txt
1st we create “file.txt” in “/tmp” directory then set ACL with “setfacl” command where m ( modify ) u (user name) then permission and location of a file.
How to see ACL list. We have “getfacl command”
Through ACL we give permission to ram user to modify the file.
Check how it’ work
It’s working.
To remove ACL
Analyzing past System performance
Analyzing past System performance of a Linux server
Case
Today's date is 17th Dec 2012.
You are asked to check the System performance of a Linux server on 7th Dec,2012 between 1 AM to 5 AM.
# To check CPU utilization
# sar -u -f /var/log/sa/sa07 -s 01:00:01 -e 05:00:01
… # To check Memory status
#sar -r -f /var/log/sa/sa07 -s 01:00:01 -e 05:00:01
# To check Load average
#sar -q -f /var/log/sa/sa07 -s 01:00:01 -e 05:00:01
# To check Network status
#sar -n DEV -f /var/log/sa/sa07 -s 01:00:01 -e 05:00:01
Apache Monitoring
The Status module allows a server administrator to find out how well their server is performing. An HTML page is presented that gives the current server statistics in an easily readable form. If required this page can be made to automatically refresh (given a compatible browser). Another page gives a simple machine-readable list of the current server state.
The details given are:
- The number of worker serving requests
- The number of idle workers
- The status of each worker, the number of requests that the worker has performed and the total number of bytes served by the worker
- A total number of accesses and byte count served
- The time the server was started/restarted and the time it has been running for
- Averages giving the number of requests per second, the number of bytes served per second and the average number of bytes per request
- The current percentage CPU used by each worker and in total by Apache
- The current hosts and requests being processed
How do I configure mod_status to display Apache web server status?
Enable/uncomment mod_status.so module
# vi httpd.conf
Enable/uncomment “ServerSignature”
Create virtual section
Restart apache service
Access apache status in a web browser
Autofs
Autofs
Configuration for USB mass storage, DVD, CDROM, IDE hard drives. Now drives are automatically mounted when you try to access them. You can test it by inserting a cdrom, and cd /mnt/auto/autofs/cdrom . The CDROM is automatically mounted, and ls should show you the contents of the cd.
autofs uses /etc/auto.master and /etc/auto.misc file.
Example:-
We want to auto mount CDROM when we list “/mnt” directory(ls /mnt).
Put “/mnt /etc/auto.misc” line in “/etc/auto.master” file.
Then edit “/etc/auto.misc”
Restart service
Check directory
Create Partition
How to create a partition
CRON JOB
We put a small script in a cron job and change permission to execute.
Now modify cron job using “crontab –e”.
This script run every one minute.
As per script, we can see it’s updated in every one minute.
Some example:-
00 09-18 * * 1-5
- 00 – 0th Minute (Top of the hour)
- 09-18 – 9 am, 10 am,11 am, 12 am, 1 pm, 2 pm, 3 pm, 4 pm, 5 pm, 6 pm
- * – Every day
- * – Every month
- 1-5 -Mon, Tue, Wed, Thu, and Fri (Every Weekday)
00 09-18 * * *
- 00 – 0th Minute (Top of the hour)
- 09-18 – 9 am, 10 am,11 am, 12 am, 1 pm, 2 pm, 3 pm, 4 pm, 5 pm, 6 pm
- * – Every day
- * – Every month
- * – Every day of the week
Unable to change the password for any user
If we are unable to change the password for any user or during login always asking for password and then force to change the password ( after changing automatic logout ) then check below points.
- Reboot server in rescue mode(chroot…) and try to change the password or check “/etc/fstab” file.
-
If chroot not working and your partition in LVM then try to 1st activate LVM by below command.
# lvm vgchange -a y
- After that mount root partition ( / ) on any directory and check “/etc/fstab” file, maybe root partition ( / ) commented. uncomment it and reboot it.
- After that reboot. Now you can change the password and also login into the server.
Record Terminal Session in Linux
ttyrec is a tty(terminal) recorder in Unix like operating system & recorded data can be played back with the help of ttyplay command.ttyrec is just a derivative of script command for recording timing information with microsecond accuracy as well. It can record emacs -nw, vi, lynx, or any programs running on tty.
Jenkins Installation RHEL7/Centos7
Jenkins Installation and Configuration Steps on RHEL 7/Centos 7
Server details:-
Linux ansible 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
CentOS Linux release 7.1.1503 (Core)
Jenkins Features:–
- Easy configuration.
- Distributed builds.
- Plugin Support
- Easy integration with SMTP to send out emails.
- Lightweight.
- Open source.
- Cross platform
- Provide statistics in the form of graphs if required.
Jenkins Installation and Configuration Steps on RHEL 7/Centos 7
By default Jenkins package is not available on the RHEL/Centos repositories. Therefore, that need to add and import the jenkins repository on machine by using below commands.
|
[root@feenixdv ~]# wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo [root@feenixdv ~]# rpm –import https://jenkins-ci.org/redhat/jenkins-ci.org.key |
Now simply install Jenkins by running the following command –
|
[root@feenixdv ~]#yum install jenkins |
After installation, start Jenkins services –
|
[root@feenixdv ~]# systemctl restart jenkins.service [root@feenixdv ~]# systemctl enable jenkins |
Jenkins runs on port 8080, Enable/Allow port 8080 from firewall by following below commands
|
[root@feenixdv ~]# firewall-cmd –permanent –add-port=8080/tcp success [root@feenixdv ~]# firewall-cmd –reload |
Jenkins by default runs on port 8080. To access Jenkins open up a browser and type in
http://localhost:8080/ or http://<IP_OF_SERVER>:8080/
First time you need to configure account. Welcome page asking about "Unlock Jenkins". You need to copy password from "/var/lib/jenkins/secrets/initialAdminPassword" and past as administrator password.
|
[root@ansible ~]# cat /var/lib/jenkins/secrets/initialAdminPassword 75cc71d35216448d814bbcb4b8be624f |
Click on continue button. Select the option “Install suggested plugins”.
After done with plugin installation it will ask to create Admin user
Click on “Save and Finish” button.
If you are using proxy server for internet access, then during plugin installation you are getting error.
You need to setup proxy information on Jenkins.
Then click on “submit”.
Delivery Pipeline View In Jenkins
Delivery Pipeline View
Plugin Name: – Delivery Pipeline Plugin
This plugin visualize Delivery Pipelines (Jobs with upstream/downstream dependencies)
To install this plugin follow below process.
After click on “Available” put plugin name in “Filter”
How to create Delivery Pipeline.
Step1:- Create a new view.
Step2:- Select good view “Delivery pipeline view”.
Step3:- Add pipeline.
Step4:- Fill details. Select initial jobs from where the process starts. In my case job name is “Git_Commit”.
After finish, we can see your jobs in the below view.
In this example fours, jobs clubbed with each other.
When Git_Commit finished then automatic next job “Build_Process” launched. Same for Build_Process and next all.
For linkup, all jobs, which is part of the master pipeline, are triggered by one by one with required checks.
Categorized-view In Jenkins
Useful Jenkins Plugins.
Categorized Jobs View
Plugin Name: – categorized-view
This plugin introduces a new view on which you can create collapsible groups of jobs based on regular expressions.
To install this plugin follow below process.
After click on “Available” and put plugin name in “Filter”
How to categorize jobs.
On Jenkins, the main page clicks on new view and follow these steps.
Step1:- put view name and select categorized jobs view.
Step2:- check regular expression and put filter text. In an example, we grep all jobs which have “PROCESS” word (not case sensitive).
Step3:- create a regex-grouping rule to not categorize.
Step4:- we can put multiple regex-grouping. In an example, we filter jobs name, which has “BUILD” key word with the name “AM”. Only categorize from an output of step 2 filter.
Step5:- jobs view.
contact Us
Amitendra
Amitendra is a DevOps enthusiast, also a fan of open source and Linux-based system software like ORACLE, with approximately 10 years of experience working with Linux distribution servers and bash scripting. He loves to share ideas and knowledge with people around him and in different places across the world.
Bibhuti
I am Bibhuti Narayan, holding a significant and multifaceted role. As the Founder & Chief Editor, I am responsible for establishing and leading the website. Overseeing content strategy and quality, I shape the direction of published materials. Beyond my editorial responsibilities, I am also a proficient DevOps and Cloud Engineer. My expertise in managing the website’s infrastructure ensures its smooth and efficient functioning, incorporating the latest DevOps and cloud technologies. Additionally, I actively contribute content, utilizing Feenixdv as a platform to share my thoughts and ideas with the world, reflecting my passion for inspiring others through my work.






