I do a lot of work with virtual machine images. I ran in to a situation where I wanted to copy a file called System.img from one server to another and even though I knew I had enough room to do it, I would get messages stating that there was not enough space. What in the world was going on? The file system I wanted to copy the file to was 33G in size. The file was just under 33G in size. I knew it should fit. I knew this because the file system this file is coming from is also 33GB in size (same identical size). When it was all said and done I should of had about 150M of free space according to the source.
I tried FTP, SCP, and various other mechanisms to copy the file from the one server to the other. No joy.
So I copied the file to the destination server but to a different and larger file system. That obviously was successful, but I still wanted it on my 33G file system. So I tried copying the file locally from the larger file system to the 33G file system. No joy again... I got a message after a few minutes stating there was not enough space, and the process errored out.
I found a solution! Now, to be honest, I do not know why it works, but it does.
Assumptions: You are in the directory the System.img file is located. The file resides on the same server you are copying to. You have done the math and according to the calculator the file will fit on the destination file system.
Run this command with the appropriate path of your destination.
Note: The following command is all on one line.
# tar cvf - System.img | ( cd /destination file system/destination folder/;tar xvf - )
Works like a charm. I have used this little gem a dozen times in the past few months.
This should be obvious but... Remember, you can not copy/place a file that is larger than the space available on the destination. Hope this helps others out there.
Monday, February 15, 2010
Tuesday, January 12, 2010
Filesystem Replication Using rsync and SHH
There are many reasons you may need to replicate a file system. My reason was for DR purposes. In a previous post I set up Passwordless SSH sessions between two systems. This is a requirement if you want to sync file systems on an automated schedule. I looked on the web for a script that would do what I wanted and I could not find something that met my needs. So I wrote the script below. To give credit where credit is due, I borrowed from some ideas and code from Randal K. Michael, author of Mastering UNIX Shell Scripting. I placed the script below in /usr/local/bin directory on the "source" node and called it fsrsync.bash. This script will replicated a designated filesystem from a source node to two different nodes after confirming they are "alive". I used rsync because after the initial sync, future replications are much faster since only update and/or changes are sent and not the entire filesystem.
Here is the script below. Highlight the contents and select copy.
Note: When you grab the test here and paste it, do a sanity check on the text to verify the formatting has not changed.
Edit/create /usr/local/bin/fsrsync.bash and paste in the contents.
# vi /usr/local/bin/fsrsync.bash
Script starts below.
#!/bin/bash
#
# SCRIPT: fsrsync.bash
# AUTHOR:
# DATE:
# REV:
#
# PURPOSE: This script is used to replicate the
# /somedir/test filesystem from Node A to Node B and C
#
# set -x # Uncomment to debug this script
#
# set -n # Uncomment to check the script.s syntax
# # without any execution. Do not forget to
# # recomment this line!
#
##############################################
# DEFINE FILES AND GLOBAL VARIABLES HERE
##############################################
# Define the target machines to copy data to.
# To specify more than one host enclose the
# hostnames in double quotes and put at least
# one space between each hostname
#
# EXAMPLE: MACHINE_LIST="fred yogi booboo"
MACHINE_LIST="nodeB nodeC"
# Capture the shell script file name
THIS_SCRIPT=$(basename $0)
# The FS_PATTERN variable defines the regular expression
# matching the filesystems we want to replicate with rsync.
# Example: FS_PATTERN="/home"
FS_PATTERN="/somedir/test"
# Query the system for the hostname
THIS_HOST=$(hostname)
##############################################
# BEGINNING OF MAIN
##############################################
# Comfirm the nodes are alive and replicate
# the filesystems.
echo -e "\n####################################################\n"
echo -e "$THIS_SCRIPT started execution $(date)\n"
echo -e "Verifying the node is alive..."
for M in $MACHINE_LIST
do
echo "Pinging $M..."
ping -c1 $M >/dev/null 2>&1
if (( $? != 0 ))
then
echo -e "ERROR: $M host is not pingable...cannot continue..."
echo -e "...EXITING...\n"
echo -e "####################################################"
exit 2
else
echo -e "$M is alive... Starting rsync process!\n"
echo -e "Replicating $FS_PATTERN/ from $THIS_HOST to $M\n"
#The rsync command is all on one line although it doesn't appear so here. This comment can be removed.
rsync -aqz --delete -e ssh $FS_PATTERN/ root@$M:$FS_PATTERN
fi
echo -e "$THIS_SCRIPT finished execution $(date)\n"
echo -e "####################################################"
done
###############################################
# END OF SCRIPT
###############################################
Make sure you make the file executable.
# chmod 754 /usr/local/bin/fsrsync.bash
You can manually run the file by simply running this command as a user with the appropriate rights.
# /usr/local/bin/fsrsync.bash
Do you want to schedule this script to replicate the file system every 5 minutes and log results? Add the following entry to the crontab.
# crontab -e
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/bin/fsrsync.bash 2>&1 >> /var/log/fsrsync.log
Do you want to rotate your log file (assuming you use logrotate)? If so create a file in /etc/logrotate.d/ called fsrsync.
# vi /etc/logrotate.d/fsrsync
The contents of the file should look like this:
/var/log/fsrsync.log {
weekly
rotate 4
nocompress
missingok
}
I hope this helps someone out there.
PS: If you want to test logrotate without having to wait a week you can do the following.
# /usr/sbin/logrotate -v /etc/logrotate.d/fsrsync
This will give you details on what it will do and rotate the log if needed. If you want to force a log rotation, do the following.
# /usr/sbin/logrotate -f /etc/logrotate.d/fsrsync
Here is the script below. Highlight the contents and select copy.
Note: When you grab the test here and paste it, do a sanity check on the text to verify the formatting has not changed.
Edit/create /usr/local/bin/fsrsync.bash and paste in the contents.
# vi /usr/local/bin/fsrsync.bash
Script starts below.
#!/bin/bash
#
# SCRIPT: fsrsync.bash
# AUTHOR:
# DATE:
# REV:
#
# PURPOSE: This script is used to replicate the
# /somedir/test filesystem from Node A to Node B and C
#
# set -x # Uncomment to debug this script
#
# set -n # Uncomment to check the script.s syntax
# # without any execution. Do not forget to
# # recomment this line!
#
##############################################
# DEFINE FILES AND GLOBAL VARIABLES HERE
##############################################
# Define the target machines to copy data to.
# To specify more than one host enclose the
# hostnames in double quotes and put at least
# one space between each hostname
#
# EXAMPLE: MACHINE_LIST="fred yogi booboo"
MACHINE_LIST="nodeB nodeC"
# Capture the shell script file name
THIS_SCRIPT=$(basename $0)
# The FS_PATTERN variable defines the regular expression
# matching the filesystems we want to replicate with rsync.
# Example: FS_PATTERN="/home"
FS_PATTERN="/somedir/test"
# Query the system for the hostname
THIS_HOST=$(hostname)
##############################################
# BEGINNING OF MAIN
##############################################
# Comfirm the nodes are alive and replicate
# the filesystems.
echo -e "\n####################################################\n"
echo -e "$THIS_SCRIPT started execution $(date)\n"
echo -e "Verifying the node is alive..."
for M in $MACHINE_LIST
do
echo "Pinging $M..."
ping -c1 $M >/dev/null 2>&1
if (( $? != 0 ))
then
echo -e "ERROR: $M host is not pingable...cannot continue..."
echo -e "...EXITING...\n"
echo -e "####################################################"
exit 2
else
echo -e "$M is alive... Starting rsync process!\n"
echo -e "Replicating $FS_PATTERN/ from $THIS_HOST to $M\n"
#The rsync command is all on one line although it doesn't appear so here. This comment can be removed.
rsync -aqz --delete -e ssh $FS_PATTERN/ root@$M:$FS_PATTERN
fi
echo -e "$THIS_SCRIPT finished execution $(date)\n"
echo -e "####################################################"
done
###############################################
# END OF SCRIPT
###############################################
Make sure you make the file executable.
# chmod 754 /usr/local/bin/fsrsync.bash
You can manually run the file by simply running this command as a user with the appropriate rights.
# /usr/local/bin/fsrsync.bash
Do you want to schedule this script to replicate the file system every 5 minutes and log results? Add the following entry to the crontab.
# crontab -e
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/bin/fsrsync.bash 2>&1 >> /var/log/fsrsync.log
Do you want to rotate your log file (assuming you use logrotate)? If so create a file in /etc/logrotate.d/ called fsrsync.
# vi /etc/logrotate.d/fsrsync
The contents of the file should look like this:
/var/log/fsrsync.log {
weekly
rotate 4
nocompress
missingok
}
I hope this helps someone out there.
PS: If you want to test logrotate without having to wait a week you can do the following.
# /usr/sbin/logrotate -v /etc/logrotate.d/fsrsync
This will give you details on what it will do and rotate the log if needed. If you want to force a log rotation, do the following.
# /usr/sbin/logrotate -f /etc/logrotate.d/fsrsync
Labels:
cron,
file system,
logrotate,
replication,
rsync,
SSH
Monday, January 11, 2010
Passwordless SSH Setup
Disclaimer: I would not suggest doing this as root. I am only using root as an example.
I needed to replicate a file system from a production server to a DR server. I wanted to script and schedule this so there was no intervention needed from an end user. The first step was to setup passwordless SSH between the source and destination. I found a few tutorials out on the web but they were not as clear as would have liked. So, I documented my process and thought I would share it with you.
We will assume we have two hosts, host1 and host2. For my purposes, I want host2 to be able to run commands through ssh to host1 without being prompted for a password. In this example, we’ll assume the user running these commands is “root”.
On host2 you will need to do the following.
- Log in as root to host2
- Verify the following directory exists
/root/.ssh
- You can do this by issuing the following commands
# cd
# ls -al | grep .ssh
- If in the output returned you see .ssh, then the directory exists. If you are returned to a command prompt without seeing .ssh you will need to create the directory.
- If you need to create the directory issue the following commands.
# mkdir -p /root/.ssh
# chmod 700 /root/.ssh
- Now run the following command
# ssh-keygen -t rsa
*** You will see output similar to below ***
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
- You can hit enter at the above prompt and accept the defaults for the two prompts below
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
On host1 you will need to do the following.
- Log in as root to host1
- Verify the following directory exists
/root/.ssh
- You can do this by issuing the following commands
# cd
# ls -al | grep .ssh
- If in the output returned you see .ssh, then the directory exists. If you are returned to a command prompt without seeing .ssh you will need to create the directory.
- If you need to create the directory issue the following commands.
# mkdir -p /root/.ssh
# chmod 700 /root/.ssh
- Now copy host2’s id_rsa.pub key to host1 (assuming you are still on host1) renaming it to host2.pub
# scp host2:/root/.ssh/id_rsa.pub /root/.ssh/host2.pub
*** Note: my version(s) require authorized_keys2, your file may need to be named authorized_keys
- Now copy /root/.ssh/host2.pub to /root/.ssh/authorized_keys2
# cp /root/.ssh/host2.pub /root/.ssh/authorized_keys2
Now from host2 you should be able to ssh to host1 without being prompted for a password.
- Run the following command from host2 as a test
# ssh host1 ls
You should be returned a directory listing of host1 on host2 without being prompted for a password.
The file system replication script (using rsync) and scheduling (using cron) will be posted in a future blog update.
I needed to replicate a file system from a production server to a DR server. I wanted to script and schedule this so there was no intervention needed from an end user. The first step was to setup passwordless SSH between the source and destination. I found a few tutorials out on the web but they were not as clear as would have liked. So, I documented my process and thought I would share it with you.
We will assume we have two hosts, host1 and host2. For my purposes, I want host2 to be able to run commands through ssh to host1 without being prompted for a password. In this example, we’ll assume the user running these commands is “root”.
On host2 you will need to do the following.
- Log in as root to host2
- Verify the following directory exists
/root/.ssh
- You can do this by issuing the following commands
# cd
# ls -al | grep .ssh
- If in the output returned you see .ssh, then the directory exists. If you are returned to a command prompt without seeing .ssh you will need to create the directory.
- If you need to create the directory issue the following commands.
# mkdir -p /root/.ssh
# chmod 700 /root/.ssh
- Now run the following command
# ssh-keygen -t rsa
*** You will see output similar to below ***
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
- You can hit enter at the above prompt and accept the defaults for the two prompts below
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
On host1 you will need to do the following.
- Log in as root to host1
- Verify the following directory exists
/root/.ssh
- You can do this by issuing the following commands
# cd
# ls -al | grep .ssh
- If in the output returned you see .ssh, then the directory exists. If you are returned to a command prompt without seeing .ssh you will need to create the directory.
- If you need to create the directory issue the following commands.
# mkdir -p /root/.ssh
# chmod 700 /root/.ssh
- Now copy host2’s id_rsa.pub key to host1 (assuming you are still on host1) renaming it to host2.pub
# scp host2:/root/.ssh/id_rsa.pub /root/.ssh/host2.pub
*** Note: my version(s) require authorized_keys2, your file may need to be named authorized_keys
- Now copy /root/.ssh/host2.pub to /root/.ssh/authorized_keys2
# cp /root/.ssh/host2.pub /root/.ssh/authorized_keys2
Now from host2 you should be able to ssh to host1 without being prompted for a password.
- Run the following command from host2 as a test
# ssh host1 ls
You should be returned a directory listing of host1 on host2 without being prompted for a password.
The file system replication script (using rsync) and scheduling (using cron) will be posted in a future blog update.
Labels:
administration,
passwordless,
rsync,
SSH
Thursday, January 7, 2010
Windows 7 - God Mode
I found this little gem of a trick. By simply creating a folder you can access (what seems like) all of Windows 7's controls and settings.
I tried it and it works!
Give it a read/try.
http://news.cnet.com/8301-13860_3-10423985-56.html
I tried it and it works!
Give it a read/try.
http://news.cnet.com/8301-13860_3-10423985-56.html
Labels:
Control Panel,
God Mode,
Windows 7
Tuesday, December 1, 2009
Managing and Archiving Log Files Using Find and Tar
You could probably write a script and put this in the cron scheduler... Here is the quick and dirty manual way to do it.
I wanted a way to archive everything in a particular directory and remove files (and only files) in that directory. I was running out of space on one of my filesystems and I knew "log" files were eating up most of my space. I still had plenty of space on my /tmp filesystem. I wanted to get rid of files older than 15 days after I archived them so here is what I did.
I created a place for my archive files.
# mkdir -p /tmp/logs
I then changed directories to the place the log files lived.
# cd /(path to log files)/
I then, as a sanity check, ran this command to make sure it included the files I wanted and excluded those I didn't.
# find . -mtime +15 | xargs ls -l
After I validated this list was the files I wanted to archive, I ran the following command to tar and compress the files.
# find . -mtime +15 | xargs tar cvfz /tmp/logs/111609logs.tar.gz
This will tar up and compress everything older than 15 days. I named my log file using a date stamp 15 days in the past. Now I want to remove files older than 15 days, but only files, not directories. I used this command.
# find . -type f -mtime +15 | xargs rm -f
The "find" command will find everything so using the "-type f" option it will only find files.
I was able to free up about 3GB. I hope this helps others out there.
I wanted a way to archive everything in a particular directory and remove files (and only files) in that directory. I was running out of space on one of my filesystems and I knew "log" files were eating up most of my space. I still had plenty of space on my /tmp filesystem. I wanted to get rid of files older than 15 days after I archived them so here is what I did.
I created a place for my archive files.
# mkdir -p /tmp/logs
I then changed directories to the place the log files lived.
# cd /(path to log files)/
I then, as a sanity check, ran this command to make sure it included the files I wanted and excluded those I didn't.
# find . -mtime +15 | xargs ls -l
After I validated this list was the files I wanted to archive, I ran the following command to tar and compress the files.
# find . -mtime +15 | xargs tar cvfz /tmp/logs/111609logs.tar.gz
This will tar up and compress everything older than 15 days. I named my log file using a date stamp 15 days in the past. Now I want to remove files older than 15 days, but only files, not directories. I used this command.
# find . -type f -mtime +15 | xargs rm -f
The "find" command will find everything so using the "-type f" option it will only find files.
I was able to free up about 3GB. I hope this helps others out there.
Monday, November 30, 2009
Copying Directory Structures Between Linux or UNIX Systems
As I build or rebuild servers that need a particular directory structure, I wanted a fast way to replicate or reproduce the empty directory structure with the appropriate owners and permissions. Historically, I would have used the tar command for this and only selected directories. There is another, and in my opinion more efficient, way to do this using the cpio command.
I wanted to recreate the following two directory structures (including all sub-directories, which there are many of):
/u02/prn/app
/u02/prn/oradata
On the server you want to model the directory structure(s) after you would run the following commands.
# find /u02/prn/app -type d | cpio -ov >/tmp/appdirs.cpio
# find /u02/prn/oradata -type d | cpio -ov >/tmp/oradatadirs.cpio
Now using "scp" I can copy these files to the server I want to recreate the directory structure on.
# scp /tmp/*.cpio destination_server_here:/tmp/.
Now I will extract the archive which will create the directory structures I want (with the appropriate owners and permissions). Note: run this command from the "/" filesystem. If you run it from /tmp, it will look for u02 in tmp. It obviously doesn't live there. So, do it from /
# cpio -iv </tmp/appdirs.cpio
# cpio -iv </tmp/oradatadirs.cpio
Done! Not quite magic, but almost.
Assumptions: You have the same users and groups created on the destination server as you do on the source server.
Hope this helps someone out there.
I wanted to recreate the following two directory structures (including all sub-directories, which there are many of):
/u02/prn/app
/u02/prn/oradata
On the server you want to model the directory structure(s) after you would run the following commands.
# find /u02/prn/app -type d | cpio -ov >/tmp/appdirs.cpio
# find /u02/prn/oradata -type d | cpio -ov >/tmp/oradatadirs.cpio
Now using "scp" I can copy these files to the server I want to recreate the directory structure on.
# scp /tmp/*.cpio destination_server_here
Now I will extract the archive which will create the directory structures I want (with the appropriate owners and permissions). Note: run this command from the "/" filesystem. If you run it from /tmp, it will look for u02 in tmp. It obviously doesn't live there. So, do it from /
# cpio -iv </tmp/appdirs.cpio
# cpio -iv </tmp/oradatadirs.cpio
Done! Not quite magic, but almost.
Assumptions: You have the same users and groups created on the destination server as you do on the source server.
Hope this helps someone out there.
Labels:
cpio,
directory structure,
Linux,
tar,
UNIX
Friday, November 13, 2009
System Monitoring - Cacti Virtual Appliance and Virtual Box
Cacti Virtual Appliance and Virtual Box
I wanted a fast and easy solution to do some monitoring on my network. I have used mrtg and rddtool before, and it has served my needs in the past. This time I wanted something that was move feature packed and robust. Enter Cacti. It didn’t seem too hard to set this up from scratch, but I really did not want to spend a lot of time messing around with it. I found http://www.virtualappliances.net/ had a pre-built Cacti Virtual Appliance for VMware in OVF format (Note: I just noticed on 8/16/2010 that this is not a valid site anymore - so the rest of this post is invalid unless you can find the VA-Cacti.ovf file). Well Virtual Box can import the OVF format. So here is what I did:
1. Download the files from http://www.virtualappliances.net/downloads/esx/i386/VA-Cacti/
2. Note… when I downloaded the VA-Cacti.ovf file it wanted to save it with an xml extension. I let it, and then once it was saved on my hard drive I changed the extension from xml to ovf.
3. Open VirtualBox
4. Select File and Import Appliance
5. Click on Choose and navigate to the OVF File. Select it and click next.
6. Unselect/uncheck the NIC. Click the import button.
7. The VA-Cacti virtual machine should show up in your list. Highlight it and click on Settings.
8. Click System, uncheck floppy and cdrom
9. Click Display, change Video Memory from 4 to 7.
10. Click Network, Enable the Network Adapter. I selected the Intel PRO/1000 MT Desktop NIC and Selected Bridged Adapter.
11. Click OK
12. For whatever reason, VM-ware tools is installed and messes up the /etc/fstab file. Plus we don’t need or want vmware tools… We are using Virtual Box. There is probably a cleaner way to do this, but a quick and dirty way to overcome this issue is…
13. Start the Appliance but push ESC right away. Select the “recovery mode” option from the menu.
14. The default root password is root.
15. Enter it to get in to maintenance mode.
16. Change directories to /etc
17. Remove the vmware tools directory.
# rm -R vmware-tools
18. Change directories to /etc/rc2.d
19. Remove the S19vmware-tools startup/shutdown script
# rm S19vmware-tools
20. reboot
21. As the system is shutting down, you may get a warning about not being able to find vmware-tools… So what…
22. The system will reboot.
23. Take note of the server’s address. You will see a message stating VA Management Console can be access at https://:8000
24. Open a browser and go to that address.
25. Log in using the default admin account. admin/admin
26. Click on Configuration at the top and select time keeping. Change the date/time/zone to match your area.
27. Click save and you should get a message stating that the changes will take affect the next time you restart.
28. If you want, you can set a static IP and other config settings from this page, but for the purposes of this example we will leave everything else allow.
29. Restart the server now by click on the reboot button at the top of the web page.
30. When the server comes back up, verify the IP address.
31. Now open a browser and go to http://
32. Click on Next. Click Next again. Click Finish.
33. You will now be presented with a Cacti login screen. The default username and password is admin/admin. Once you enter that you will be forced to change your password. For my test, I just entered admin in twice to leave it unchanged. Bad security? Yes, but this is just my Proof of Concept test.
34. Now you are in and the system is up. Before we go any farther, I am going to point you to the Cacti user manual. This is a must read. Cacti, is very configurable and in being so, it is easy to render your system useless and broken. The manual is here: http://docs.cacti.net/manual:087
35. Assumptions: Cisco router with an SNMP RO community string set.
36. With that out of the way, I will go through one example of monitoring a router and setting up graphs for it.
37. Click create devices and click add in the upper right hand corner.
38. Fill in a description, enter the IP Address or DNS name, select Cisco Router from the Host Template drop down. Select SNMP Version 2 and enter the appropriate RO community string. Then click create. If successful, you should see at the top of your screen “Save Successful” and under Ping Results… “Host is alive”.
39. To the right of that a “Create Graphs for this Host” link. Click it.
40. Towards the top, check the box for “Create: Cisco - CPU Usage” then scroll down and click create. Click create again.
41. Now select the interface(s) you want to monitor and click create.
42. Now click on the left hand side toward the top “Graph Trees”. Then click “Default Tree”
43. Then click add. The Parent Item is root, the Tree Item Type is Host, Choose your host from the drop down and select create.
44. Now click the graphs tab at the top. You should see your host under the default tree. It will take approximately 5 to 10 minutes for graphs to be created and enough data to start plotting.
Have Fun!
I wanted a fast and easy solution to do some monitoring on my network. I have used mrtg and rddtool before, and it has served my needs in the past. This time I wanted something that was move feature packed and robust. Enter Cacti. It didn’t seem too hard to set this up from scratch, but I really did not want to spend a lot of time messing around with it. I found http://www.virtualappliances.net/ had a pre-built Cacti Virtual Appliance for VMware in OVF format (Note: I just noticed on 8/16/2010 that this is not a valid site anymore - so the rest of this post is invalid unless you can find the VA-Cacti.ovf file). Well Virtual Box can import the OVF format. So here is what I did:
1. Download the files from http://www.virtualappliances.net/downloads/esx/i386/VA-Cacti/
2. Note… when I downloaded the VA-Cacti.ovf file it wanted to save it with an xml extension. I let it, and then once it was saved on my hard drive I changed the extension from xml to ovf.
3. Open VirtualBox
4. Select File and Import Appliance
5. Click on Choose and navigate to the OVF File. Select it and click next.
6. Unselect/uncheck the NIC. Click the import button.
7. The VA-Cacti virtual machine should show up in your list. Highlight it and click on Settings.
8. Click System, uncheck floppy and cdrom
9. Click Display, change Video Memory from 4 to 7.
10. Click Network, Enable the Network Adapter. I selected the Intel PRO/1000 MT Desktop NIC and Selected Bridged Adapter.
11. Click OK
12. For whatever reason, VM-ware tools is installed and messes up the /etc/fstab file. Plus we don’t need or want vmware tools… We are using Virtual Box. There is probably a cleaner way to do this, but a quick and dirty way to overcome this issue is…
13. Start the Appliance but push ESC right away. Select the “recovery mode” option from the menu.
14. The default root password is root.
15. Enter it to get in to maintenance mode.
16. Change directories to /etc
17. Remove the vmware tools directory.
# rm -R vmware-tools
18. Change directories to /etc/rc2.d
19. Remove the S19vmware-tools startup/shutdown script
# rm S19vmware-tools
20. reboot
21. As the system is shutting down, you may get a warning about not being able to find vmware-tools… So what…
22. The system will reboot.
23. Take note of the server’s address. You will see a message stating VA Management Console can be access at https://
24. Open a browser and go to that address.
25. Log in using the default admin account. admin/admin
26. Click on Configuration at the top and select time keeping. Change the date/time/zone to match your area.
27. Click save and you should get a message stating that the changes will take affect the next time you restart.
28. If you want, you can set a static IP and other config settings from this page, but for the purposes of this example we will leave everything else allow.
29. Restart the server now by click on the reboot button at the top of the web page.
30. When the server comes back up, verify the IP address.
31. Now open a browser and go to http://
32. Click on Next. Click Next again. Click Finish.
33. You will now be presented with a Cacti login screen. The default username and password is admin/admin. Once you enter that you will be forced to change your password. For my test, I just entered admin in twice to leave it unchanged. Bad security? Yes, but this is just my Proof of Concept test.
34. Now you are in and the system is up. Before we go any farther, I am going to point you to the Cacti user manual. This is a must read. Cacti, is very configurable and in being so, it is easy to render your system useless and broken. The manual is here: http://docs.cacti.net/manual:087
35. Assumptions: Cisco router with an SNMP RO community string set.
36. With that out of the way, I will go through one example of monitoring a router and setting up graphs for it.
37. Click create devices and click add in the upper right hand corner.
38. Fill in a description, enter the IP Address or DNS name, select Cisco Router from the Host Template drop down. Select SNMP Version 2 and enter the appropriate RO community string. Then click create. If successful, you should see at the top of your screen “Save Successful” and under Ping Results… “Host is alive”.
39. To the right of that a “Create Graphs for this Host” link. Click it.
40. Towards the top, check the box for “Create: Cisco - CPU Usage” then scroll down and click create. Click create again.
41. Now select the interface(s) you want to monitor and click create.
42. Now click on the left hand side toward the top “Graph Trees”. Then click “Default Tree”
43. Then click add. The Parent Item is root, the Tree Item Type is Host, Choose your host from the drop down and select create.
44. Now click the graphs tab at the top. You should see your host under the default tree. It will take approximately 5 to 10 minutes for graphs to be created and enough data to start plotting.
Have Fun!
Labels:
Appliance,
Cacti,
Network Monitoring,
System Monitoring,
VirtualBox,
Virtualization,
VMWare
Subscribe to:
Posts (Atom)