Script counting instances of software running on a machine

Hello to all @here,

as I�m new to this forum, I will try to start in a easy way for my first post. I�m not beginner in scripting, but also not a proffessional. So please keep easy, if I don�t understand your explanation at once :wink: I don�t mean it in a bad way!

Here is the Problem:
There were about 470 Servers running in my company. The most of them were hardware, on which are running mostly virtual machines. On this virtual machines are running Application Servers like WebLogic (Oracle), WebSphere (IBM), JBoss, Apache, TomCat and some other applications that don�t matter to me. My job is now, to check all servers and to analyze how many of this applications were actually running at the same time.
Some of the applications is maintained by the customer, some by our company. But all machines were from our company. So the point is, to create a script, which will count the applications running on a system.
My first intention was, to go over to the machine, and put a script on it, that will count the applications. But I don�t have thought on one important point. Some of the machines could be maintained by the owner or a colleague, so that there is no process running at this time, when my script starts. Maybe somebody over here, have a better solution for me, how to handle this problem.
***
Actually I�m standing at this point, that I have created a script, that takes a ps -ef and greps out the processes that were important to me over ssh to a special server. But if the machine is not running the application, I will get back no result. So I tried now in another step, to take the find command, to find the path of an apache, WAS, WLS, ...and so on. My next problem that occured was, that some customers have saved their installations of WAS, WLS, JBoss, Apache ... under different directories with different names. Some call it WebLogic, others WLS1, other OracleWebLogic and some in companynames or crypted names. The main thing is, that all of this applications use apache or tomcat as a communication plattform for extern connections.
Now there were 2 different ways to go on. I can create a script, that can be stored local on the virtual machine, or I can store it on a central place and work with a list, of all available servers, to solve my problem. What is the best way, what do you thing and what would you prefer in this way? Do you have an other solution for me? Maybe I need some other impulses?!!?!? :wink:
What I forgot to say, some customers were running more than one instance of the application server. For example, there were some customers, that have running 6-8 WLS on a cluster of 3 machines. And additional they have installed also some other applications for testing purposes. I have to count all instances, that were running. So I need to know, if WLS for example is running at this machine, and if so, how many instances were installed/running actually.
If somebody is interested in my script, let me know, maybe I can post it here or somewhere else, so that you can take a look at. But I would like to know, if I�m on the right way with my thoughts or if I should go another way that is more comfortable.
If you have questions, let me know!
Systems running : UNIX

:eek::wall:

By "running" I think you mean the machine is licensed for something and could run it. But you get false negatives.

If your company installed everything then you have a very high probability that there is commonality in naming conventions. The default WebLogic owner uid is wls, so if there is a WLS user, apache has to be there as well. Directory names will be there, like for oracle certain lower level names like libclntsh will only exist on a box that can run oracle as either a client or a server, or, /var/opt/oracle/oratab will have entries that end in :Y os :S for boxes that actively run an orcacle database or a standby and so are oracle servers.

Therefore - you need to logically create a set of queries a means of determining, yes this has jboss or not. And the method does not always depend on what users are running but usually depends on what exists in /etc/passwd, /etc/group, /var/opt/... etc.

This is like one of those puzzles where you work out what has to exist by a small numbers of observations. The most dependable are: names of certain files, usernames, some group names, if you are lucky sometimes a daemon with a fixed name will be running full time.

1 Like

Thx for the fast reply. I just worked out my script, and now seems to work good. Need to make some optimizing in the next future, but for now, I�m happy that it works.
Thank you jim mcnamara for your thoughts and explanations! That have been really usefull!