zabbix-agent2/src/zabbix_agent/zbxkstat.c
/******************************************************************************
 *                                                                            *
 * Function: zbx_kstat_collect                                                *
 *                                                                            *
 * Purpose: collect kstat stats                                               *
 *                                                                            *
 * Comments: This function is called every second to collect statistics.      *
 *                                                                            *
 ******************************************************************************/
zbx_kstat_collect

Purpose: collect kstat stats

Comments: This function is called every second to collect statistics.
zbx_kstat_collect Purpose : collect kstat stats Comments : This function is called every second to collect statistics .
void	zbx_kstat_collect(zbx_kstat_t *kstat)
{
	kid_t		kid;
	char		*error = NULL;
	vminfo_t	vminfo;
	while (-1 == (kid = kstat_read(kc, kc_vminfo, &vminfo)) || kc_id != kid)
	{
		if (SUCCEED != zbx_kstat_refresh(&error))
		{
			zabbix_log(LOG_LEVEL_WARNING, "cannot collect kstat data: %s", error);
			zbx_free(error);
			return;
		}
	}
	zbx_mutex_lock(kstat_lock);
	kstat->vminfo_index ^= 1;
	kstat->vminfo[kstat->vminfo_index].freemem = vminfo.freemem;
	kstat->vminfo[kstat->vminfo_index].updates = vminfo.updates;
	zbx_mutex_unlock(kstat_lock);
}
void zbx_kstat_collect ( zbx_kstat_t * kstat ) { kid_t kid ; char * error = NULL ; vminfo_t vminfo ; while ( -1 == ( kid = kstat_read ( kc , kc_vminfo , & vminfo ) ) || kc_id != kid ) { if ( SUCCEED != zbx_kstat_refresh ( & error ) ) { zabbix_log ( LOG_LEVEL_WARNING , " " , error ) ; zbx_free ( error ) ; return ; } } zbx_mutex_lock ( kstat_lock ) ; kstat -> vminfo_index ^= 1 ; kstat -> vminfo [ kstat -> vminfo_index ] . freemem = vminfo . freemem ; kstat -> vminfo [ kstat -> vminfo_index ] . updates = vminfo . updates ; zbx_mutex_unlock ( kstat_lock ) ; }
Function: zbx_kstat_collect                                                
                                                                            
 Purpose: collect kstat stats                                               
                                                                            
 Comments: This function is called every second to collect statistics.
Function : zbx_kstat_collect Purpose : collect kstat stats Comments : This function is called every second to collect statistics .