[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: looking for packages versions of running daemons



On 9/9/09, Ron Johnson <ron.l.johnson@cox.net> wrote:
> On 2009-09-09 23:30, Israel Garcia wrote:
>> On 9/9/09, Cameron Hutchison <lists@xdna.net> wrote:
>>> Israel Garcia <igalvarez@gmail.com> writes:
>>>
>>>> I have more than 10 debian (etch and lenny) servers and I want to find
>>>> a way to know remotely on every server:
>>>> 1. Name of running daemons and ports (tcp/udp) they're using.
>>>> 2. Version of the package (installed by APT) used by these daemons.
>>>> 3. Version of the latest package (from deb mirros) used by these
>>>> daemons.
>>>> I tried to make a script but didn't resolve my problem.
>> Hi Camaron
>>
>> That's really nice. It gives what I'm looking for..BUT, I have other
>> daemons installed from source, so dpkg -S returns an error.  In my
>> case ruby. See below:
>
>
> Right after the "bin=$(readlink /proc/$pid/exe)", I'd add a check
> which checks for the string "/usr/local" inside ${bin}, then skips
> down to the end of the while loop if the string actually is in ${bin}.
Hi Ron,

Could you please add this check you're talking about  to Cameron's script :-)

Thanks
regards,
Israel.

>
>> server:~# /usr/local/bin/check.sh
>> /opt/splunk/bin/python2.6 on port 8000/tcp from package splunk
>> (version 4.0.3-65638)
>> /usr/sbin/mysqld on port 3306/tcp from package mysql-server-5.0
>> (version 5.0.51a-24+lenny2)
>> /usr/sbin/monit on port 80/tcp from package monit (version 1:5.0.3-3)
>> /usr/local/bin/ruby on port 10000/tcp from package  (version
>> 3.1102.2.9-10+lenny42.2.9-10+lenny42.2.9-10+lenny42.2.9-10+lenny42.2.9-10+lenny42.2.9-10+lenny40.7.20.2+lenny10.7.20.2+lenny10.4.11.11-1~lenny10.60.6-16.0-0-5.12.61-81:1.10.1-31:1.4-p6-131.9.6+nogfdl-320080123.16.7.dfsg-5.15lenny43.5.203.2-42.18.1~cvs20080103-71:2.3.dfsg-58.1.2-0.20071201cvs-36.1.101:2.13.1.1-111.420070509-1.11.0.5-1200808090.4.520.48-84.7.2-12.1-1.41.3-16.10-62.9-134:4.3.2-24.3.2-1.13.0pl1-1054.6.21-111.2.1-5+lenny11.2.1-5+lenny11.5.241.5.247.0.152009.01.312.300.11.10-0.23.1.1-6+lenny33.1.1-6+lenny30.98.122.8.1-121.45-23.5.20-8+lenny12.9-12:1.02.27-42.0.301.14.251.14.251.14.251.41.3-11.41.3-10.7-30.11.4-30.11.4-31.112.7.59-94.26-14.4.0-22.5.35-62.6.0-32.6.0-34:4.3.2-24.3.2-1.11:3.1.5.dfsg-4.14:4.3.2-24.2.4-64.3.2-1.14.3.2-1.12.22.0-12.22.0-10.17-40.17-48.62.dfsg.1-3.2lenny11.4.9-3+lenny11.4.9-3+lenny12.5.3~dfsg-61.18.1.1-218.62.dfsg.1-3.2lenny11:8.11+u.........cutted
>> here
>> /usr/sbin/sshd on port 22/tcp from package openssh-server (version
>> 1:5.1p1-5)
>> /usr/lib/postfix/master on port 25/tcp from package postfix (version
>> 2.5.5-1.1)
>> /opt/splunk/bin/splunkd on port 8089/tcp from package splunk (version
>> 4.0.3-65638)
>> /usr/sbin/sshd on port 22/tcp6 from package openssh-server (version
>> 1:5.1p1-5)
>> /usr/sbin/collectd on port 32918/udp from package collectd (version
>> 4.7.2-1)
>>
>> Ruby was compile from source, How can I modify this script to remove
>> this error or better run -v option on daemons not installed by APT.
>>
>> thanks again.
>> regards,
>> Israel.
>>
>>> Here's a script I just wrote to do what you want (it was an interesting
>>> diversion).
>>>
>>> For requirement #3, I'm not sure exactly what you wanted, so I took the
>>> easy way out. I assumed you wanted the latest version for the
>>> distribution you have in your /etc/apt/sources.list. To make the script
>>> work, run apt-get update first so that your apt-cache has the latest
>>> versions from your mirror.
>>>
>>> netstat -lntup \
>>>         | awk '/^tcp/ { print $4"/"$1, $7 } /^udp/ { print $4"/"$1, $6 }'
>>> \
>>>         | sed -n 's|^[^ ]*:\([^ ]*\) \([0-9]*\)/.*|\1 \2|p' \
>>>         | while read port pid ; do
>>>                 bin=$(readlink /proc/$pid/exe)
>>>                 pkg=$(dpkg -S $bin | cut -d: -f1)
>>>                 version=$(dpkg-query -W --showformat='${Version}' $pkg)
>>>                 latest=$version
>>>                 latest=$(apt-cache show -a $pkg | grep "^Version:" | {
>>> while
>>> read x ver ; do
>>>                         if dpkg --compare-versions $latest lt $ver ; then
>>>                                 latest=$ver
>>>                         fi
>>>                 done ; echo $latest; } )
>>>
>>>                 echo -n "$bin on port $port from package $pkg (version
>>> $version"
>>>                 if [ $latest != $version ] ; then
>>>                         echo -n ", $latest available"
>>>                 fi
>>>                 echo ")"
>>>         done
>>>
>>>
>>> --
>>> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
>>> with a subject of "unsubscribe". Trouble? Contact
>>> listmaster@lists.debian.org
>>>
>>>
>>
>>
>
>
> --
> Brawndo's got what plants crave.  It's got electrolytes!
>
>
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact
> listmaster@lists.debian.org
>
>


-- 
Regards;
Israel Garcia


Reply to: