SUSE Conversations


Show All SLP Services in Linux



By: vindiola

December 11, 2009 2:16 pm

Reads:379

Comments:4

Rating:0

License:
Free

Download slpshowall

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

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

Tags: ,
Categories: Free Tools, SUSE Linux Enterprise Server, Technical Solutions

4 Comments

  1. By:MHGlenn

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

    Thanks!

  2. By:thorsten_kampe

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

  3. By:thorsten_kampe

    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-snoop-linux-and-windows . Included is a script called “slpsnoop.sh” which runs on Linux and Windows.

  4. By:Lsteingr

    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
    

Comment

RSS