Installing and configuring Graphite with Collectd on FreeBSD

Using Graphite for a smidgen blog like mine is definitely an overkill and Munin fits much better but I wasn’t able to confront my curiosity. So that’s why this post.
Before I start, I’d like to mention that even if I’ll be speaking about my endeavor with Graphite on a system running FreeBSD 10.0-RC5, the same configuration would certainly work on Linux. But since different distros install Graphite’s components into different directories (certainly different from what FreeBSD does) you should update your configuration files smartly.

Posted on January 25, 2014 at 2:43 pm by sergeyt · Permalink · 3 Comments
In: FreeBSD

Another web server powered by FreeBSD

During the last couple of days I’ve been migrating data and various configurations from my old Ubuntu server to a new one which is running FreeBSD 10.0-RC5 now.

Posted on January 10, 2014 at 12:45 am by sergeyt · Permalink · One Comment
In: FreeBSD

Upgrading FreeBSD 9.2 to 10.0-RC4 on Rackpsace’s instance

In reality it turned out to be a fairly straightforward procedure:

Posted on January 9, 2014 at 9:14 pm by sergeyt · Permalink · One Comment
In: FreeBSD

Grow root ZFS pool online under FreeBSD 9.2 using Rackspace’s instance

If you opted for a FreeBSD instance on Rackspace and chose standard configuration then you’ll end up with 512MB of RAM and 20GB of space. That’s ok for the starter but eventually you’d need more one day and will upgrade RAM to 1GB for example. With this upgrade your disk will grow upto 40GB but OS would not notice that (Rackspace doesn’t support automatic disk partitioning on FreeBSD). But you could fix that easily by yourself with a few simple CLI commands.
So lets plunge into the command line and see what we have and what we could do about that:

Bye!

Posted on January 6, 2014 at 10:21 pm by sergeyt · Permalink · 6 Comments
In: FreeBSD

Never make plans but I’ll try

From New Year’s Resolutions for SysAdmins presented by USENIX I have picked just three for myself:

The latter one one is the most important one.

Posted on January 3, 2014 at 8:43 pm by sergeyt · Permalink · Leave a comment
In: Life

How to say “yes” to pkgrm

If you got bored pressing “y” every time you delete a package and pkgrm asks its “Do you want to remove this package? [y,n,?,q]” question, there is a very easy solution:

# yes | pkgrm package1 package2 ... package3

Has saved me a lot of time.

Posted on December 7, 2013 at 11:03 pm by sergeyt · Permalink · Leave a comment
In: Solaris

ruBSD 2013 Conference

Just noticed that the registration for ruBSD 2013 Conference (translated) has been closed. So happy I applied earlier and will have a chance to listen to Theo de Raadt, Konstantin Belousov, Henning Brauer and other BSD starts in person.

Posted on November 30, 2013 at 1:01 am by sergeyt · Permalink · Leave a comment
In: FreeBSD

Why doesn’t Solaris SMF aware service start on boot?

A quick hint on how to find a possible root cause why a newly imported service doesn’t auto start on system reboot. So… You’ve just imported service’s manifest, rebooted the system and noticed the service is still in the offline state:

svccfg import service_manifest.xml
init 6
svcs service_name

STATE          STIME    FMRI
offline        15:55:52 svc:service_name:default

A good start is to use “svcs -l service_name” to check that all service instances upon your service depends (used ssh as an example):

$ svcs -l ssh
fmri         svc:/network/ssh:default
name         SSH server
enabled      true
state        online
next_state   none
state_time   Wed Nov 06 15:55:01 2013
logfile      /var/svc/log/network-ssh:default.log
restarter    svc:/system/svc/restarter:default
contract_id  60
dependency   require_all/none svc:/system/filesystem/local (online)
dependency   optional_all/none svc:/system/filesystem/autofs (disabled)
dependency   require_all/none svc:/network/loopback (online)
dependency   require_all/none svc:/network/physical (online)
dependency   require_all/none svc:/system/cryptosvc (online)
dependency   require_all/none svc:/system/utmp (online)
dependency   require_all/restart file://localhost/etc/ssh/sshd_config (online)

