Cacti is an open source performance monitor for IT infrastructure. It will run on Linux or Windows and stands up very well against commercial equivalents. Be mindful that open source can mean lots of tinkering time. I have used Cacti for many years but was recently given an opportunity to set it up for the first time. There were a few quirks in the process I want to remember for the future to speed up with installation. This is not an exhaustive how-to doc as I was able to find everything I needed via Google searches. But it was not all in one place so I wanted to put this together.
I prefer Linux for Cacti - PHP and MySQL are significantly easier to setup
Follow Official Cacti Installation Document
http://www.cacti.net/downloads/docs/html/install_unix.html
Notes
The newest version of PHP typically does not require any of the changes from the Cacti Installation Document, but go through the checklist regardless
Some of the MySQL commands will require --password forcing a password prompt
Common issue, no graphs being created - run the poller.php command as cactiuser from the command prompt - this will generate output with errors
Go through the errors - found one of the php files did not have proper MySQL credentials
Timezone issue - FH runs in UTC, but for reading Cacti graphs, having current time is convienient
Do not change any of the settings until graphs are being populated, once that is complete, change the poller to spine and set the polling interval to 1 minutes
Spine
Follow Official Cacti Spine Installation Document - http://cacti.net/spine_install_rhlnx.php
When changing to Spine, clear the poller cache - http://www.cacti.net/downloads/docs/html/scripts.html#CLI_REBUILD_POLLER_CACHE
1 Minute Polling
Change Settings page to 1 minute and change crontab to * * * * *
Also must update data templates - http://docs.cacti.net/manual:087:3_templates.1_data_template
Step changes to 60
Heartbeat changes to 120
Import Windows Graph Templates
The bundled Windows graphs that come preinstalled are average at best, import CPU, memory, I/O, and disk graphs from Cacti Forums - http://forums.cacti.net/viewtopic.php?f=12&t=29832
The thread is many pages long - there are updated versions of the templates, find the newest post from the author and download the attachments
There are instructions on the first post
These graphs require SNMP Informant STD version
Import IIS Graph Templates
Available from Cacti Forums - http://forums.cacti.net/viewtopic.php?f=12&t=12464
Import via the GUI and add to the Windows Template
Friday, April 22, 2011
Ubuntu Menu Configuration
Ubuntu has started shipping with the close, maximize, and minimize buttons in the upper left corner of the menu bar. I cannot get used to it and prefer them on the traditional right side.
A quick How To
1 Press ALT-F2 and run gconf-editor
2 Go to apps --> metacity --> general
3 Select and right-click button_layout
4 Click Edit Key
5 Replace with menu:minimize,maximize,close
6 Click OK and it's done
A quick How To
1 Press ALT-F2 and run gconf-editor
2 Go to apps --> metacity --> general
3 Select and right-click button_layout
4 Click Edit Key
5 Replace with menu:minimize,maximize,close
6 Click OK and it's done
Friday, January 14, 2011
Log Rotation
The following is a script running once a day on a CentOS box to manage logs
Whenever possible, applications and machines are outputting logs to the NAS. Centralized logging allows us to manage them in one location and also helps with troubleshooting problems.
There are 2 log volumes. "Hot" Logs keeps logs created or modified within the past 24 hours. Archived Logs keeps logs for 60 days. This is very helpful when troubleshooting an active production issue because the relevant logs are very easy to find. Sifting through archived logs can take some time.
The script also does a gzip on the archived logs volume to conserve space. Logs will typically compress 80-95%. The script also removes empty folders to keep the log volumes clean.
Before running the entire script, run the rsync. It is key to get all the logs to archives before starting any deletion.
#!/bin/bash
HOTLOGS=/mounts/logs/
ARCHIVELOGS=/mounts/logsarchived/
# Delete any file older than 2 days from HOT Logs
echo "$(date): Deleting expired files:"
find $HOTLOGS -daystart -mtime +2 -type f -print -exec /bin/rm -vf {} \;
echo Geo log maintenance script
# Copy HOT to Archived
#rsync -aqO $HOTLOGS $ARCHIVELOGS --exclude $HERMOD
rsync -aqO --exclude "*.xml" $HOTLOGS $ARCHIVELOGS
# gzip files in Archived Logs older than 1 day
echo "$(date): Compressing old files:"
find $ARCHIVELOGS -type f -daystart -mtime +1 ! -name "*.gz" -print -exec /bin/gzip -v -f -S ".$(date +%F).gz" {} \;
# Delete any file older than 60 days from Archived Logs
echo "$(date): Deleting expired files:"
find $ARCHIVELOGS -daystart -mtime +60 -type f -name "*.gz" -print -exec /bin/rm -vf {} \;
# Remove empty HOT Logs directories
echo "$(date): Deleting empty directories:"
find $HOTLOGS -depth -type d -empty -print -exec /bin/rmdir {} \;
# Remove empty Archived Logs directories
echo "$(date): Deleting empty directories:"
find $ARCHIVELOGS -depth -type d -empty -print -exec /bin/rmdir {} \;
echo $(date) Done
Whenever possible, applications and machines are outputting logs to the NAS. Centralized logging allows us to manage them in one location and also helps with troubleshooting problems.
There are 2 log volumes. "Hot" Logs keeps logs created or modified within the past 24 hours. Archived Logs keeps logs for 60 days. This is very helpful when troubleshooting an active production issue because the relevant logs are very easy to find. Sifting through archived logs can take some time.
The script also does a gzip on the archived logs volume to conserve space. Logs will typically compress 80-95%. The script also removes empty folders to keep the log volumes clean.
Before running the entire script, run the rsync. It is key to get all the logs to archives before starting any deletion.
#!/bin/bash
HOTLOGS=/mounts/logs/
ARCHIVELOGS=/mounts/logsarchived/
# Delete any file older than 2 days from HOT Logs
echo "$(date): Deleting expired files:"
find $HOTLOGS -daystart -mtime +2 -type f -print -exec /bin/rm -vf {} \;
echo Geo log maintenance script
# Copy HOT to Archived
#rsync -aqO $HOTLOGS $ARCHIVELOGS --exclude $HERMOD
rsync -aqO --exclude "*.xml" $HOTLOGS $ARCHIVELOGS
# gzip files in Archived Logs older than 1 day
echo "$(date): Compressing old files:"
find $ARCHIVELOGS -type f -daystart -mtime +1 ! -name "*.gz" -print -exec /bin/gzip -v -f -S ".$(date +%F).gz" {} \;
# Delete any file older than 60 days from Archived Logs
echo "$(date): Deleting expired files:"
find $ARCHIVELOGS -daystart -mtime +60 -type f -name "*.gz" -print -exec /bin/rm -vf {} \;
# Remove empty HOT Logs directories
echo "$(date): Deleting empty directories:"
find $HOTLOGS -depth -type d -empty -print -exec /bin/rmdir {} \;
# Remove empty Archived Logs directories
echo "$(date): Deleting empty directories:"
find $ARCHIVELOGS -depth -type d -empty -print -exec /bin/rmdir {} \;
echo $(date) Done
Tuesday, January 4, 2011
Robocopy and Delete
@echo on
setlocal
set TODAY=%year%-%month%-%day% //create a variable called TODAY for the date
set LOGFILE=c:\sqlBackup-%TODAY%.log //set log file location
Set SOURCE=\\nas\backups\prod //set source of files to be copied
Set Target=\\nas\backups\prod2 //set destination of files to be copied
cd "Program Files\Windows Resource Kits\Tools" //navigate to location of robocopy executable
robocopy.exe %SOURCE% %TARGET% /MIR //execute robocopy with variables
echo Y|del %SOURCE%\*.* //delete all files from source
endlocal
setlocal
set TODAY=%year%-%month%-%day% //create a variable called TODAY for the date
set LOGFILE=c:\sqlBackup-%TODAY%.log //set log file location
Set SOURCE=\\nas\backups\prod //set source of files to be copied
Set Target=\\nas\backups\prod2 //set destination of files to be copied
cd "Program Files\Windows Resource Kits\Tools" //navigate to location of robocopy executable
robocopy.exe %SOURCE% %TARGET% /MIR //execute robocopy with variables
echo Y|del %SOURCE%\*.* //delete all files from source
endlocal
Windows SQL Express Backup Script with Extras
This script was created to perform a backup on MS SQL 2005 Express. The lite version of MS SQL does not have built in maintenance tasks. Then robocopy moves the files from the box to a CIFS share. Then a forfiles line is used to delete old copies of the backups.
sqlcmd -S servername\SQLinstanceName -E -Q "EXEC sp_BackupDatabases @backupLocation='d:\backups\', @backupType='F'"
robocopy.exe d:\backups \\nas\backups\servername /mir
Forfiles -p d:\backups -s -m *.* -d -2 -c "Cmd /C del @FILE"
sqlcmd -S servername\SQLinstanceName -E -Q "EXEC sp_BackupDatabases @backupLocation='d:\backups\', @backupType='F'"
robocopy.exe d:\backups \\nas\backups\servername /mir
Forfiles -p d:\backups -s -m *.* -d -2 -c "Cmd /C del @FILE"
Wednesday, October 6, 2010
EasyTether
I recently upgraded my phone from a 4 year old flip phone to the HTC Evo. One of the selling points for me was the Android operating system and tethering. While taking my turn on call, I have wanted the ability to go mobile and have an Internet connection anywhere I go. The built in Sprint tethering costs $30 per month. That's too expensive so I looked at other options. I found a program called EasyTether.
This program is free for HTTP use or a one-time cost of $10 for all other ports. I installed the app and have been able to get it working for Windows 7 and Ubuntu. I duel boot my work machine but use Ubuntu 90% of the time. Here is my instruction sheet for making EasyTether work
On Phone
EVO should be set to charge only and connected to the machine
Go to Applications -> Development -> Make sure USB debugging is enabled
Go to EasyTetherPro -> Enabled USB Tethering
On Computer (Ubuntu)
sudo easytether connect - keep the terminal open and open another terminal window
sudo dhclient easytether0
On Computer (Windows)
Open the app and connect
This is great for road trips or during a thunderstorm and the power is out at home and its the middle of the night and somebody from India is calling to tell you a site is down and they need help. That's a killer run-on sentence but it's true.
And keep these instructions on your local computer because you will need them at 2AM when you can't think straight.
This program is free for HTTP use or a one-time cost of $10 for all other ports. I installed the app and have been able to get it working for Windows 7 and Ubuntu. I duel boot my work machine but use Ubuntu 90% of the time. Here is my instruction sheet for making EasyTether work
On Phone
EVO should be set to charge only and connected to the machine
Go to Applications -> Development -> Make sure USB debugging is enabled
Go to EasyTetherPro -> Enabled USB Tethering
On Computer (Ubuntu)
sudo easytether connect - keep the terminal open and open another terminal window
sudo dhclient easytether0
On Computer (Windows)
Open the app and connect
This is great for road trips or during a thunderstorm and the power is out at home and its the middle of the night and somebody from India is calling to tell you a site is down and they need help. That's a killer run-on sentence but it's true.
And keep these instructions on your local computer because you will need them at 2AM when you can't think straight.
Patching
A big difference between Windows and Linux in an enterprise environment is how each operating system handles patching. Microsoft has a month patch day on the second Tuesday of each month. We update development machines on Friday or 3 days after they are released. If patches go well and there are no reported issues during the next 7 days, patches are applied to production systems on the following Friday.
I have heard many horror stories about Windows patching and the problems it has caused. There are also hundreds of third party solutions available to perform Windows patching. We use WSUS and proper group policy. A member of our security team approves the patches and the boxes automatically restart during a maintenance window. The GPO makes sure domain controllers do not reboot at the same time. This solution takes about 30 minutes twice a week. It is dependable, reliable, consistent, and easy.
CentOS patching is more complicated. We utilized Spacewalk to manage our Linux servers. Spacewalk has the capability to push patches, but we have had little success making it work. Spacewalk controls the repos and which patches each server should receive. We do utilize a handy app that is essential to managing more than 1 Linux server, ClusterSSH. To update boxes, we do a yum update on each box. Then Spacewalk is able to schedule a restart of the systems in necessary for a kernel update.
The process is not consistent. Linux takes 2-4 hours for development and 6-8 hours for production. There is the potential for package conflicts, access issues, or a variety of other errors. Problems have to be investigated and fixed during each patching cycle. Also, CentOS does not have an established patching scheduled. So a patch could be potentially applied to production before development unless precautions are taken.
The cost of patching Linux should be factored into the decision to choose Linux as an operating system. System administrator time going to a mundane patching task could be used elsewhere.
I have heard many horror stories about Windows patching and the problems it has caused. There are also hundreds of third party solutions available to perform Windows patching. We use WSUS and proper group policy. A member of our security team approves the patches and the boxes automatically restart during a maintenance window. The GPO makes sure domain controllers do not reboot at the same time. This solution takes about 30 minutes twice a week. It is dependable, reliable, consistent, and easy.
CentOS patching is more complicated. We utilized Spacewalk to manage our Linux servers. Spacewalk has the capability to push patches, but we have had little success making it work. Spacewalk controls the repos and which patches each server should receive. We do utilize a handy app that is essential to managing more than 1 Linux server, ClusterSSH. To update boxes, we do a yum update on each box. Then Spacewalk is able to schedule a restart of the systems in necessary for a kernel update.
The process is not consistent. Linux takes 2-4 hours for development and 6-8 hours for production. There is the potential for package conflicts, access issues, or a variety of other errors. Problems have to be investigated and fixed during each patching cycle. Also, CentOS does not have an established patching scheduled. So a patch could be potentially applied to production before development unless precautions are taken.
The cost of patching Linux should be factored into the decision to choose Linux as an operating system. System administrator time going to a mundane patching task could be used elsewhere.
Subscribe to:
Posts (Atom)