We have quite a few Dell boxes. They tend to work allright, but from time to time, we need to call Dell, and make them change a broken thingamajing. When we do, it’s never a good feeling to hear that your support contract ended just a week ago, so sorry, goodbye.
While Dell have been better on selling support contract renewals, I have gone through my boxes from time to time to make sure that their support contracts are still valid. Takes a lot of browsing and time, so hey, why not automate it.
Here’s check_dell_support – a small script that does the trick for you. DO NOT PUT THIS INTO PRODUCTION for a lot of boxes without taking care of spreading the load out over time. I don’t want a call from some Dell techie who tells me my script is hammering his web server down every whole hour or something :-)
The script will probably work until Dell changes their web pages. It uses the Dell service tag, so you have to know it. You also need to have curl installed.
Updates:
- Added a -L option to curl to make it do redirects, needed by users in the US
- Added an extra filter to fix an error when the counter reaches 0
- Added a check if the server state could not be reached, resulting in UNKNOWN (mortis)
#!/bin/bash # # check_dell_support # check your Dell system support contract # crit=2 warn=30 if [ "$1" = "" ] then echo usage: $0 servicetag exit 0 fi tag=$1 URL='http://support.dell.com/support/topics/global.aspx/support/my_systems_info/details?c=us&l=en&s=gen&servicetag=' days=$( curl -L -s "${URL}${tag}" | \ sed -rn 's/.+Days Left.+class="contract_oddrow">[<font color="red"><b>]*([0-9]+).*/\1/p' ) if [ -z $days ]; then echo "UNKNOWN: Could not retrieve info from support.dell.com." exit 3 fi if (( days <= crit )) then echo "CRITICAL: $tag has less than $crit days of hardware support ($days days left)" exit 2 elif (( days <= warn )) then echo "WARNING: $tag has less than $warn days of hardware support ($days days left)" exit 2 else echo "OK: $tag has more than $warn days of hardware support ($days days left)" exit 0 fi