Fujitsu PRIMERGY: Get iRMC Advanced Video Redirection (AVR) Console via CLI

I was asked how to get an iRMC AVR Console window from command line on GitHub. That may be useful for others, so I am sharing the information on my blog.

To get a JNLP file from iRMC S2, S3, and S4, you just need to download avr.jnlp using curl like this

$ curl -s -k -u <iRMC user>:<iRMC password> --digest https://<iRMC address>/avr.jnlp -o avr.jnlp
Example
$ curl -s -k -u admin:admin --digest https://192.168.10.10/avr.jnlp -o avr.jnlp
If you would like to lauch console in one line, you just need to use a pipe to run javaws.
$ curl -s -k -u admin:admin --digest https://192.168.10.10/avr.jnlp -o avr.jnlp |javaws avr.jnlp
For iRMC S5, the above may not work. In that case, get a session token and then download a JNLP file.
$ TOKEN=`curl -i -s -k -u admin:admin -H "Accept: application/json" -H"Content-Type: application/json" https://192.168.10.10/redfish/v1/SessionService/Sessions -d '{"UserName":"admin", "Password":"admin"}' |grep "X-Auth-Token" |awk -F':' '{print $2}'`
$ curl -k -s -H "X-Auth-Token: ${TOKEN}" https://192.168.10.10/avr.jnlp -o avr.jnlp
You can create a small script to automate the above. Here is a sample bash script.
#!/bin/bash

CURL=`which curl`
JAVAWS=`which javaws`

function show_usage() {
    echo ""
    echo "Usage:"
    echo "    $(basename $0) -i  [-u ] [-p ]"
    echo ""
    exit 1
}

function get_irmcs4_console() {
    local irmc=$1
    local user=$2
    local password=$3

    if [ -f avr.jnlp ]; then
        rm -f avr.jnlp
    fi

    ${CURL} -k -s -u ${user}:${password} --digest https://${irmc}/avr.jnlp -o avr.jnlp

    if [ $? -eq 0 -a -f avr.jnlp ]; then
        ${JAVAWS} avr.jnlp
    fi
}

function get_irmcs5_console() {
    local irmc=$1
    local user=$2
    local password=$3

    if [ -f avr.jnlp ]; then
        rm -f avr.jnlp
    fi
    TOKEN=$(${CURL} -i -s -k -u admin:admin -H "Accept: application/json" -H"Content-Type: application/json" https://${irmc}/redfish/v1/SessionService/Sessions -d "{\"UserName\": \"${user}\", \"Password\": \"${password}\"}" |grep "X-Auth-Token" |awk -F':' '{print $2}')

    if [ -z ${TOKEN} ]; then
        echo "ERROR: Could not get the auth token from iRMC"
        exit 1
    else
        ${CURL} -k -s -H "X-Auth-Token: ${TOKEN}" https://${irmc}/avr.jnlp -o avr.jnlp
    fi

    if [ $? -eq 0 -a -f avr.jnlp ]; then
        grep "jnlp" avr.jnlp
        if [ $? -ne 0  ]; then
            echo "ERROR: HTML5 Viewer is used in iRMC"
        else
            ${JAVAWS} avr.jnlp
        fi
    fi
}

while getopts 'i:u:p:h' OPT
do
    case ${OPT} in
        i) iRMC_ADDR=${OPTARG}
            ;;
        u) iRMC_USER=${OPTARG}
            ;;
        p) iRMC_PASS=${OPTARG}
            ;;
        h) show_usage
            ;;
        \?) show_usage
            ;;
    esac
done
shift $((OPTIND - 1))

if [ -z ${iRMC_ADDR} ]; then
    echo "ERROR: iRMC address/name/FQDN is not provided. Please use the '-i' option."
    exit 1
fi

if [ -z ${iRMC_USER} ]; then
    iRMC_USER="admin"
fi

if [ -z ${iRMC_PASS} ]; then
    iRMC_PASS="admin"
fi


${CURL} -s -k https://${iRMC_ADDR}/ | grep "iRMC S5" > /dev/null

if [ $? -eq 0 ]; then
    get_irmcs5_console ${iRMC_ADDR} ${iRMC_USER} ${iRMC_PASS}
    exit
fi

${CURL} -s -k https://${iRMC_ADDR}/ | grep "iRMC S[2-4]" > /dev/null

if [ $? -eq 0 ]; then
    get_irmcs4_console ${iRMC_ADDR} ${iRMC_USER} ${iRMC_PASS}
    exit
fi

echo "ERROR: Could not access the iRMC"
exit 1

5 comments:

RaNd said...

I've looked everywhere for a license key to get AVR, for my TX200 S6, iRMC2 but no luck...
could you guide me where i can find one in a normal price (not 200/300USD)

Thanks!

Unknown said...

Hi guy! i have buy my new server Fuji TX1330 m4 2136 Tower. After mount the hdd the pc stay on first fujitsu screen. I connec t with irmc and this is the error:
BIOS POST Watchdog - Action: Power Cycle (Post Code: 0x9A)

Masa Murayama said...

Hello RaNd,

Sorry for my late response. Since TX200 S6 was EOSL two years ago, I don't think you can purchase a new key for your iRMC S2.
You may be able to get a 30-day evaluation key from support. I'm not sure if you can remove the eval key and re-use it every 30 days. I have not tried that.

Masa Murayama said...

Hello Unknown,

Post Code 0x9a is USB initialization, so please remove USB devices to see if you can boot. If it's a USB keyboard or mouse, please try different one.

ikieasabatka said...
This comment has been removed by a blog administrator.

Good Bye, Folks!

As you may have heard, Fujitsu has completely discontinued Data Center Products and Solutions business in North America on April 1st, 2021. ...