BaroqueW

BaroqueW

and his sidekick nikkitaa

BaroqueW RSS Feed
 
 
 
 

Posts tagged Apple

Sloppy Apple

After making of the launch of their iPhone 3GS a big event full of rejoicing for the nerd herds and apple maniacs, Apple is getting sloppy with the unlucky ones that won’t get their new iPhone early.

In Sweden, it’s only discreetly that Telia announced, a few weeks after the official keynote and 10 days after the release in some other countries of Europe, that the iPhone would only reach god-forsaken Sweden on July 31st.

iPhone 3G discreetly coming to a shop near you, on July 31st

For Apple, the iPhone is already available all over the world except a couple of poor African countries.

Apple - iPhone: NOT released in Sweden yet

Also, note to Apple, most people do not speak Spanish in Sweden. So hey, don’t forget that having a popular product doesn’t mean you can get sloppy!No hablo svenska

  • Share/Save/Bookmark
Category: Articles in English, Suède / Sweden, Tech | Comments (3)

Cacti on a MacOSX machine

Why?

Sometimes, you want to have everything under control. Or just have some nice graphs to watch during your long idle moments. Then cacti is something for you. It will allow you to monitor various values for various machines: bandwidth use for your router, CPU or hard disk use for your server, number of logged in users for your workstation… Cacti polls it for your using SNMP and then makes some nice graphs out of it.

How?

This article will briefly guide through setting up your random Intel Mac machine running Leopard (tested here on a MBP and iMac) to turn it into a Cacti server. Note that with that, you will be able to monitor any machine or device, running MacOSX or not, Linux or not, being an actual PC or not.

Step one will be to install the necessary Linux packages through Mac Ports. If you start from scratch, download the installer from the site, install it, and then run from Terminal

sudo /opt/local/bin/port -v selfupdate
sudo /opt/local/bin/port install net-snmp rrdtool

You will also need to install MySQL for MacOSX from MySQL website. This will put a nifty panel in your System Preferences, make sure the MySQL engine is enabled before proceeding forward.

We will run Cacti as the cacti user on the system, so go and create it. Open System Preferences and go under the Accounts panel. Create a user named cacti, give it some password, and keep it a “Standard user”.

Now, from the Terminal, change to being the cacti user and let’s proceed onward:

su cacti
cd ~
wget http://www.cacti.net/downloads/cacti-0.8.7d.tar.gz
tar -zxvf cacti-0.8.7d.tar.gz
ln -s ~/cacti-0.8.7d /Library/WebServer/Documents/cacti

Now time to deal with the database:

sudo mysqladmin -u root password <new password>
sudo mysqladmin --user=root -p create cacti

Change directory to the cacti directory or give the full path to cacti.sql

mysql -u root -p cacti < cacti.sql
sudo mysql -u root -p mysql
mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'password'; exit;

Now, edit include/config.php with the right values based on what you used above:

$database_type = "mysql"; 
$database_default = "cacti"; 
$database_hostname = "localhost"; 
$database_username = "cacti"; 
$database_password = "password";

Data has to be polled at a regular interval, usually five minutes, so, still as cacti user, from Terminal, run

crontab -e

and append this line somewhere:

*/5 * * * * php /Library/WebServer/Documents/cacti/poller.php > /dev/null 2>&1

Now you should be able to access your Cacti server from http://localhost/cacti/ so just follow the on screen indications for a while.

Go in Configuration > Settings in the main page in the Console view, NET-SNMP version should be 5.x and RRDTool should be 1.2.x. Otherwise, you will never get any graphs.

Now we have to add some data sources.

  1. Go into Devices > Add > give the device a name, a description, and give its IP or hostname (start with localhost, it’s the easier). SNMP version 2, public should be your default choices. For my part, I have set that localhost to being a “Leopard host” (see templates below), and added those graph templates:Linux – Memory Usage, Unix – Load Average, Unix – Logged in Users, Unix – Processesand the following data queries:SNMP – Get Mounted Partitions, SNMP – Get Processor Information, SNMP – Interface Statistics, Unix – Mounted partitions.When adding the templates and queries to a host, check if they return a success or a failure (Status column). Also, you can check on top of the page to see if the host is even reachable at all (Ping Results and SNMP Information).
  2. As a second example, here is how to add a Web server to your Cacti monitoring. Add another device, I set it to “web server – apache” (see below how to import templates), device detection is set to Ping or SNMP (UDP ping).I have added the following graph templates:teMySQL – CPU Usage, teMySQL – Load Average, WebServer – Apache Statistics – Hits /s, WebServer – Apache Statistics – kBits / sand following data queries:

    SNMP – Get Mounted Partitions, SNMP – Get Processor Information, SNMP – Interface statistics.

