Friday, August 9, 2013

Scheduled Switch Reloading

Had this tip passed on to me by an Axia representative when we were provisioning a bunch of changes to our network. if you're making switch configuration changes remotely (something I often have to do because of how remote our sites are) a good idea is to schedule a reboot of the switch in the near future, then make your configuration changes. Then if everything looks good, write your config and cancel the reload. That way if things go bad and you loose connectivity, the switch will reboot with it's old (working) configuration!

For Procurve switches, this might look something like:
reload after 35 (to schedule a reboot in 35 minutes)
and if you want to cancel the reload:
no reload

Tuesday, April 23, 2013

Bells via Asterisk Paging

As a few of our sites don't have a traditional PA system, and no way to play bell noises to signal class breaks, we decided to use the asterisk paging system to play bell noises through the handsets in each classroom. There are a few different ways of doing this, but here's the solution we came up with

1) Create a paging group with the extensions you want to play the sound (our sites are currently using Trixbox, so this is under the Paging and Intercom section). Let's call that extension XXXX

2) Create a dummy extension to play the bell noise.
This involves editing /etc/asterisk/extensions_custom.conf and creating an extension that just plays the sound and then hangs up. Let's call that extension YYYY. Add the following near the end of the file:

[ext-paging-custom]
exten => YYYY,1,Answer
exten => YYYY,n,Wait(3)
exten => YYYY,n,Background(hello-world)
exten => YYYY,n,HangUp()

Replace hello-world with the name of a sound file in your asterisk system. If the sound takes too long to start, or has already started when the page happens, you'll need to adjust the value for Wait() as well.

3) Create a cron job to make the bells ring. You can use the following command
asterisk -rx 'originate Local/YYYY@ext-paging extension XXXX@ext-paging'
This will originate the page from the YYYY extension, which will play the bell noise and hang up.

It's also not a bad idea, if you're running trixbox or freepbx or similar, to add the YYYY extension to the "custom extensions" (trixbox: PBX -> PBX Settings -> Tools tab -> custom extensions, freepbx: Admin -> Custom extensions) so that you don't accidentally assign extension YYYY.

Wednesday, March 13, 2013

Syncing Active Directory Groups as Moodle Cohorts

We had a situation that required us to synchronize certain active directory groups with enrollment in a moodle course. The way we accomplished this was to use a moodle userscript that synced active directory groups as cohorts. Then we assigned the cohorts to the course using the "cohort-sync" enrollment type.

The following steps assume you already have moodle LDAP auth configured and are running the /auth/ldap/cli/sync_users.php to sync LDAP users to moodle.

1. Obtain the sync_cohorts.php script from https://tracker.moodle.org/browse/MDL-25011?attachmentOrder=desc and place it in /auth/ldap/cli/

2. Add the following lines to moodle's config.php

$CFG->ldap_group_class='group';
$CFG->ldap_process_nested_groups=1;
$CFG->ldap_real_user_attribute='sAMAccountName';
ldap_group_class - needs to be set to 'group' for active directory in order to match user groups
ldap_process_nested_groups - set this to 1 if you have groups as members of your groups in order to locate the actual users
ldap_real_user_attribute - this is probably whatever you have "User attribute" set to in moodle's LDAP settings. Also note that it is CASE SENSITIVE (that one gave me some trouble until I realized what the issue was).

3. Add the sync_cohorts.php scrip to your webserver user's crontab to be run sometime after the ldap sync_users.php finishes.

4. Add the newly created cohort to your course using the cohort-sync enrollment type.

Tuesday, March 12, 2013

Converting from Hyper-V using VMWare Converter: Take 2

I ran into another cause of the dreaded “Unable to obtain hardware information” when trying to convert some VMs from a Hyper-V 2012 server. Turns out that VMware Converter will throw this error if the VM is using the newer .vhdx virtual disk format instead of .vhd.

