no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | monitors:sentinel [2010/02/25 08:20] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== sentinel.sh ====== | ||
+ | |||
+ | ^ Author | [[ goldfndr@gmail.com | Richard Finegold ]] | | ||
+ | ^ Compatibility | Xymon 4.2 | | ||
+ | ^ Requirements | bash with wget and printf | | ||
+ | ^ Download | None | | ||
+ | ^ Last Update | 2010-02-25 | | ||
+ | |||
+ | ===== Description ===== | ||
+ | This script tracks licenses in use for each SafeNet Sentinel Protection Server key, optionally graphing. For example, [[http:// | ||
+ | |||
+ | ===== Installation ===== | ||
+ | === Client side === | ||
+ | * If you haven' | ||
+ | * Note the port used by the Sentinel Protection Server (defaults to 6002). Make sure you can bring it up in a web page (e.g. http:// | ||
+ | - Run '' | ||
+ | - Press the " | ||
+ | - Check the Http Port. | ||
+ | * On the resulting web page, note the Serial Numbers, and determine what each key protects. | ||
+ | |||
+ | === Server side === | ||
+ | Edit $BBHOME/ | ||
+ | |||
+ | * sentinel[:// | ||
+ | |||
+ | For example: | ||
+ | | ||
+ | | ||
+ | |||
+ | Copy sentinel.sh (below) to your $BBHOME/ext and make sure it's executable. | ||
+ | |||
+ | Add the following (or similar) to $BBHOME/ | ||
+ | [sentinel] | ||
+ | NEEDS hobbitd | ||
+ | CMD / | ||
+ | LOGFILE $BBSERVERLOGS/ | ||
+ | INTERVAL 5m | ||
+ | </ | ||
+ | == Optional graphing == | ||
+ | <hidden onHidden=" | ||
+ | * Add the following to $BBHOME/ | ||
+ | [sentinel] | ||
+ | FNPATTERN InUse.(.+).rrd | ||
+ | TITLE Sentinel Utilization | ||
+ | YAXIS Used | ||
+ | # | ||
+ | DEF: | ||
+ | # | ||
+ | LINE1: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | [sentinel1] | ||
+ | FNPATTERN UsePercent.(.+).rrd | ||
+ | TITLE Sentinel Utilization | ||
+ | YAXIS Percent | ||
+ | DEF: | ||
+ | # | ||
+ | LINE1: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | </ | ||
+ | * In $BBHOME/ | ||
+ | TEST2RRD=" | ||
+ | GRAPHS=" | ||
+ | SPLITNCV_sentinel=" | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== Source ===== | ||
+ | ==== sentinel.sh ==== | ||
+ | |||
+ | <hidden onHidden=" | ||
+ | <code bash> | ||
+ | #!/bin/sh | ||
+ | # This script checks the Sentinel License Monitor on hosts | ||
+ | # and reports each key's usage and details. | ||
+ | # In your bb-hosts file, use the following syntax: | ||
+ | # | ||
+ | # Where port is the port for your Sentinel License Monitor (default 6002), | ||
+ | # | ||
+ | # For example: | ||
+ | # 0.0.0.0 example1 # sentinel | ||
+ | # 0.0.0.0 examplep # sentinel: | ||
+ | # 0.0.0.0 examplen # sentinel, | ||
+ | # Note: this has only been tested with SuperPro keys. | ||
+ | # | ||
+ | # Requirements: | ||
+ | # wget and printf must be available. | ||
+ | |||
+ | # Notes: | ||
+ | # For some keys, the detail columns should be (7.3.2): | ||
+ | # IP Address | ||
+ | # But this always uses the same method: (7.4.2): | ||
+ | # Client/ | ||
+ | # | ||
+ | # This uses the machine name, and not the IP address, when checking. | ||
+ | |||
+ | BBHTAG=sentinel | ||
+ | COLUMN=$BBHTAG # | ||
+ | TABLEH="< | ||
+ | EMPTYTABLES=0 # | ||
+ | |||
+ | |||
+ | #Make sure we have required executables. Allow interactive run from ext. | ||
+ | [ " | ||
+ | [ " | ||
+ | |||
+ | |||
+ | #Just to avoid some excessive indenting, define a function | ||
+ | check_usage() | ||
+ | { | ||
+ | echo " | ||
+ | < | ||
+ | |||
+ | #Although the keys are relatively easy to get, the counts are harder. | ||
+ | #The server requires getting the counts page followed by xml. | ||
+ | #Timing is everything. Grr... | ||
+ | |||
+ | wget " | ||
+ | wget " | ||
+ | /g' | $SED ' | ||
+ | tag=`echo " | ||
+ | val=`echo " | ||
+ | case $tag in | ||
+ | ClientIPAddress) IPADDRESS=" | ||
+ | ClientUserName) USERNAME=" | ||
+ | ClientLogTime) LOGTIME=" | ||
+ | ClientProcessID) PID=" | ||
+ | #Start with a colon to avoid NCV processing ($LOGTIME has colons) | ||
+ | echo "< | ||
+ | ;; | ||
+ | # | ||
+ | #*) ;; | ||
+ | esac | ||
+ | done | ||
+ | echo "</ | ||
+ | } | ||
+ | |||
+ | #The main loop | ||
+ | #echo ' | ||
+ | $BBHOME/ | ||
+ | set $L # To get one line of output from bbhostgrep | ||
+ | |||
+ | HOSTIP=" | ||
+ | MACHINEDOTS=" | ||
+ | MACHINE=`echo " | ||
+ | PORT=`echo $4 | $SED " | ||
+ | if [ -z " | ||
+ | PORT=": | ||
+ | fi | ||
+ | SUBST=" | ||
+ | # either " | ||
+ | URL=" | ||
+ | |||
+ | COLOR=green | ||
+ | KEY=0 | ||
+ | |||
+ | wget " | ||
+ | /g' | $SED ' | ||
+ | tag=`echo " | ||
+ | val=`echo " | ||
+ | case $tag in | ||
+ | ServerVersion) echo " | ||
+ | SerialNumber) | ||
+ | SERIALNUMBER=" | ||
+ | SERIALSHORT=" | ||
+ | HEXSERIAL=" | ||
+ | APPEND=$HEXSERIAL | ||
+ | NAME=" | ||
+ | #Check for substitution | ||
+ | #echo " | ||
+ | #echo " | ||
+ | #echo " | ||
+ | if [ `echo " | ||
+ | NAME=`echo $SUBST | $SED " | ||
+ | APPEND=$NAME | ||
+ | fi | ||
+ | #echo " | ||
+ | ;; | ||
+ | HardLimit) HARDLIMIT=" | ||
+ | LicenseInUse) INUSE=" | ||
+ | NumTimeOut) TIMEOUT=" | ||
+ | HighestUse) HIGHESTUSE=" | ||
+ | PartNumber) # | ||
+ | USEPERCENT=$((INUSE * 100 / $HARDLIMIT)) | ||
+ | echo "< | ||
+ | |||
+ | | ||
+ | UsePercent_$APPEND : $USEPERCENT --> | ||
+ | HighestUse_$APPEND : $HIGHESTUSE | ||
+ | | ||
+ | " >> $COLUMN.$$ | ||
+ | if [ " | ||
+ | KEY=$(($KEY+1)) | ||
+ | check_usage | ||
+ | fi | ||
+ | ;; | ||
+ | #*) ;; | ||
+ | esac | ||
+ | done | ||
+ | MSG=" | ||
+ | `cat $COLUMN.$$`" | ||
+ | $BB $BBDISP " | ||
+ | $RM $COLUMN.$$ | ||
+ | done | ||
+ | |||
+ | exit 0 | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== Known Bugs and Issues ===== | ||
+ | * As noted in the source code, this depends on timing between checking licenseinfo.html followed immediately by licenseinfo.xml. So try to avoid having two servers requesting these simultaneously. | ||
+ | * The licenseinfo.xml doesn' | ||
+ | * It has only been tested with SuperPro keys. | ||
+ | |||
+ | ===== To Do ===== | ||
+ | * Discover a method for querying other than checking XML over HTTP results. Yes, there is a usage log file, but parsing that seems likely to require storing state information. | ||
+ | |||
+ | ===== Credits ===== | ||
+ | I wish I could give credit to someone else for determining the licenseinfo details, but I had to discover it on my own. | ||
+ | |||
+ | ===== Changelog ===== | ||
+ | |||
+ | * **2010-02-25** | ||
+ | * Initial release | ||