
At work we have a few routers, switches and servers that if they go down we want to know right away. The last thing we want is the CEO coming to our desk asking why the mail server is down or why the webserver it not responding.
I wrote a little script a very simple one that given a list of hosts and IP addresses will ping a host and if it is detected as down it will send you an email right away.
########## Instructions on how to use this monitor script ############
Make a directory called scripts
mkdir /scripts then inside create using your favorite text editor the following script
#!/bin/bash
# Ping Alert Monitor by Marco Maldonado V 1.0
# Create a hosts file and save it somewhere on your server
# specify a path and an email address where you want to send alerts
#
# Note: Your hosts file should have the IP address of the host followed by a space and the name
# of the server: Example Below
#
# 69.147.76.15 www.yahoo.com
# 209.85.165.147 wwww.google.com
#
# Path to your hosts file
HOSTS="/scripts/hosts"
# Email address where to send alerts, you can add more addresses followed by a comma
EMAIL="yourname@yourdomain,someaddres@gmail.com"
### Do not edit anything below ############
for myHost in `cat $HOSTS | cut -d' ' -f1` ; do
ping -c 1 $myHost > /dev/null
if [ $? -ne 0 ] ; then
echo “Server `grep $myHost $HOSTS` is down reported down at `date`” | mail -s “Ping Alert Server `grep $myHost $HOSTS` might be down” $EMAIL
fi ;
done
Read the rest of this entry »
Posted by tepezcuintle as Bash Scripting at 9:38 PM CDT
No Comments »
If your system abruptly loses power, or if a RAID card is beginning to fail, you might see an ominous message like this within your logs:
EXT3-fs error (device hda3) in start_transaction: Journal has aborted
Basically, the system is telling you that it’s detected a filesystem/journal mismatch, and it can’t utilize the journal any longer. When this situation pops up, the filesystem gets mounted read-only almost immediately. To fix the situation, you can remount the partition as ext2 (if it isn’t your active root partition), or you can commence the repair operations.
Read the rest of this entry »
Posted by tepezcuintle as General Linux at 1:38 PM CDT
No Comments »
At work i setup a programming environment for developers. The server is on a natted IP address range and could not send email to our internal mail server because of some weird firewall issues.
All email going to external sites was working fine but to send to our internal domain it wouldn’t work so i had to figure out how to get emails out. I am running postfix on the server so what I did i had postfix relay the mail to my ISP’s mail server. I had done this in the past using sendmail but with postfix I had to do the following.
Read the rest of this entry »
Posted by tepezcuintle as Email Servers and Spam at 4:45 PM CDT
No Comments »

Digital certificates have become an essential part of
Internet commerce, and are widely used to verify the identity
of clients and servers. All digital certificates contain an
expiration date which most client and server applications will
check before using the certificates contents. If a client or
server application detects that a certificate has expired, one
or more implementation specific actions (e.g., abort
connection, check or update a revocation list, alert user,
etc.) are typically performed.
When a web browser encounters an expired certificate, the
browser will normally present the user with a warning message
indicating that the certificate has expired. Some browsers will
continue connecting to the site after presenting the user with
the warning, while others will prompt the user with a dialog
box requesting their approval to proceed. These warnings are
extremely confusing for the typical web user, and cause most
users to question the authenticity of the site they are
attempting to view.
Read the rest of this entry »
Posted by tepezcuintle as Computing Tips at 8:46 PM CDT
No Comments »

SELinux can sometimes get
in your way. For example, I have had typical services, such as Apache, appear
to start up correctly, but remain inaccessible from the outside world because
I forgot to allow the apache user rights to open that port or maybe my distro
forgot about it. Before you turn off SELinux make sure you know why
you are turning it off and the security concerns you might be opening yourself
up to.
Read the rest of this entry »
Posted by tepezcuintle as Uncategorized at 4:27 PM CST
No Comments »
I found this command useful in finding out which top 10 processes are hogging my CPU resources. Note that this command is specific to the Red Hat flavor of Linux. See the man page for ps for the correct output format to use for your specific platform:
Read the rest of this entry »
Posted by tepezcuintle as Work Related at 4:25 PM CST
No Comments »

Our db manager wanted to know the current patch level on our Solaris system
Here’s the commands.
#showrev -p
or
#patchadd -p
Recommend you use showrev -p since it’s a binary program. The patchadd utility is a script; therefore, it takes awhile to run.
To check the Solaris version cat /etc/release
Posted by tepezcuintle as Work Related at 4:24 PM CST
No Comments »

—————————————————————————-
List all services on at run level 1:
# chkconfig –list | grep 1:on
—————————————————————————-
Enable a service:
# chkconfig cups on
—————————————————————————-
Read the rest of this entry »
Posted by tepezcuintle as General Linux at 4:06 PM CST
No Comments »

why awk?
awk is small, fast, and simple, unlike, say, perl. awk also has a
clean comprehensible C-like input language, unlike, say, perl. And
while it can’t do everything you can do in perl, it can do most things
that are actually text processing, and it’s much easier to work with.
Read the rest of this entry »
Posted by tepezcuintle as Uncategorized at 4:05 PM CST
No Comments »

These are really great tips. I have used many of these tips during my time working as a systems administrator and they always come in handy.
Found here
The best systems administrators are set apart by their efficiency.
And if an efficient
systems administrator can do a task in 10 minutes that would take another
mortal two hours to complete, then the efficient systems administrator
should be rewarded (paid more) because the company is saving time, and
time is money, right?
Read the rest of this entry »
Posted by tepezcuintle as Advanced Stuff at 3:13 PM CST
No Comments »