Any C API or Perl Module to get the system info? - perl

I am looking for an API or perl module which collects the system architecute of different flavors of UNIX and Windows versons. Such as Unix Version, hardware, Number of CPU, Memory size etc. I am using SIGAR api to monitor the system resource, but it don't have any libraries that can collect system info. I am using perl bindings to call the SIGAR libraries.

The site you're looking for is http://search.cpan.org. There you can search for modules and browse their documentation to see which best suits your needs.

Related

How kernel provides services to other parts of operating system?

I went through the definitions of kernel on internet and i saw in many definitions that kernel provides services to other parts of OS.
What do they mean by kernel provides services to other parts of OS.
Can anyone explain with some valid example.
Thanks in advance.
kernel provides services to other parts of OS.
By "others" they mean parts of OS which works in user space (non-priveledged code). Among them are:
Libraries, provided by OS and used by 3d party applications (or 3d-party libraries).
Frameworks, e.g. one provided windows subsystem.
Applications (executables) provided by OS itself. E.g. cd command.
If any of those component needs a help from the kernel, it uses one of the kernel's service. Usually, kernel's service is provided via syscall mechanism.

What is the difference between standalone and desktop application?

I searched it a lot, I found everyone saying that standalone application does not require operating system services but how a software can function without using operating system services. Like if you take NetBeans , even the platform independent version of NetBeans ultimately takes the operating system services in backend.
Moreover if we talk about notepad, is it a standalone or desktop application.
Is eclipse(an IDE) a standalone or desktop application.
Please help I am really confused
From the wikipedia article
A stand-alone program is a computer program that does not load any
external module, library function or program and that is designed to
boot with the bootstrap procedure of the target processor
So to answer your question about netbeans or notepad both of them definitely requires some OS intervention to run. In order to write your standalone application you will need to rewire a bunch of low level stuff including the loader. The nuisances involved are usually not worth the benefit they achieve in era of modern programming frameworks and ever growing faster hardware. The same wiki article mentions that standalone applications are almost extinct now
but how a software can function without using operating system services
Well to function, the software will just need to mimic some of the operating system services it requires. some device drivers do exactly that. Though the definition of standalone programs is itself fuzzy, some embedded softwares tend to fall in the category of the definition from the wiki page.

cross platform perl interface to init/rc.d scripts?

I have a perl script to install a web-application which needs to turn on mysql and apache if they are not already on and have those services start at boot if they are not already configured to do so. Later on, I'd like to check that the service is running before attempting to interact with it.
Right now my script branches on the os: are you Fedora? are you a Red Hat relative which is not Fedora? Are you Debian?...etc. That's so I know whether to use systemctl, service, or chkconfig.
Is there a better way to handle this? I was hoping for a module on cpan similar in cross-platform drudgery handling spirit as the best of perl's standard modules, but I haven't come across one. So right now adding support for a new OS means tracking down how it handles such services and watching for changes in this as new versions of currently supported os's come out.
Any suggestions for better ways to handle this or recommended approaches?

How do I create a build for a legacy system?

We are currently maintaining a Perl web application and we are slowly trying to bring it into the modern age.
We want to be able to build our application so that when a new developer comes along we can just give them a copy of the build and they can have a local copy of the application with minimal fuss.
Does anyone have any experience of creating a build for a legacy web application that could offer some pro tips?
Start by authoring an ordinary CPAN distribution, Perl modules go into lib etc. This is described in perlnewmod and the documents referenced in its section titled See also.
Use Module::Build as the build system. You extend it for the extra stuff you want to install, for example template files, this is described in the cookbook.

How can I track down CPU intensive requests in mod_perl?

Using Apache 2.2 and mod_perl on Ubuntu 8.04 I have several applications on a server. Using Apache in pre-forking mode. Usually things are working well but once in a while I see one of Apache processes using 100% of the CPU.
There are several web sites on the server with their own VirtualHosts and there are
is and SVN server running via Apache.
How could I track down which application and which calls in that application generate the high load?
Devel::NYTProf is pretty much the premier profiler for Perl right now, with Devel::NYTProf::Apache for easily profiling mod_perl applications.
See Tim Bunce: NYTProf v2 – A major advance in perl profilers for a pretty overview with pictures.
Unfortunately, Devel::NYTProf isn't pre-packaged in Ubuntu Hardy. (It is pre-packaged in Jaunty, Karmic, Lucid, and later.) You can either use some apt trickery to install packages from those distributions, install from CPAN, or just upgrade ;-)
If you have a large subversion repository and path-based authorization enabled in your apache configuration you're going to see some long-running, high CPU apache tasks. You'll probably also have complaints from subversion users about slow commits and updates, along with 503 errors and subversion complaining about truncated SSL responses. If this is the case, I'd make subversion my prime suspect.
Use a custom log format or a write a PerlLogHandler that records the request information along with the PID and resource use information. See, for instance, Randal's Web Techniques Column 48.