Deployment Architecture

How to monitor cpu utlization from linux and unix ?

karthi2809
Builder

In my scenario I have to consolidated cpu utlization of all application in one query.But i cannot get proper output because my cpu for linux used vmstat for unix mpstat used so my output is mismatch .i will attach below.How to frame a query to get all server cpu .
Used Query:
index=XXX* OR index=FFF* OR index=EEE* OR index="GGG*" OR index="HH*"source=cpu | rex field=_raw "CPUPctUsed=(?\d*)" | eval CPUPctUsed2=100-pctIdle | fillnull value="NA" CPUPctUsed1 CPUPctUsed2 | eval CPUPctUsed=if(CPUPctUsed1="NA",CPUPctUsed2,CPUPctUsed1) | stats avg(CPUPctUsed) as "Avg" max(CPUPctUsed) as "Max" by host index | eval Avg=round(Avg,2) | where Max > 95 | table index host Avg Max

Thanks in advance

Tags (3)
0 Karma

renjith_nair
Legend

@karthi2809 ,
Your search does not show how the raw events are stored. However, you could try extracting the output from vmstat and mpstat on two different variables and pick up the non empty value , something like

index=XXX* OR index=FFF* OR index=EEE* OR index="GGG*" OR index="HH*"source=cpu|eval mpstat="extraction logic for mpstat" |eval vmstat="extraction logic for vmstat" |eval CPUPctUsed=coalesce(mpstat,vmstat)|stats avg(CPUPctUsed) as "Avg" max(CPUPctUsed) as "Max" by host index | eval Avg=round(Avg,2) | where Max > 95 | table index host Avg Max 
Happy Splunking!
0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...