Thursday, 31 January 2013
Vagrant: how to set vm memory and force gui mode
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.define :zenoss do |zenoss_config|
zenoss_config.vm.box = "quantal64"
zenoss_config.vm.network :hostonly, "10.66.66.10"
zenoss_config.vm.forward_port 80, 8885
zenoss_config.vm.customize ["modifyvm", :id, "--memory", 1024]
end
config.vm.define :desktop do |desktop_config|
desktop_config.vm.box = "quantal64"
desktop_config.vm.network :hostonly, "10.66.66.20"
desktop_config.vm.boot_mode = :gui
end
end
Friday, 25 January 2013
How to convert encryption keys: RSA to PEM
- RSA to PEM
- ssh-keygen -t rsa
- openssl rsa -in ~/.ssh/id_rsa -outform pem > id_rsa.pem
Thursday, 17 January 2013
Asterisk pre-reqs for compiling on Debian/Ubuntu
apt-get -y install make libncurses-dev libxml2-dev sqlite3 libsqlite3-dev libiksemel-dev libssl-dev subversion
Thursday, 10 January 2013
Redirection on CLI: greater-thans, ampersands and numbers
- myCLIapp > /dev/null 2>&1
- Order is important, don't reverse the redirects
- See below
- First redirect sends STDOUT to kernel's blackhole equivalent
- result: STDOUT is forgotten, never shown
- STDOUT is implied when no number before '>'
- Second redirect sends STDERR to where STDOUT points
- STDERR goes where STDOUT goes
- So STDERR ends up in blackhole too
- The amphersand is necessary
- to specify this is a "file handle"
- and not a filename
- Reverse mistake
- myCLIapp 2>&1 > /dev/null
- Read left to right
- 2>&1
- Would 1st send STDERR to where STDOUT is pointing currently
- Which is STDOUT so far
- > /dev/null
- STDOUT is implied since no number before '>'
- Send STDOUT to /dev/null
- Result is
- STDERR being displayed
- STDOUT being sent to blackhole
- Remember
- if no number given before '>', them implied is STDOUT
Tuesday, 8 January 2013
Quick start howto for divish on Debian
- Prep
- Here, there is one backup server and two client servers that need to be backed up
- Make sure root user on backup server can ssh to mybox01.mydomain.net and mybox02.mydomain.net without password
- Later, much later, see online for better, more secure ways
- install dirvish and rsync on server, rsync on clients
- apt-get install dirvish
- apt-get install rsync
- Clients
- The below are just example directories, use your own, the ones you want backed up
- mkdir -p /data/backups/
- mkdir -p /data/backups/etc
- mkdir -p /data/backups/var/log
- rsync -av /etc/ /data/backups/etc/
- rsync -av /opt/ /data/backups/opt/
- Make a cron job to do the rsyncs above nightly
- Server
- mkdir -p /backup/dirvish/mybox01/dirvish
- mkdir -p /backup/dirvish/mybox02/dirvish
- vi /backup/dirvish/mybox01/dirvish/default.conf
- get contents below
- vi /backup/dirvish/mybox02/dirvish/default.conf
- get contents below
- dirvish --vault mybox01 --init
- dirvish --vault mybox02 --init
- Verify
- Backed up files should now be under /backups/dirvish on backup server
- tree /backup/ -d -L 3
- find /backup/dirvish -ls | less
- Tell dirvish to do nightly pull
- vi /etc/dirvish/master.conf.mybackup
- get contents below
- Tomorrow, verify the pull worked, and next week too
- Exclusion and expire options
- Research options one can add to master.conf.mybackup
/etc/dirvish/master.conf
/backup/dirvish
Exclude:
lost+found/
/etc/dirvish/master.conf.mybackup
Runall:
mybox01
mybox02mybox01
/backup/dirvish/mybox01/dirvish/default.conf
client: mybox01.mydomain.net
tree: /data/backups
xdev: true
index: gzip
/backup/dirvish/mybox02/dirvish/default.conf
client: mybox02.mydomain.net
tree: /data/backups
xdev: true
index: gzip
Friday, 4 January 2013
Thursday, 3 January 2013
Quick start how-to graphite base install on Debian
UPDATE: Also see Latest Graphite on Amazon Linux at AWS.
This only gets graphite working on your local Linux box. Left to user to translate to remote server installation thereafter.
NOTE: Do everything as root user
This only gets graphite working on your local Linux box. Left to user to translate to remote server installation thereafter.
NOTE: Do everything as root user
- make sure apache2 is installed and working with wsgi
- apt-get install apache2 -y
- apt-get install libapache2-mod-wsgi -y
- a2enmod wsgi
- wsgi needs a place for its sockets
- mkdir /etc/apache2/run
- mkdir /var/run/wsgi
- chmod 777 /etc/apache2/run /var/run/wsgi
- this seems undocumented, thanks!
- Install dependencies
- apt-get install -y libapache2-mod-wsgi python-twisted python-memcache python-pysqlite2 python-simplejson
- apt-get install -y python2.6 python-pip python-cairo python-django python-django-tagging
- Install graphite elements
- mkdir -p /root/graphite-install
- cd /root/graphite-install
- git clone https://github.com/graphite-project/graphite-web.git
- git clone https://github.com/graphite-project/carbon.git
- git clone https://github.com/graphite-project/whisper.git
- git clone https://github.com/graphite-project/ceres
- cd /root/graphite-install/whisper
- git checkout 0.9.x
- python setup.py install
- cd /root/graphite-install/ceres
- python setup.py install
- cd /root/graphite-install/carbon
- git checkout 0.9.x
- python setup.py install
- cd /root/graphite-install/graphite-web
- git checkout 0.9.x
- python check-dependencies.py
- fix any missing dependencies
- ignore warnings if certain you don't need a feature
- python setup.py install
- Setup configuration files and permissions
- cp -v /opt/graphite/conf/carbon.conf.example /opt/graphite/conf/carbon.conf
- cp -v /opt/graphite/conf/storage-schemas.conf.example /opt/graphite/conf/storage-schemas.conf
- Create Django database
- cp -v /opt/graphite/webapp/graphite/local_settings.py.example /opt/graphite/webapp/graphite/local_settings.py
- Edit this file by uncommenting the entire DATABASES section
- Otherwise next commands may fail with bizarre error
- cd /opt/graphite/webapp/graphite
- python manage.py syncdb
- Make sure NO errors
- Create a user/pass you'll never forget
- chown -Rv www-data:www-data /opt/graphite/storage/
- EXTREMELY IMPORTANT
- Apache
- Add below Apache configuration as a virtual host (details not covered here)
- Or do this and struggle to make it work
- cp -v /opt/graphite/examples/example-graphite-vhost.conf /etc/apache2/sites-available/graphite
- Every "directory" and "location" in the virtual hosts file need these entries, or you'll get permission denied errors
- apache versions before 2.4
- Order deny,allow
- Allow from all
- apache versions 2.4 and after
- Require all granted
- a2ensite graphite
- cp -v /opt/graphite/conf/graphite.wsgi.example /opt/graphite/conf/graphite.wsgi
- apache2ctl -S
- Check all is OK
- service apache2 stop
- service apache2 start
- If you have trouble check permissions under this directory and/or run this again
- chown -Rv www-data:www-data /opt/graphite/storage/
- Seems some files are created by root that should be created by www-data user maybe
- Start carbon daemon
- cd /opt/graphite
- /opt/graphite/bin/carbon-cache.py start
- verify with:
- lsof -nP -i :2003
- TASK: automate this to start on reboot somehow
- Add to /etc/hosts
- 127.0.1.3 graphite
- tail -F /opt/graphite/storage/log/webapp/error.log
- python /opt/graphite/examples/example-client.py
- Hit http://graphite
- Should show initial graphite interface
- View results
- Click down into "system" -> loadavg_5min
- Find "Select Recent Data" icon in upper-left toolbar
- Set to 10 mins
- You should see lines appearing as script runs and feed data to Graphite via Carbon
- Check out giraffe once you get some stats to shove in it
- https://github.com/kenhub/giraffe
- Just dump the files you get from the git clone into a directory under you default Apache install and tweedle with dashboard.js until you see something
- Try this a few times on the CLI of your graphite server every few minutes
- echo "system.logs.changed_last10 `find /var/log -mmin -10 | wc -l` `date +%s`" | nc -w 1 localhost 2003
- Try similar commands to pass in other stats
- echo must output a single integer.
WSGISocketPrefix /var/run/wsgi <VirtualHost *:80> ServerName graphite DocumentRoot "/opt/graphite/webapp" ErrorLog /opt/graphite/storage/log/webapp/error.log CustomLog /opt/graphite/storage/log/webapp/access.log common WSGIDaemonProcess graphite processes=5 threads=5 display-name='%{GROUP}' inactivity-timeout=120 WSGIProcessGroup graphite WSGIApplicationGroup %{GLOBAL} WSGIImportScript /opt/graphite/conf/graphite.wsgi process-group=graphite application-group=%{GLOBAL} WSGIScriptAlias / /opt/graphite/conf/graphite.wsgi Alias /content/ /opt/graphite/webapp/content/ <Location "/content/"> SetHandler None </Location> Alias /media/ "@DJANGO_ROOT@/contrib/admin/media/" <Location "/media/"> SetHandler None </Location> <Directory /opt/graphite/conf/> Order deny,allow Allow from all </Directory> </VirtualHost>
Subscribe to:
Posts (Atom)
Interview questions: 2020-12
Terraform provider vs provisioner Load balancing Network Load Balancer vs Application Load Balancer Networking Layer 1 vs Layer 4 haproxy u...
-
kubectl --cert=/tmp/tls.crt --key=/tmp/tls.key create secret tls tls-wc-ingress
-
apt-get install exim4 dpkg-reconfigure exim4-config Select: internet site; mail is sent and received directly using SMTP IP-addresses...
-
brew install python3 mkdir -p ~/bin/python3 python3 -m venv ~/bin/python3 source ~/bin/python3/bin/activate enjoy!