I want to monitor all process in windows2003,so i use LLD(low level discovey)
First i create a bat file named process_find.bat,it's code like this:
@echo off & setlocal enabledelayedexpansion
echo {
echo "data":[
for /f "delims=, tokens=1,2" %%i in ('tasklist /fo csv /nh') do (
if defined a echo {"{#ProcName}":"!a!"},
set "a=%%~j_%%~i"
)
echo,{"{#ProcName}":"!a!"}
echo ]
echo }
it's output like this:
{
"data":[
{"{#ProcName}":"0_System Idle Process"},
{"{#ProcName}":"4_System"},
{"{#ProcName}":"288_smss.exe"},
{"{#ProcName}":"396_csrss.exe"},
{"{#ProcName}":"444_wininit.exe"},
{"{#ProcName}":"464_csrss.exe"},
{"{#ProcName}":"500_services.exe"},
{"{#ProcName}":"516_lsass.exe"},
{"{#ProcName}":"524_lsm.exe"},
{"{#ProcName}":"648_winlogon.exe"},
{"{#ProcName}":"676_svchost.exe"},
{"{#ProcName}":"752_svchost.exe"}
]
}
And create a another bat file named process_mem.bat,it's code like this:
@echo off
for /f "delims=, tokens=1,2,4*" %%i in ('tasklist /fo csv /nh') do (
set "a=%%~j_%%~i"
if "%1"=="!a!"(echo %k%)
then ,i wrote this in agentd.conf:
userparameter=process_find,/scripts/process_find.bat
userparmeter=process_mem[*],/scripts/process_mem.bat $1
At last,i create a item prototype:
name:process $1
key
rocess_mem[{#ProcName}]
but the result like this:
zabbix can not create the same item process_mem[{#ProcName}]
why?
First i create a bat file named process_find.bat,it's code like this:
@echo off & setlocal enabledelayedexpansion
echo {
echo "data":[
for /f "delims=, tokens=1,2" %%i in ('tasklist /fo csv /nh') do (
if defined a echo {"{#ProcName}":"!a!"},
set "a=%%~j_%%~i"
)
echo,{"{#ProcName}":"!a!"}
echo ]
echo }
it's output like this:
{
"data":[
{"{#ProcName}":"0_System Idle Process"},
{"{#ProcName}":"4_System"},
{"{#ProcName}":"288_smss.exe"},
{"{#ProcName}":"396_csrss.exe"},
{"{#ProcName}":"444_wininit.exe"},
{"{#ProcName}":"464_csrss.exe"},
{"{#ProcName}":"500_services.exe"},
{"{#ProcName}":"516_lsass.exe"},
{"{#ProcName}":"524_lsm.exe"},
{"{#ProcName}":"648_winlogon.exe"},
{"{#ProcName}":"676_svchost.exe"},
{"{#ProcName}":"752_svchost.exe"}
]
}
And create a another bat file named process_mem.bat,it's code like this:
@echo off
for /f "delims=, tokens=1,2,4*" %%i in ('tasklist /fo csv /nh') do (
set "a=%%~j_%%~i"
if "%1"=="!a!"(echo %k%)
then ,i wrote this in agentd.conf:
userparameter=process_find,/scripts/process_find.bat
userparmeter=process_mem[*],/scripts/process_mem.bat $1
At last,i create a item prototype:
name:process $1
key
rocess_mem[{#ProcName}]but the result like this:
zabbix can not create the same item process_mem[{#ProcName}]
why?
Comment