Some things to keep in mind:

  • If you have a public server, using SNMP 1 or 2, you don’t have much possibility to securize the SNMP protocol. You might want to disable all rw access and change the community name in /etc/snmp/snmpd.conf, for instance I commented out a bunch of lines in mine:

[...]

####
# First, map the community name (COMMUNITY) into a security name
# (local and mynetwork, depending on where the request is coming
# from):

#       sec.name  source          community
com2sec local     0.0.0.0       mycommunityrocks
#com2sec mynetwork NETWORK/24      COMMUNITY

####
# Second, map the security names into group names:

#               sec.model  sec.name
#group MyRWGroup        v1         local
group MyROGroup v2c        local
#group MyRWGroup        usm        local
#group MyROGroup v1         mynetwork
#group MyROGroup v2c        mynetwork
#group MyROGroup usm        mynetwork

####
# Third, create a view for us to let the groups have rights to:

#           incl/excl subtree                          mask
view all    included  .1                               80

####
# Finally, grant the 2 groups access to the 1 view with different
# write permissions:

#                context sec.model sec.level match  read   write  notif
#access MyRWGroup ""      any       noauth    exact  all    all   all
access MyROGroup ""      any       noauth    exact  all    none none

# -----------------------------------------------------------------------------

[...]

  • Also, sometimes, you will be presented with data from a different host (usually localhost) than the host you are working on. Be careful not to add this data to your graphs! (in device / graphs views in Console)
  • Which leads me to warn you that once data has been added to a device, you still need to create a graph about it, which will instruct Cacti to try to create the graph, and not just poll the values.
  • Last point, it’s probably a good thing to browse around Cacti’s interface to really customize it to your needs. Graph trees for instance will help you make useful views for your graphs: by host, by data type, etc.

Templates

You can install some extra data presentation and fetching templates via the obvious “Import templates” in the Console view in Cacti’s GUI. I used the following templates:

  1. apachestats make sure to enable mod_status in your apache server and to copy ws_apachestats.pl into Cacti’s scripts folder.
  2. teMySQLcacti to monitor MySQL use (including innoDB)
  3. Leopard templates (I do not seem to remember where I found them, please contact me if you know about their source)

Extra templates can be found there for instance: http://www.debianhelp.co.uk/cactitemplates.htm

Result

Note that it will take some time before enough data is gathered and the graphs can start being created and displayed, be patient. Count a couple of hours.

Sources:

Because I simply didn’t invent all of that, below are the links I used as guide lines. I wrote this article because some were a bit outdated or concerned MacOSX server. Or simply because I prefer to have it all in one place.

http://forums.cacti.net/about10202.html

http://frjo.info/?p=30

  • Share/Save/Bookmark
Category: Articles in English, Tech >> Computer | Comments (2)

That should be enough…

Screenshot from the Activity Monitor

Screenshot from the Activity Monitor

With over 16 million terabytes of RAM memory, this encode with Handbrake should go very very fast! There was indeed a good performance bump on the new iMac models!

  • Share/Save/Bookmark
Category: Articles in English, Humour, Tech >> Computer | Leave a comment

iPhoto et tags EXIF

Adapté d’un script par Andrew Turner, ce script Applescript permet d’ajouter des tags Exif (commentaires, titre, date, etc.) à vos photos à partir des méta-données que vous aurez saisies dans iPhoto. Pour ce faire, sélectionnez vos photos dans iPhoto (pas des albums mais bien des photos) et exécutez ce script. Voir plus bas pour quelques commentaires et le script à télécharger.

– This applescript will set the exif keywords, name, and comments of all selected iPhoto
–   images using the information current in iPhoto.

