🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.perl
Article #52569

Re: non-blocking snmp

#52569
From: Stachu 'Dozzie' K.
Date: Mon, 20 Jan 2014 20:05
33 lines
2288 bytes
On 2014-01-20, Paweł <jas@nie.doczekal> wrote:
> piszę skrypt odpytujący po SNMP kilka tysięcy hostów. używam biblioteki
> net-snmp-perl, sesje snmp puszczam w trybie non-blocking. wszystko
> działa pięknie ale chciałbym ograniczyć liczbę równolegle uruchomionych
> sesji snmp. osiągam limit na ilość otworzonych plików i 1019 sesja już
> się nie tworzy.

ulimit -n, /etc/security/limits.conf

> w tej chwili mam coś mniej więcej
[...]
> chciałbym raczej
>
> while (są jeszcze hosty do zbadania) {
>   jak jest już uruchomionych LIMIT sesji poczekaj
>   pobierz z bazy dane następnego hosta
>   stwórz dla niego obiekt SNMP::Session
>   odpal session->get
> }
>
> jakiś pomysł jak to osiągnąć?

Pula wątków?

Możesz obejrzeć jak ja to zrobiłem (na procesach) dla połączeń XML-RPC
w skrypcie xmlrpcaller: http://dozzie.jarowit.net/git?p=xmlrpcd.git
Chociaż ten kod generalnie jest brzydki.
Interesuje cię funkcja multicall() i pakiety Worker::Spool
i Worker::Spool::Child zdefiniowane pod koniec xmlrpcallera.

-- 
Secunia non olet.
Stanislaw Klekot
Technical Details
Message-ID: <slrnldr0d2.357.dozzie@jarowit.net>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!news.nask.pl!news.nask.org.pl!news.unit0.net!newsfeed.fsmpi.rwth-aachen.de!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
References: <lbjv1s$hl6$1@node2.news.atman.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!news.nask.pl!news.nask.org.pl!news.unit0.net!newsfeed.fsmpi.rwth-aachen.de!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: "Stachu 'Dozzie' K." <dozzie@go.eat.some.screws.spammer.invalid>
Newsgroups: pl.comp.lang.perl
Subject: Re: non-blocking snmp
Date: Mon, 20 Jan 2014 20:05:54 +0000 (UTC)
Organization: solani.org
Lines: 33
Message-ID: <slrnldr0d2.357.dozzie@jarowit.net>
References: <lbjv1s$hl6$1@node2.news.atman.pl>
Mime-Version: 1.0
X-Trace: solani.org 1390248354 7921 eJwFwQkRADAIAzBLQGk55OzDv4QlhFynUlRyONNs23Y2EPJ1rabCu98QijMhaN9nQC6i8gMQpRBu (20 Jan 2014 20:05:54 GMT)
X-Complaints-To: abuse@news.solani.org
NNTP-Posting-Date: Mon, 20 Jan 2014 20:05:54 +0000 (UTC)
User-Agent: slrn/pre1.0.0-18 (Linux)
X-User-ID: eJwFwQkBACAIBLBKvAfEQZT+EdxcwZgwOMzXV4pe1RWhfopjXbcPLqfW9hvylO3ZTAZbBH8fNhEH
Cancel-Lock: sha1:DnMBN0bhFcjxURtAjWUPZ+GzJMU=
X-NNTP-Posting-Host: eJwNwYEBwCAIA7CXQGhh50yQ/0/QBEZlhRN0zGtjlLO6vP1nT9au1fl0Q6HxHVkJgSaC+wIhMxCx
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit