Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


[INFO] No more hanging Perl scripts

 
Post new topic   Reply to topic    Cacti Forum Index -> Informational/HOWTO's
Author Message
maenu
Cacti User


Joined: 17 Jul 2003
Posts: 57
Location: Switzerland

PostPosted: Thu Nov 30, 2006 6:22 am    Post subject: [INFO] No more hanging Perl scripts Reply with quote

The poller uses perlscripts to process inputdata.

I had the problem that some of these perscripts hung for no reason.
(ok, there must be a reason, but it works by 99,99% of all polling-intervals and then just fails.. real Vodoo!! )

I decided to implement a "maximum runtime" to this scripts, witch solved the problem.

Just add the alarm()-statement so the very beginning of these scripts.
Code:
 
#!/usr/bin/perl

# kills the script without warning after 60 seconds
alarm(60);


keep in mind that the scripts get killed even if the proper action of the script takes longer than 60s.. (change this interval that it fits to the scripts operations)

Enjoy your Vodoo-less time..

Manuel
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Informational/HOWTO's All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group