Professional Web Applications Themes

how to tell if there is VNC server run on remote Unix machine? - Linux / Unix Administration

thanks alot, walala continued...

  1. #1

    Default how to tell if there is VNC server run on remote Unix machine?

    thanks alot,

    walala


    walala Guest

  2. #2

    Default Re: how to tell if there is VNC server run on remote Unix machine?

    walala <mizhael@yahoo.com> wrote:
    > thanks alot,
    The easy way is try to connect, the not-so-easy way is to use this script:

    #!/bin/bash
    MIB="1.3.6.1.2.1"
    PROCS=".25.4.2.1.2.1"
    DISKS=".25.2.3.1.3.1"
    INST=".25.6.3.1.2.1"

    if [ -z $1 ] ; then
    echo "Usage: $0 ipaddress [procs|disks|inst]"
    exit 0
    fi

    if [ $2 == "inst" ] ; then
    NEXT=$INST
    END=".25.6.3.1.3.1"
    fi

    if [ $2 == "procs" ] ; then
    NEXT=$PROCS
    END=".25.4.2.1.3.1"
    fi

    if [ $2 == "disks" ] ; then
    DESC=".25.2.3.1.3."
    BLOCK=".25.2.3.1.4."
    TOTAL=".25.2.3.1.5."
    USED=".25.2.3.1.6."
    NEXT="1"
    END="25.2.3.1.4.1"
    while [ 1 ] ; do

    DSC=`snmpget $1 -v 1 -c public $MIB$DESC$NEXT | sed 's/.*STRING: \(.*\)$/\1/'`
    if [ -z $DSC ] ; then
    echo "Error retriving data"
    exit 1
    fi
    cat "$DSC" > /tmp/DSC.tmp
    OK=`grep -c 'Failed' /tmp/DSC.tmp`
    if [ $OK -gt 0 ] ; then
    echo "Error retriving data"
    exit 1
    fi
    OK=`grep -c 'Timeout' /tmp/DSC.tmp`
    if [ $OK -gt 0 ] ; then
    echo "Error retriving data"
    exit 1
    fi
    OK=`grep -c 'Error' /tmp/DSC.tmp`
    if [ $OK -gt 0 ] ; then
    echo "Error retriving data"
    exit 1
    fi

    BLCK=`snmpget $1 -v 1 -c public $MIB$BLOCK$NEXT | sed 's/.*INTEGER: \(.*\)$/\1/'`
    TOT=`snmpget $1 -v 1 -c public $MIB$TOTAL$NEXT | sed 's/.*INTEGER: \(.*\)$/\1/'`
    USD=`snmpget $1 -v 1 -c public $MIB$USED$NEXT | sed 's/.*INTEGER: \(.*\)$/\1/'`
    COM=`snmpgetnext $1 -v 1 -c public $MIB$DESC$NEXT | sed "s/.*::mib-2.\([^ ]*\) =.*$/\1/"`

    BLCK=$((BLCK / 1024))
    TOT=$((TOT * BLCK))
    USD=$((USD * BLCK))
    FREE=$((TOT - USD))
    echo $DSC $TOT $USD $FREE
    if [ $COM == $END ] ; then
    exit 0
    fi
    NEXT=$((NEXT+1))
    done
    else
    while [ 1 ] ; do
    MB="$MIB$NEXT"
    RES=`snmpget $1 -v 1 -c public $MB | sed 's/.*STRING: "\(.*\)"$/\1/'`
    if [ -z "$RES" ] ; then
    echo "Error retriving data"
    exit 1
    fi
    echo $RES
    NEXT=`snmpgetnext $1 -v 1 -c public $MB | sed "s/.*::mib-2\([^ ]*\) =.*$/\1/"`
    if [ -z "$NEXT" ] ; then
    echo "Error retriving data"
    exit 1
    fi
    if [ "$NEXT" = "$END" ] ; then
    exit
    fi
    done
    fi

    with the "procs" switch will tell you what's running on a remote
    Windows machine (if SNMP is enabled on the machine), you'll need
    snmpget on the machine.

    Davide
    Davide Bianchi Guest

  3. #3

    Default Re: how to tell if there is VNC server run on remote Unix machine?


    "Davide Bianchi" <davideyeahsure@onlyforfun.net> wrote in message
    news:bn063k$rjgh5$4@ID-18487.news.uni-berlin.de...
    > walala <mizhael@yahoo.com> wrote:
    > > thanks alot,
    >
    > The easy way is try to connect, the not-so-easy way is to use this script:
    >
    > #!/bin/bash
    > MIB="1.3.6.1.2.1"
    > PROCS=".25.4.2.1.2.1"
    > DISKS=".25.2.3.1.3.1"
    > INST=".25.6.3.1.2.1"
    >
    > if [ -z $1 ] ; then
    > echo "Usage: $0 ipaddress [procs|disks|inst]"
    > exit 0
    > fi
    >
    > if [ $2 == "inst" ] ; then
    > NEXT=$INST
    > END=".25.6.3.1.3.1"
    > fi
    >
    > if [ $2 == "procs" ] ; then
    > NEXT=$PROCS
    > END=".25.4.2.1.3.1"
    > fi
    >
    > if [ $2 == "disks" ] ; then
    > DESC=".25.2.3.1.3."
    > BLOCK=".25.2.3.1.4."
    > TOTAL=".25.2.3.1.5."
    > USED=".25.2.3.1.6."
    > NEXT="1"
    > END="25.2.3.1.4.1"
    > while [ 1 ] ; do
    >
    > DSC=`snmpget $1 -v 1 -c public $MIB$DESC$NEXT | sed 's/.*STRING:
    \(.*\)$/\1/'`
    > if [ -z $DSC ] ; then
    > echo "Error retriving data"
    > exit 1
    > fi
    > cat "$DSC" > /tmp/DSC.tmp
    > OK=`grep -c 'Failed' /tmp/DSC.tmp`
    > if [ $OK -gt 0 ] ; then
    > echo "Error retriving data"
    > exit 1
    > fi
    > OK=`grep -c 'Timeout' /tmp/DSC.tmp`
    > if [ $OK -gt 0 ] ; then
    > echo "Error retriving data"
    > exit 1
    > fi
    > OK=`grep -c 'Error' /tmp/DSC.tmp`
    > if [ $OK -gt 0 ] ; then
    > echo "Error retriving data"
    > exit 1
    > fi
    >
    > BLCK=`snmpget $1 -v 1 -c public $MIB$BLOCK$NEXT | sed 's/.*INTEGER:
    \(.*\)$/\1/'`
    > TOT=`snmpget $1 -v 1 -c public $MIB$TOTAL$NEXT | sed 's/.*INTEGER:
    \(.*\)$/\1/'`
    > USD=`snmpget $1 -v 1 -c public $MIB$USED$NEXT | sed 's/.*INTEGER:
    \(.*\)$/\1/'`
    > COM=`snmpgetnext $1 -v 1 -c public $MIB$DESC$NEXT | sed
    "s/.*::mib-2.\([^ ]*\) =.*$/\1/"`
    >
    > BLCK=$((BLCK / 1024))
    > TOT=$((TOT * BLCK))
    > USD=$((USD * BLCK))
    > FREE=$((TOT - USD))
    > echo $DSC $TOT $USD $FREE
    > if [ $COM == $END ] ; then
    > exit 0
    > fi
    > NEXT=$((NEXT+1))
    > done
    > else
    > while [ 1 ] ; do
    > MB="$MIB$NEXT"
    > RES=`snmpget $1 -v 1 -c public $MB | sed 's/.*STRING: "\(.*\)"$/\1/'`
    > if [ -z "$RES" ] ; then
    > echo "Error retriving data"
    > exit 1
    > fi
    > echo $RES
    > NEXT=`snmpgetnext $1 -v 1 -c public $MB | sed "s/.*::mib-2\([^ ]*\)
    =.*$/\1/"`
    > if [ -z "$NEXT" ] ; then
    > echo "Error retriving data"
    > exit 1
    > fi
    > if [ "$NEXT" = "$END" ] ; then
    > exit
    > fi
    > done
    > fi
    >
    > with the "procs" switch will tell you what's running on a remote
    > Windows machine (if SNMP is enabled on the machine), you'll need
    > snmpget on the machine.
    >
    > Davide

    Thanks a lot man!

    You are so great how did you make this script out? :=)

    -Walala



    walala Guest

  4. #4

    Default Re: how to tell if there is VNC server run on remote Unix machine?

    walala <mizhael@yahoo.com> wrote:
    > Thanks a lot man!
    > You are so great how did you make this script out? :=)
    Used getif on Windows to have the correct "class" numbers and then
    played along. You can also ask for everything, but it will take
    longer.

    Davide
    Davide Bianchi Guest

Similar Threads

  1. filecopy from remote machine to local machine
    By anu in forum PERL Modules
    Replies: 5
    Last Post: February 8th, 03:49 PM
  2. Sql server update via asp with access db on remote machine
    By Eddy Princen in forum ASP Database
    Replies: 2
    Last Post: November 25th, 07:34 PM
  3. Setting folder permissions on remote machine / remote domain
    By Tim Chandler in forum ASP.NET Security
    Replies: 0
    Last Post: October 7th, 04:17 PM
  4. executing .exe on NT from remote Unix server
    By Matt Garrish in forum PERL Miscellaneous
    Replies: 1
    Last Post: August 19th, 08:58 PM
  5. connecting to a remote unix machine
    By umit in forum UNIX Programming
    Replies: 2
    Last Post: July 29th, 08:36 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139