I have to create a script which will detect how many db2 process is idle.
But I am not able to define its threshold.
Means when script need to throw alert that IDLE connection is very much high. Its need to be a percentage of application connected to the system ? or anything else.
( let me clear I want to have alert only I dont want to kill it through script )
I want to add few more thing.
I want the number of connection which came from application side and it is still in the system as idle connection as it is not disconnected. I am not interested to disturb NUM_INITAGENTS which use to display as idle.
db2 get snapshot for applications on <dbname> | grep -i idle .. I dont think NUM_INITAGENTS use to come under this ?? Am i right ?
What specifically are you after? You asked a question about NUM_INITAGENTS then dismiss the answer. You are mentioning "idle" processes but do not give a definition as to what you define as idle. Any agent not currently performing work in the database is idle. To count those is meaningless because you are getting a snapshot and the number at that time does not take into account how long they have been doing nothing. You need to define what "idle" means, then simply count those over the threshold.