Glance Adviser Script - Detailed Process Gathering

sábado, 21 de julho de 2012

You must be carefull with this example as it will generate a lot of data very quickly, depending on the interval.  I.e. listing all processes every second is a lot of lines in a short period of time.
It would be pretty easy to modify this script to simply count the processes if you wanted to report back to MRTG the number of processes.

Script
process loop {
    if ((proc_cpu_total_util > 0) or ( proc_stop_reason != "SLEEP" ))
 then {
    print gbl_statdate, "|", gbl_stattime, "|", proc_cpu_last_used, "|",
 proc_mem_virt, "|", proc_mem_res, "|",
 proc_cpu_total_util, "|",
 proc_stop_reason, "|", proc_disk_logl_io_rate, "|",
 proc_proc_id, "|", proc_parent_proc_id, "|",
 proc_user_name, "|", proc_proc_name, "|",
        proc_cache_wait_time, "|", proc_cdfs_wait_time, "|",
        proc_disk_subsystem_wait_time, "|", proc_disk_wait_time, "|",
        proc_graphics_wait_time, "|", proc_inode_wait_time, "|",
        proc_ipc_subsystem_wait_time, "|", proc_ipc_wait_time, "|",
 proc_jobctl_wait_time, "|", proc_lan_wait_time, "|",
 proc_mem_wait_time, "|", proc_msg_wait_time, "|",
 proc_nfs_wait_time, "|", proc_other_io_wait_time, "|",
 proc_other_wait_time, "|", proc_pipe_wait_time, "|",
 proc_pri_wait_time, "|", proc_rpc_wait_time, "|",
 proc_sem_wait_time, "|", proc_socket_wait_time, "|",
 proc_stream_wait_time, "|", proc_sys_wait_time, "|",
 proc_term_io_wait_time
    }
}