Page 1 of 1
commands (../nagios/libexec) in perl/PHP v/s C
Posted: Sat Mar 05, 2016 9:45 am
by zaji_nms
Dear Expert
Yes, Perl & PHP are easy to write small script for specific output via Config , Command.....however if we manage to write in C, will it perform very fast compare to perl/PHP and if your answer is Yes, then how much % will be faster (approximate).
Will you advice/prefer to write in C over Perl/PHP ?
Regards
Re: commands (../nagios/libexec) in perl/PHP v/s C
Posted: Mon Mar 07, 2016 1:23 pm
by tmcdonald
It is nearly impossible to tell you how fast a plugin will run when written in C compared to perl/PHP, but it will almost certainly be faster. My advice is to write whatever you are comfortable with, using whichever language is the right tool for the job. Generally speaking I prefer to write in higher languages when possible, since my time as a human is more valuable than the time a computer spends running it. Only when I need to write in C will I do so.
Re: commands (../nagios/libexec) in perl/PHP v/s C
Posted: Mon Mar 07, 2016 1:27 pm
by bwallace
Avoid using interpreted plugins. One thing that will significantly reduce the load on your monitoring host is the use of compiled (C/C++, etc.) plugins rather than interpreted script (Perl, etc) plugins. While Perl scripts and such are easy to write and work well, the fact that they are compiled/interpreted at every execution instance can significantly increase the load on your monitoring host if you have a lot of service checks. If you want to use Perl plugins, consider compiling them into true executables using perlcc(1) (a utility which is part of the standard Perl distribution) or compiling Nagios with an embedded Perl interpreter (see below).
... the above quote is from
https://assets.nagios.com/downloads/nag ... uning.html
Although that doc is for Nagios Core, it applies to XI as well.