How to monitor your Dymo printserver

About twice a week, I get a call that a Dymo LabelWriter 450 no longer works. In most cases, the reason was that the user pulled the USB cable.

My Dymo LabelWriters are connected to a Dymo printserver. While the printservers can be monitored using ping, this does not allow you to see if the printer it still connected to the printserver. Luckily the Dymo printserver has SNMP support with the option to see what device is connected.

I did a SNMPWalk against the printserver, first with the LabelWriter connected, then disconnected. Aside from some counters, three values were different:

ConnectedDisconnected
HOST-RESOURCES-MIB::hrDeviceDescr.2 = STRING: DYMO LabelWriter 400HOST-RESOURCES-MIB::hrDeviceDescr.2 = STRING: [nothing here]
HOST-RESOURCES-MIB::hrDeviceStatus.2 = INTEGER: running(2)HOST-RESOURCES-MIB::hrDeviceStatus.2 = INTEGER: unknown(1)
HOST-RESOURCES-MIB::hrPrinterStatus.1 = INTEGER: idle(3)HOST-RESOURCES-MIB::hrPrinterStatus.1 = INTEGER: unknown(2)

I also found that HOST-RESOURCES-MIB::hrDeviceDescr.2 sometimes shows the correct printer string one time, but doesn't show it the second time:

$ snmpget -v 1 -c public dymo2  HOST-RESOURCES-MIB::hrDeviceDescr.2
HOST-RESOURCES-MIB::hrDeviceDescr.2 = STRING: DYMO LabelWriter 450
$ snmpget -v 1 -c public dymo2  HOST-RESOURCES-MIB::hrDeviceDescr.2
HOST-RESOURCES-MIB::hrDeviceDescr.2 = STRING: 
$ snmpget -v 1 -c public dymo2  HOST-RESOURCES-MIB::hrDeviceDescr.2
HOST-RESOURCES-MIB::hrDeviceDescr.2 = STRING: DYMO LabelWriter 450
$ snmpget -v 1 -c public dymo2  HOST-RESOURCES-MIB::hrDeviceDescr.2
HOST-RESOURCES-MIB::hrDeviceDescr.2 = STRING: 
$ snmpget -v 1 -c public dymo2  HOST-RESOURCES-MIB::hrDeviceDescr.2
HOST-RESOURCES-MIB::hrDeviceDescr.2 = STRING: DYMO LabelWriter 450

Therefore, I use a script that tries 10 times in a row. If it finds a valid string at least once, that's good enough:

#!/bin/bash
 
[ "$1" == "" ] && { echo "Syntax: $0 [hostname]" ; exit 1; }
 
i=0
while [ $i -lt 10 ]; do
        response=$(/usr/lib64/nagios/plugins/check_snmp -H $1 -o HOST-RESOURCES-MIB::hrDeviceDescr.2 -R dymo)
        retval=$?
        if [ $retval -eq 0 ]; then
                echo $response
                exit $retval
        fi
        i=$((i+1))
done
 
echo "Printer disconnected from printserver"
exit 2

This script can be used with Nagios to monitor the LabelWriter.

© GeekLabInfo How to monitor your Dymo printserver is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Several ways to mount a harddisk/usb disk image

I've got an image of a USB disk that was created with the command dd. How can we mount it and access files? The file is named smosimg

Method 1: fdisk and bash

# fdisk -l smosimg
 
Disk smosimg: 1993 MB, 1993342976 bytes, 3893248 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000336e0
 
  Device Boot      Start         End      Blocks   Id  System
smosimg1   *        2048     1230847      614400   83  Linux
smosimg2         1230848     3893247     1331200   83  Linux

I want to mount the second partition that starts at block 1230848. The block size is 512 bytes, so we multiply 1230848 by 512:

mkdir target
mount -o loop,offset=$((1230848*512)) smosimg target

Method 2: kpartx

mkdir target
kpartx -a smosimg
mount /dev/mapper/loop0p2 target -o loop
kpartx -d smosimg

Method 3: losetup

mkdir target
losetup --partscan --find --show disk.img
mount /dev/loop0p2 target
losetup -d /dev/loop0

I've personally tested all three methods, and on my Fedora 18 machine, they all work.

© GeekLabInfo Several ways to mount a harddisk/usb disk image is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...