It is quite common practice when adding a new drive to a Linux system to reboot the system afterwards so that the server can re-scan its hardware and detect the change. However, every now and then we get to make changes to a server that we don't want to reboot it for some reason. Or maybe you are lazy, like me and don't want to wait 1 min to reboot. In any case, bellow is a way to make your system re-scan the hardware and detect the changes.
Showing posts with label how-to. Show all posts
Showing posts with label how-to. Show all posts
Saturday, February 13, 2016
Thursday, February 4, 2016
Linux | How to search for a particular string in multiple files
Every now and then I find myself into a situation where I have to search for a particular string from a set of files, and every time I have to remind myself again.
Here -r or -R is recursive, -n is line number and -w stands match the whole word. We can also add -l (lower-case L) to just give the file name of matching files.
As the old proverb says: "The fool remembers, the smart writes down."
That is why I decided to write this down, so that I can come back and find it again.
# grep -rnw '/path/to/somewhere/' -e "pattern"
Here -r or -R is recursive, -n is line number and -w stands match the whole word. We can also add -l (lower-case L) to just give the file name of matching files.
So in my current example, I work on Nagios and I want to find the file containing that check_snmp command i would type:
# grep -rnw '/etc/nagios/objects/' -e 'check_snmp'
Which will produce the output:
/etc/nagios/objects/commands.cfg:147:# 'check_snmp' command definition
/etc/nagios/objects/commands.cfg:149: command_name check_snmp
From here we can basically see the file where check_snmp is defined along with the line number of that file.
Extending the command with --include or --exclude parameter we can create neatly commands to also search for files with particular extension. The bellow command will check only .cfg or .conf files.
# grep --include=\*.{cfg,conf} -rnw '/etc/nagios/objects/' -e 'check_snmp'
# grep --exclue=\*.0 -rnw '/etc/nagios/objects/' -e 'check_snmp'
And as always:
RTDM!
RTDM!
# man grep
Monday, December 21, 2015
CentOS 7 | Installation and setup of Icinga2 monitoring service - Part 2 - Setting up the Icinga Web 2 interface
This is part 2 of the tutorial where I'll be setting up the Icinga Web 2 web fronted from where we can log into our Icinga2 server and actually monitor our infrastructure.
If you came here from Google than you can find Part 1 here.
If you came here from Google than you can find Part 1 here.
Labels:
centos7,
how-to,
icinga2,
installation,
linux,
monitoring
CentOS 7 | Installation and setup of Icinga2 monitoring service - Part 1
Knowing that there is a newer fancier Nagios fork called Icinga I always wanted to try it out, but
I really haven't got the time to do that. Finally when I got the time I realized that online guides for that are missing too. Being a CentOS supporter, I decided that during that process i could write a tutorial for CentOS 7.
This is the part 1 of the tutorial where I'll be going through the steps for preparing the server and setting up the Icinga2 service. In part two I'll be going through the steps for installing and setting up the Icingaweb2 web service which basically is one of the several available Incinga2 front-end applications.
I really haven't got the time to do that. Finally when I got the time I realized that online guides for that are missing too. Being a CentOS supporter, I decided that during that process i could write a tutorial for CentOS 7.
This is the part 1 of the tutorial where I'll be going through the steps for preparing the server and setting up the Icinga2 service. In part two I'll be going through the steps for installing and setting up the Icingaweb2 web service which basically is one of the several available Incinga2 front-end applications.
Labels:
centos7,
how-to,
icinga2,
installation,
linux,
monitoring,
nagios
Subscribe to:
Posts (Atom)