To search for text through the entire filesystem from the current path down in Linux use the following :
find / -type f -print0 | xargs -0 grep -l "string to search" 2>/dev/null
To search for text through the entire filesystem from the current path down in Linux use the following :
find / -type f -print0 | xargs -0 grep -l "string to search" 2>/dev/null
Listing the mac addresses of nic cards excluding null or loopback MACs i.e. 00:00:00:00:00:00
grep -H . /sys/class/net/*/address | awk ‘{split($0,array,”address:”);print array[2]}’ | grep -v ’00:00:00:00:00:00′
Since live systems are near to impossible to fsck when running (unless you can pull one side of the mirror then clone it to the other (very messy).
Become Root
sudo su –
or
su –
As root create file in root folder a file named forcefsck
touch /forcefsck
Restart the system.
shutdown -r now
Though there are many ways to redirect using the HTTP 301 status code.
(make sure the AllowOverride is set to all on the apache config)
The .htaccess must be as follows:
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^orig.domain.com [nc]
rewriterule ^(.*)$ http://new.domain.com/
$1 [r=301,nc]
Replace the orig.domain.com and new.domain.com with the ones needed for your case of course.
You can setup logs for checking the rewriting though be warned enable them only when debugging they are hugely intensive on I/O and CPU on a heavy utilised server.
More info here : http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritelog
/usr/local/nagios/libexec/check_ifstatus -H localhost
 
Can’t locate Net/SNMP.pm in @INC (@INC contains: /usr/local/nagios/libexec /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 .) at ./check_ifstatus line 38.
BEGIN failed–compilation aborted at ./check_ifstatus line 38.
Solution:
yum install perl-Net-SNMP
After testing a nagios configuration update ( including a new service or renaming some host etc..) before committing the changes and reloading / restarting the nagios service a good test is the following:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
(more…)
On one of my servers running CentOS 6 I had iptraf not displaying the boxes in dialogues correctly. It’s usually fixed by updating the session configuration on putty to translate to utf-8 but in this case that did not work.
While the system is a clone from another machine where it works well (puppet confirms) all I had to do is create an alias in my ./bashrc for iptraf to NCURSES_NO_UTF8_ACS=1 iptraf as such :
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias iftop='NCURSES_NO_UTF8_ACS=1 iftop'
alias iptraf='NCURSES_NO_UTF8_ACS=1 iptraf'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
As you can deduce the same issue and solution happened with iftop. 🙂
Oh the result :
Ejnoy 🙂
If you need to automate the retrieval of the latest Nagios version path to download this is how I do it.
Nothing fancy and it breaks if they change the sourceforge site but we can fix when that happens 🙂
curl -v http://www.nagios.org/download/core/thanks/ 2>&1 | grep tar\.gz | cut -d \” -f 2 | sort -r | head -n 1
Result:
http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.1.tar.gz
Of course this comes in handy when pulling for the clients being monitored so by extension:
curl -v http://www.nagios.org/download/plugins/ 2>&1 | grep tar\.gz | cut -d \” -f 2 | sort -r | head -n 1
Result:
http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.16.tar.gz
Getting the files in a script is as easy as :
curl -v http://www.nagios.org/download/plugins/ 2>&1 | grep tar\.gz | cut -d \” -f 2 | sort -r | head -n 1 | xargs wget
Ping me if this stops working for you.
Enjoy.
Wireshark uses display filters for general packet filtering while viewing and for its ColoringRules.
The basics and the syntax of the display filters are described in the User’s Guide.
The master list of display filter protocol fields can be found in the display filter reference.
If you need a display filter for a specific protocol, have a look for it at the ProtocolReference.
Show only SMTP (port 25) and ICMP traffic:
tcp.port eq 25 or icmp
Show only traffic in the LAN (192.168.x.x), between workstations and servers — no Internet:
ip.src==192.168.0.0/16 and ip.dst==192.168.0.0/16
# yum install yum-priorities
# rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
Install the JPackage Project repository.