Tool

vindiola's picture
tool
Reads:

9304

Score:
3.333335
3.3
3
 
Comments:

4

Show All SLP Services in Linux

(View Disclaimer)

license: 
free
home page url: 
www.identitymgmt.net

The Problem

Back in the good old days of NetWare, if you wanted to see all registered services in SLP, you'd simply type: display slp services and the full list would appear on your screen.

Fast forward to Linux and OpenSLP and you can't do that very easily. Using a combination of slptool switches, you can eventually get all the same information, but it is cumbersome and time consuming.

The Fix

The following script was written to make that job simple and quick. It will write all the services to your screen and allow you to scroll up and down the list at will. It will also write the results to a file in the /tmp directory so you can look at it again without having to run the script. This also allows you to quickly grab the results from multiple computers for comparison.

Just copy your script to each server you'd like to run it on. I recommend putting it somewhere in the path, such as /usr/local/bin. Then, you make the script executable (chmod +x ./slpshowall.sh) and you are ready to run it.

slpshowall.sh
AttachmentSize
slpshowall.tgz561 bytes

Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).

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, test, test before you do anything drastic with it.




User Comments

MHGlenn's picture

Spiffy!

Submitted by MHGlenn on 15 December 2009 - 12:20pm.

Handy tool, and just what I was looking for right now.

Thanks!

thorsten_kampe's picture

Overly complicated

Submitted by thorsten_kampe on 30 March 2010 - 5:33am.

for srvtype in $(slptool findsrvtypes); do
slptool findsrvs $srvtype; done

Lsteingr's picture

twice entries for "bindery.novell" with findsrvs -novell bug?

Submitted by Lsteingr on 21 September 2010 - 3:43am.

Hi, vindiola
I found, that on OES2SP2 with all Patches (2010-08-12) sometime the command "slptool findsrvtypes"
show the "bindery.novell" twice, so the total count is not valid, see the listing below
I recreate the script to fix this,create a achive of slp listings amd also use the hits of thorsten kampe, please test this script
Regards Lutz
This is a listing with wrong service list "service:" (novell bug?)
service:smb
service:remotedesktop.kde:vnc
service:remotedesktop.java:http
service:ssh
service:fish
service:ntp
service:smdr.novell
service:domain
service:ldap
service:bindery.novell
service:ndap.novell
nwserver.novell
portal.novell
securerconsole.novell
rconsole.novell
bindery.novell
smdr.novell
nlsmeter.novell
srs.novell
service:wbem:https

This is the script

#!/bin/bash
# 2010-08-13, Lst
# by John Vindiola - Identity Automation 
# and Novell Communities #9395, Submitted by thorsten_kampe on 30 March 2010
# Version 1.2
echo ""
echo "####################################################################################"
echo `date +%Y-%m-%d\ %R` | tee -a /var/log/messages
echo "Start List all SLP Services" | tee -a /var/log/messages
LOG1=/tmp/slptool-all-tmp.txt
LOG2=/tmp/slptool-service-tmp.txt

rm $LOG1 &> /dev/null
rm $LOG2 &> /dev/null

SLPALL1=""
SLPBINDERY1=""
SLPSMDR1=""

SLPALL2=""
SLPBINDERY2=""
SLPSMDR2=""

# All SLP Services
for srvtype in $(slptool findsrvtypes); do
slptool findsrvs $srvtype |grep -n service >> $LOG1; done

# ONLY Services what have "service:" entries
for srvtype in $(slptool findsrvtypes | grep -i service); do
slptool findsrvs $srvtype |grep -n service >> $LOG2; done

# Check for Files
echo ""
if [ -f "$LOG1" ]; then
   echo "$LOG1 created"
else
   echo "$LOG1 not created"
fi

if [ -f "$LOG2" ]; then
   echo "SLP-Service-List have \"service:\" entries!"
else
   echo "SLP-Service-List have no \"service:\" entries"
fi

SLPALL1="$(cat "$LOG1" 2> /dev/null |grep service -c)"  &> /dev/null
SLPBINDERY1="$(cat "$LOG1" 2> /dev/null |grep service.bindery.novell -c)"  &> /dev/null
SLPSMDR1="$(cat "$LOG1" 2> /dev/null |grep service.smdr.novell -c)"  &> /dev/null

SLPALL2="$(cat "$LOG2" 2> /dev/null |grep service -c)"  1>&2
SLPBINDERY2="$(cat "$LOG2" 2> /dev/null |grep service.bindery.novell -c)"  &> /dev/null
SLPSMDR2="$(cat "$LOG2" 2> /dev/null |grep service.smdr.novell -c)"  &> /dev/null
echo "" |tee -a $LOG1
echo "List all Services" |tee -a $LOG1
echo "************************************************" |tee -a $LOG1
slptool findsrvtypes |tee -a $LOG1
echo "" |tee -a $LOG1
echo "ALL SLP Services Statistics" |tee -a $LOG1
echo "************************************************" |tee -a $LOG1
echo "All SLP Services Total  :$SLPALL1" |tee -a $LOG1
echo "All SLP Services bindery:$SLPBINDERY1"|tee -a $LOG1
echo "All SLP Services smdr   :$SLPSMDR1"|tee -a $LOG1

echo "" |tee -a $LOG1
echo "SLP with \"service:\" entries !!!" |tee -a $LOG1
echo "************************************************" |tee -a $LOG1
echo "SLP Services Total  :$SLPALL2" |tee -a $LOG1
echo "SLP Services bindery:$SLPBINDERY2"|tee -a $LOG1
echo "SLP Services smdr   :$SLPSMDR2"|tee -a $LOG1

echo "" |tee -a $LOG1
echo "SLP DA are :"|tee -a $LOG1
slptool findsrvs service: |tee -a $LOG1
cp $LOG1 /tmp/slptool-all-`date +%Y%m%d-%H%M%S`.txt  &> /dev/null
cp $LOG2 /tmp/slptool-service-`date +%Y%m%d-%H%M%S`.txt  &> /dev/null

echo `date +%Y-%m-%d\ %R` | tee -a /var/log/messages
echo "End List all SLP Servicess" | tee -a /var/log/messages
echo "####################################################################################"
echo ""
#output the results to the screen using less
less $LOG1
thorsten_kampe's picture

John, this is not really a

Submitted by thorsten_kampe on 14 August 2010 - 9:41am.

John, this is not really a bug in the slptool but more an inconsistency in how NetWare and OES Linux announce their services. The "service:" services come from a Linux box and the ones without should come from a NetWare box. So you can't just eliminate the ones you don't like.

For a more sophisticated version of the script go here: http://www.novell.com/communities/node/11292/slp-s... . Included is a script called "slpsnoop.sh" which runs on Linux and Windows.

© 2013 Novell