– Author: Andrew Turner (http://highearthorbit.com)
– Editor: BaroqueW (http://www.baroquew.net)

property copyright : ""
property URL : ""
property exifToolOriginal : "_original"

– True retains copyright, False means Public Domain
property Copyrighted : "False"

tell application "iPhoto"
        activate
        try
                copy (my selected_images()) to these_images
                if these_images is false or (the count of these_images) is 0 then ¬
                        error "Please select a single image."

                set counter to 0

                repeat with i from 1 to the count of these_images
                        set the keywordslist to ""
                        set this_photo to item i of these_images
                        tell this_photo
                                set the image_file to the image path
                                set the image_title to the title
                                set the image_filename to the image filename
                                set the image_comment to the comment
                                set the assigned_keywords to the name of keywords
                                set the image_date to the date
                                set date_step1 to do shell script "echo " &amp; image_date &amp; " | sed ’s/,//g’ | sed ’s/\\([A-Z][a-z][a-z]\\)\\([a-z]\\)*/\\1/g’ | sed ’s/[0-9][0-9]\\([0-9][0-9]\\)/\\1/’"
                                set date_step2 to do shell script "date -j -f ‘%a %b %d %y %I:%M:%S %p’ " &amp; quoted form of date_step1 &amp; " ‘+%y:%m:%d %H:%M:%S’  | sed ’s/^0/200/’ | sed ’s/^9/199/’"
                        end tell
                        repeat with j from 1 to the count of assigned_keywords
                                set the keywordslist to keywordslist &amp; " -keywords+=" &amp; item j of assigned_keywords
                        end repeat
                        set the command to "exiftool -m -PL -title=\"" &amp; image_title &amp; ¬
                                "\" " &amp; keywordslist &amp; ¬
                                " " &amp; " -comment=’" &amp; image_comment &amp; ¬
                                "’ " &amp; " -CreateDate=’" &amp; date_step2 &amp; ¬
                                "’ " &amp; " -DateTimeOriginal=’" &amp; date_step2 &amp; ¬
                                "’ " &amp; " -Copyright=’" &amp; copyright &amp; ¬
                                "’ " &amp; " -CopyrightNotice=’" &amp; copyright &amp; ¬
                                "’ " &amp; " -Rights=’" &amp; copyright &amp; ¬
                                "’ " &amp; " -Marked=’" &amp; Copyrighted &amp; ¬
                                "’ " &amp; "\"" &amp; image_file &amp; "\""
                        set output to do shell script command
                        do shell script "rm \"" &amp; image_file &amp; "\"" &amp; exifToolOriginal
                        set counter to counter + 1
                end repeat
                display dialog "Exif writing complete for " &amp; (counter as string) &amp; " files."
        on error error_message number error_number
                if the error_number is not -128 then
                        display dialog error_message &amp; " Exif writing complete for " &amp; (counter as string) &amp; " files." buttons {"Cancel"} default button 1
                end if
        end try
end tell

on selected_images()
        tell application "iPhoto"
                try
                        – get selection
                        set these_items to the selection
                        – check for single album selected
                        if the class of item 1 of these_items is album then error
                        – return the list of selected photos
                        return these_items
                on error
                        return false
                end try
        end tell
end selected_images

J’ai amélioré le script pour le rendre compatible avec les inévitables accents et apostrophes de la langue française. J’ai aussi ajouté le support pour les dates (cf. les expressions régulières et ’sed’ plus haut, lignes 33 et 34) – à noter que mes locales sont en anglais sur MacOSX donc il y aura peut-être des adaptations à faire pour retomber sur vos pieds (notamment l’usage de AM/PM serait surprenant avec des locales françaises, voir ligne 34). Petite cerise sur le gâteau, le programme retourne le nombre de fichiers modifiés (ligne 53) et éventuellement le fichier qui a causé une erreur en cas de plantage (ligne 56).

Attention : par choix personnel, j’ai décidé d’ignorer les erreurs mineures (modificateur ‘-m’ dans la commande ‘exiftool’ à la ligne 39). Il est recommandé d’essayer le script sans ce modificateur et de le rajouter si vous rencontrez des problèmes et que vous voulez tenter votre chance.

Vous pouvez télécharger le script ici : Set Exif Data

  • Share/Save/Bookmark
Category: Articles en français, Tech >> Computer | Leave a comment

A GPS on your Mac

I just bought a no-name USB GPS receiver in the Swedish store Teknikmagasinet and it’s up and running on my Mac (Leopard 10.5.1 or Ubuntu via Parallels). Story of an installation.

The device is just a small box, the size of a matchbox, that you can connect using the built-in PS2 cable or using the USB cable extension provided in the package (convenient to place the receiver outside or by the window). The package also contains a CD, note really useful (especially the test application) but it gives a very exhaustive list of the NMEA commands the receiver understands. The GPS chip is a Nemerix (not a Garmin, not a SiRF). For $40 to $60, you can find on Amazon similar USB GPS receivers with various chips and features (waterproof, number of channels, etc.).

UbuntuFirst of all, Ubuntu with Parallels. My install is the installation that can be found on the website of Parallels. Remember to connect the USB port to Parallels (Devices>USB>USB-Serial controller) before going any further. Next, go in System>Administration>Synaptics Package Manager under Ubuntu. You can do a search on the string “GPS” and install the packages you feel interested in. At least, you need to install the GPS daemon gpsd and a client: xgps or gpsdrive. Then, start gpsd with ‘gpsd -n -D 3 -p /dev/ttyUSB0‘. If you want to push the envelope any further, go and visit the gpsd web site, otherwise, I provide all the basic informations here. To check your GPS receiver is working, start xgps or gpsdrive. If you see a sort of constellation in xgps representing the various satellites of the GPS system, or if your position shows up properly in gpsdrive, you’re good. If you have a display in xgps but not coordinates on the left side of the screen, it means the signal is too weak. Get the receiver outside or closer to a window, or try to get a clear horizon. To do some debugging, stop gpsd and start it again with ‘gpsd -n -N -D 3 -p /dev/ttyUSB0} to check the messages exchanged between the receiver and the computer. If you see a message saying “satellite data no good”, it means there is no proper reception. See below to screenshots: first, a screen of xgps with a poor reception (”n/a” on the left of the screen) and a screen of gpsdrive with a proper signal (I removed the bottom of the screen that included my coordinates). I didn’t test but this whole setup should be compatible with Kismet.

xgps

gpsdrive

MacOSXNow, let’s have a look at MacOSX. The easiest is to start installing the driver for PL2303 (the USB controller for many GPS receivers) on Prolific’s website. Then, install gpsdX, the OSX version of gpsd. Then start the start the application called ‘gpsdX Config’ and choose ‘/dev/tty.usbserial’, the peripheral created by the driver downloaded on Prolific (obviously if you GPS receiver is bluetooth-enabled, just select one of the /dev/tty.Bluetooth devices from the list). Apply the new settings and you now have a gpsd server running under MacOSX! Next step, finding a client. You have two options: gps2geX that interfaces gpsd with Google Earth (even in its free version), or the MacOSX port of GpsDrive developed by VASS-Softwareentwicklung. The first one obviously needs to have Google Earth installed on your computer. To use gps2geX, start GE, then start gps2geX, next click on “Start gps2geX” and here you are: Google Earth is kept updated regularly with your position! On the other hand, GpsDrive requires the installation of X11 from your copy of the DVD of MacOSX Leopard (or Tiger). Note that Gpsdrive is a PPC binary (but runs on Intel computers via Rosetta). The rest is just like under Ubuntu. Last precision, the use of gpsX is compatible (tested) with KisMAC (Kismet and KisMAC are two tools for wireless networks).

  • Share/Save/Bookmark
Category: Articles in English, Tech >> Computer | Comments (2)

Status

  • BaroqueW ecoute desproges dans les fjords
    1 day ago
  • BaroqueW : it is in fact NOT funny to point people in the wrong direction when they're lost
    1 day ago
  • BaroqueW : iphone 3gs, July 31st in Sweden - according to Telia
    3 days ago
  • BaroqueW had a quick look at the book keeping of the holidays... gloups
    3 days ago

Popular posts

My Social Networks

DandyID 43 Things Clipmarks coComment Dailymotion Delicious deviantART Digg Diigo Facebook Flickr Get Satisfaction Guitar Hero HelloTxt Hulu ICQ Imdb Imeem Kiva last.fm Linkedin Netvibes orkut PeoplePond Picasa Plaxo PostCrossing RockBand Scribd Stumbleupon Tagged TripAdvisor Twitpic Twitter Xbox LIVE YouTube

Expand the experience

Blogroll

Internet Map

Meta