A common question seen in Support is some variation of "How can I tell how many agents are defined in Autosys?"
There is no Autosys command to count the number of agents but there is a way to find out this number using a combination of methods (depending on your platform). Below are a few ways to determine the number of agents defined in the AEDB for a particular CA Workload Automation AE Environment:
1. To get a listing of all your agents, run this command from your Autosys server and pipe the results to a file: autorep -M ALL > /tmp/machine_count
The file would look something like this:
Machine Name Max Load Current Load Factor O/S Status
________________________________________________________________________________ __________ ____________ _______ ___________ ______
localhost --- --- 1.00 Sys Agent Online
localhost2 --- --- 1.00 Sys Agent Online
localhost3 --- --- 1.00 Sys Agent Online
2. Use the “nl” command to count the number of lines in the file:
[root@localhost tmp]# nl machine_count
1 Machine Name Max Load Current Load Factor O/S Status
2 ___________________________ ____________ _______ ___________ ______
3 localhost --- --- 1.00 Sys Agent Online
4 localhost2 --- --- 1.00 Sys Agent Online
5 localhost3 --- --- 1.00 Sys Agent Online
NOTE: Be sure you subtract 2 from the line count – the first 2 lines are not part of the agent count.
1. To get a listing of all your agents, run this command (from your Autosys command prompt) and pipe the results to a file: autorep -M ALL > C:\Temp\machine_count.txt
2. Use the “find” command to count the number of lines in the file:
C:\Temp>find /C "Agent" C:\Users\Administrator\Documents\machine_count.txt
---------- C:\USERS\ADMINISTRATOR\DOCUMENTS\MACHINE_COUNT.TXT: 3
1. Run the following query against the Autosys Database (AEDB)
Oracle: select count(distinct mach_name) "Number of Machines" from aedbadmin.ujo_machine;
Number of Machines
SQL: select count(distinct mach_name) "Number of Machines" from dbo.ujo_machine;
Caveat Usor ..
In my honest opinion: this is very clumsy and rife with duplicates. autorep -M ALL
remember in R11.3X the machine definition DOES NOT have to match node.
you would need to do detail and then extract the node_name
autorep -M A:: -d | grep node_name | sort | uniq
and a variation of that would get what you needed. Or perhaps an SQL query.
Tech Tips should undergo release control. Before publishing make sure .. black magic or behind the curtain information are not being given out to the users en toto
and make sure that the tip itself is vetted to be accurate and complete.
Just my 3 cents..
Thank you for hearing me out
Thanks for your feedback.
Node names are not unique but machine names are. You can define multiple machines with the same node name so I wouldn't base my count on that parameter.
The purpose of this tip is to allow a customer to get an estimate on how many agents they have defined in their environment. There are many instances where the person who is administrating/upgrading the environment is not the same person who completed the installation but this information is still needed.
I have stumbled upon a way to do a line count in Windows via the Command Prompt rather than using Word or Notepad. I'll update my tip with this information.
+1 to the idea of doing an SQL query.
My point is that the node_name is the actual machine name and is what fneeded for a client count for licensing purposes. You want the node_name which is the actual machine name and then do a uniq or removal of duplicate.
machine name is arbitrary. i can say abc and the real name is def.machine.com
I have done numerous audits and typically the request is what machines are being used. and by whom.
Thus using a prefix for the machine you can say by whom and by grabbing the node_name youy can say which machine.
For licensing, the number of agents (if more than one on a host) is a big factor…
In cases where applications share hardware, but don’t want to be constrained by the usage of the agent, a second agent is being installed.
The other cases where the second agent is being installed is to utilize one agent to patch the other, update the agentparm.txt files etc. there are multiple uses and multiple large shops utilizing more than one agent on the same machine.
Starting WAAE 11.3.5, the compliance application ($AUTOSYS/bin/cmplapp.sh) that runs as part of the DBMaint does the machine and jobs count for us, saves efforts, even if only a little.
$ cd $AUTOUSER/out
$ ls -l *.csv
-rw-r--r-- 1 wcc wcc 9079 Nov 10 03:30 NumJobsDefined.csv
-rw-r--r-- 1 wcc wcc 8813 Nov 10 03:30 NumJobsRun.csv
-rw-r--r-- 1 wcc wcc 8809 Nov 10 03:30 NumMachsDefined.csv
-rw-r--r-- 1 wcc wcc 8807 Nov 10 03:30 NumMachsUsed.csv
$ head -1 NumMachsDefined.csv;tail -1 NumMachsDefined.csv
Report Run Date,MACHINE_COUNT,Period Of TimeStart,Period Of TimeEnd,
2015/11/09 10:38:57:970 PM EST,6,2015/11/08 12:00:00:000 AM EST,2015/11/09 12:00:00:000 AM EST
That count matches with the total machines defined (excluding the virtual)
$ autorep -M ALL | awk 'NR>=4' | wc -l
The NumJobsDefined.csv file shows job count by type
$ head -1 NumJobsDefined.csv
Report Run Date,NAME,JOB_COUNT,Period Of TimeStart,Period Of TimeEnd,
$ grep ^"$(date '+%Y/%m/%d')" NumJobsDefined.csv | cut -d"," -f2,3
$ autorep -J ALL -q | grep -w "job_type: CMD" | wc -l
$ autorep -J ALL -q | grep -w "job_type: FW" | wc -l
$ autorep -J ALL -q | grep -w "job_type: OMTF" | wc -l
$ autorep -J ALL -q | grep -w "job_type: FTP" | wc -l
$ autorep -J ALL -q | grep -w "job_type: OMCPU" | wc -l
Thanks for the feedback, Chandru.
I'll pass this along to customers when the question arises again (which it will).
Another approach used is to query the database and compare the results with your autorep results.
The queries below will vary slightly depending on your version and OS. Nix/Oracle is below.
select mach_name, count(*) from ujo_job group by mach_name; (machines that have jobs defined to run on them and the number of jobs defined)
select distinct run_machine from ujo_job_status; (machines that have recently run jobs)
I have included an SQL Query option in the Tech Tip. It is important to include the DISTINCT keyword to get rid of the duplicates.
If you run an SQL query on the ujo_machine table, it will tell you how many machines are defined overall in the AEDB.
Thanks for your input!