So you’ve checked the logs and all the dependencies and still don’t fully understand why the new service did start. I feel your pain as I was in exactly the same situation. Take a look at the services that depend on your service (again I will use ssh as an example):

svcs -D ssh
STATE          STIME    FMRI
online         15:55:51 svc:/milestone/multi-user-server:default

Or instead, the services it depends upon:

svcs -d svc:/application/management/sma:default
STATE          STIME    FMRI
online         15:54:38 svc:/milestone/name-services:default
online         15:54:49 svc:/system/cryptosvc:default
online         15:54:50 svc:/milestone/network:default
online         15:54:51 svc:/system/filesystem/local:default
online         15:55:00 svc:/milestone/sysconfig:default
online         15:55:01 svc:/system/system-log:default
online         15:55:06 svc:/network/rpc/rstat:default

If you don’t see “milestone” being mentioned in the output then that is definitely the problem and explains why the service didn’t start when you rebooted the system. Basically it’s the same as if you hadn’t run “chkconfig service_name on” on a RedHat-like or “update-rc.d serice_name defaults” on a Debian-like Linux system. Refer to the table below to get an idea which run level corresponds to what milestone:

Run Level SMF Milestones
Smilestone/single-user:default
2milestone/multi-user:default
3milestone/multi-user-server:default

For the sake of completeness here is a full list of all milestones available (at least on the system I have near me):

svcs "milestone*"
STATE          STIME    FMRI
disabled       15:54:42 svc:/milestone/patching:default
online         15:54:38 svc:/milestone/name-services:default
online         15:54:49 svc:/milestone/devices:default
online         15:54:50 svc:/milestone/network:default
online         15:54:50 svc:/milestone/single-user:default
online         15:55:00 svc:/milestone/sysconfig:default
online         15:55:34 svc:/milestone/multi-user:default
online         15:55:51 svc:/milestone/multi-user-server:default

Time to open the service’s manifest file and edit it. And here you have two options:

 
<dependent
    name='ssh_multi-user-server'
    grouping='optional_all'
    restart_on='none'>
    <service_fmri value='svc:/milestone/multi-user-server' />
</dependent>

<dependency name='network'
    grouping='require_all'
    restart_on='error'
    type='service'>
    <service_fmri value='svc:/milestone/network:default'/>
</dependency>

Now disable, delete, import and enable the service once again:

svcadmin disable service_name
svccfg delete service_name
svccfg import service_name.xml
svcadmin enable service_name

At this point you could safely reboot the system.

Posted on November 7, 2013 at 10:46 am by sergeyt · Permalink · Leave a comment
In: Solaris

Back to school with Coursera

There are two courses that have been recently relaunched at coursera.org:

Both are very interesting and highly recommended to attend. So don’t think twice and join the class whilst they are in their first week only.
Hopefully I will have enough time to complete both of them.

Posted on October 17, 2013 at 2:44 pm by sergeyt · Permalink · 5 Comments
In: Life

Matching Oracle ASM disks names with the physical devices

Quite often it’s required to find a physical device which backs up ASM disk. The easiest way a Linux administrator could accomplish that is by using oracleasm command (of course, if ASMlib was used to create them):

# oracleasm listdisks
ASMARCHIVE1
ASMARCHIVE2
ASMARCHIVE3
ASMDATA1
ASMDATA2
ASMDATA3
OCR1
OCR2
VOTEDISK1
VOTEDISK2
VOTEDISK3
# oracleasm querydisk -p OCR1
Disk "OCR1" is a valid ASM disk
/dev/mapper/mpath6: LABEL="OCR1" TYPE="oracleasm"
/dev/sdx: LABEL="OCR1" TYPE="oracleasm"
/dev/sdh: LABEL="OCR1" TYPE="oracleasm"
/dev/sdan: LABEL="OCR1" TYPE="oracleasm"
/dev/sdbd: LABEL="OCR1" TYPE="oracleasm"
Posted on October 8, 2013 at 11:40 pm by sergeyt · Permalink · Leave a comment
In: Linux