Ohai is a tool which is used by chef-client to obtain information about the node’s platform detail, networking usage, memory usage, processor usage , kernel data , host names, fully qualified domain names and other configuration. It also has command line tool which displays the data in Json.
ohai | head -4 { "languages": { "ruby": { "platform": "x86_64-darwin12.2.0",
As you can see it shows system information in json format. But it’s a challenge to extract this information from Json in command line. I found this cool tool jq, you can download it from this site; it’s written in C and there is no runtime dependency. It allows you parse Json easily, for example:
ohai -l error | jq '.ipaddress' "192.168.1.8" ohai -l error | jq '.uptime_seconds' 80222
Note: you should use ohai -l error when you are piping the output to jq, because sometimes ohai throws warnings, and that will make json parsing fail because of unformatted json.
I find this very useful rather then trying to use awk to parse the IP address or any other node information you can easily use ohai and jq to get that information.
How Amazon EKS Anywhere facilitates hybrid cloud operations for application modernization
2022-06-30 19:03:00How to create a highly scalable Kubernetes infrastructure with Amazon EKS managed node groups
2022-06-22 19:06:05Accelerate image manipulation with Serverless Image Handler on AWS
2022-06-03 13:30:36Investing in the growth of nClouds — our team, customers, and partners
2022-05-11 12:56:18