Cool Solutions

Script to generate connection information for DataSync

coolguys

By:

March 12, 2013 3:24 pm

Reads:5,174

Comments:3

Score:4.5

By  jwardza

The recommended Best Practices is to remove devices that are no longer being used. And to keep the number of devices down to less than 150 per server. I had an issue where users were testing out different devices then stop using them and not asking us to remove the device. And via the Web console it is very difficult to find devices that are no longer being used.

To fix that I wrote a simple script to query the Mobility Database and write that information to a Web Page. The script is below.

With the upgrade to version 1.2.5 you can have about 750 devices now. Also the schema has changed. I have added the changes to the script to query version 1.2.5.

  1. I created a script in /usr/local/sbin with a name of devices.sh
    #!/bin/sh
    export PGPASSWORD=xxxxxx
    psql mobility -c "select userid,tstamp,devicetype,identifierstring from devices  order by userid;" -U datasync_user -H -o /tmp/devices.html
    scp /tmp/devices.html user@hostname.com:/srv/www/htdocs
    
    Note: If running 1.2.5 use the line below.
    psql mobility -c "SELECT name,tstamp,devicetype,identifierstring FROM devices, users WHERE devices.userid=guid order by name;"  -U datasync_user -H -o /tmp/devices.html

    You will need to know the password for the mobility database, you set it when installed Datasync. That password goes in place of xxxxx in the export PGPASSWORD line.

    The last line of the script scp’s devices.html to one of our web servers. I used trusted keys between our Linux servers so no password is required.

  2. Add the following to your crontab. I run the script every 15 minutes.
    */15 * * * * /usr/local/sbin/devices.sh

If you look at the output you can see all the devices. You can tell which devices are no longer being used by looking at the tstamp (Time Stamp). You can contact the user and ask him to remove his account from that device. And then you can delete the device from Data Sync.

There are other fields you can query. Those are:

userid
deviceid
identifierstring
description
devicetype
configtype
deviceconfig
pingrequest
pingresponseflag
state
statedata
tstamp

Have fun!

2 votes, average: 4.50 out of 52 votes, average: 4.50 out of 52 votes, average: 4.50 out of 52 votes, average: 4.50 out of 52 votes, average: 4.50 out of 5 (2 votes, average: 4.50 out of 5)
You need to be a registered member to rate this post.
Loading ... Loading ...

Tags: ,
Categories: GroupWise, Technical

Disclaimer: This content is not supported by Novell. It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test it thoroughly before using it in a production environment.

3 Comments

  1. By:jwardza

    We have many users who like to add devices to Datasync but never tell us when they stop using them. I worte this script to find devices no longer is use.

  2. By:floort

    Very cool, i’m going to test the script.
    I hope novell will make something like this inside the datasync webinterface.

    Thanks.

  3. By:laurabuckley

    This script is just what I needed. Would be nice if Novell gave us the functionality native in the web interface ;-)

Comment

RSS