To get around it, convert the disks to .vhd (because Hyper-V server is a core server, I used the PowerShell cmdlet "Convert-VHD".

Power down the VM
Convert the vhdx to vhd using the command: Convert-VHD - Path C:\Path\To\Virtual\Drive\VMname.vhdx -DestinationPath C:\Path\To\Virtual\Drive\VMname.vhd
Reconfigure the VM. Detach the old vhdx drive, attach the vhd drive.
Run converter again.

Presto!

Friday, March 8, 2013

Converting from Hyper-V using VMWare Converter

Ran into this very issue that was blogged about here: http://www.techromeo.com/?p=115

Lots of head scratching on this one.  As usual, I took the long way around so I figured I had to share it.
Problem:  When using the new VMware Converter Standalone, running on Windows 2008R2, to convert Hyper-V machines, I would receive the error “Unable to obtain hardware information”.
Solution:  On the folder on the Hyper-V host that contains the vhd’s, set the NTFS permissions so that the local Users group has full control, rather than the default read permissions.
Background:  It appears that VMware converter creates a local account on the machine it is installed on.  I tried running Converter locally on the Hyper-V host and setting explicit permissions to that local account.  Also keep in mind that Converter will ask you for credential to connect to the Hyper-V host and will not work without them.  I also tried to set the permissions to the machine account to that of the machine running converter.

 Good to know!

Friday, March 1, 2013

Syncing Moodle Users from Active Directory

I've been working a lot lately on automating user creation in moodle. We already have LDAP auth against our Active Directory server, but that only creates users when they log in. Also, because we are using Mnet to handle logins to two other servers, accounts weren't getting pre-populated there.

I came across a great powershell script by David Wiseman that I could adapt to query our student information system to create accounts in active directory. You can check it out here: http://www.wisesoft.co.uk/scripts/powershell_create_ad_user_accounts_from_sql_server_database.aspx

Once I had my accounts being created, I could use moodle's sync_users.php script running as a cron job to pre-populate our main moodle server. Some caveats though. Make sure you modify your objectclass filter in moodle to be (&(objectClass=user)(!(objectClass=computer))otherwise you'll also get computer accounts as well as user accounts. You'll also either need to patch sync_users.php to allow paginated results from LDAP or increase the MaxPagesize variable for your active directory install to be able to return all the users in a single page using ndsutil (the default is 1000 results per page). There's some relevant moodle discussion here.

The last bit was to be able to pre-populate the linked mnet servers with the proper accounts. Which I did using the following SQL query


INSERT INTO moodle_db2.mdl_user (auth, confirmed, policyagreed, mnethostid, username, password, idnumber, firstname, lastname, email, institution, city, country)
SELECT 'mnet', mdl_user.confirmed, mdl_user.policyagreed, '5', mdl_user.username, mdl_user.password, mdl_user.idnumber, mdl_user.firstname, mdl_user.lastname, mdl_user.email, mdl_user.institution, mdl_user.city, mdl_user.country
FROM moodle_db1.mdl_user
WHERE institution = 'Mnet Institution Name'
ON DUPLICATE KEY UPDATE auth='mnet', confirmed=moodle_db1.mdl_user.confirmed, policyagreed=moodle_db1.mdl_user.policyagreed, mnethostid='5'
This lets me select just the users who should be on the federated mnet server and create their accounts, if the user already exists, it updates a few fields. mnethostid will vary by installation, in my case it was 5 but you should be able to query the database easily to find out what it should be in your specific installation.

Friday, February 15, 2013

Large Scale Course, Enrollment & Content Management

Notes from Moodlemoot 2013


Asim Aziz and Chris Goetz from the U of A presented

Challenges
Info from SIS is very fluid
18 different faculties
SIS info is often behind reality
Philosophy is if something is not urgent and not unusual, it should be automated.

Automation
course creation - automatically created upon instructor request
self-service request tool

Content management
copy content from old courses, user never sees moodle's backup restore page

enrollment management
180000 seats in flux
cohorts used for enrollment
instructors/TAs enrolled
sometimes a faculty level course used for shared resources

create course
copy contents
add cohorts

faculties broken down by categories
cohorts sync'd daily
groups created with cohort

copy content plugin + IMS enterprise plugin

Archive server filesystem is mounted to production server to allow access to courses (so it can get at MBZ)