Linux bash script to output health checks in csv format

Hi,

I am trying to create a bash script which can create a csv file as per below.
File system check can be OK if it is below 80% usage.
Please help me

Server    Uptime - days     SSH-Login Check    SNMP Status   File System Status
abcd      41                         OK- Local login         OK                     OK
efgh       30                         OK-Local login          OK                     OK

And what code did you try so far?
Where do you get server names from?

This structure is unclear, where are the commas supposed to be?

1 Like

Given the use of SNMP, is this data you're polling from a NetCool or similar report?
If so, what is the format of the original data?

Welcome @idrisa !
Please wrap your samples in triple-backticks markdowns, to keep the original format!
(The little terminal icon at the top of the edit window provides them.)
I edited your initial post. Maybe you want to re-edit it and adjust the spacing.?

Server Uptime - days SSH-Login Check SNMP Status File System Status
abcd 41 OK- Local login OK OK
efgh 30 OK-Local login OK OK

I'm sorry, but this still doesn't help.
Maybe instead of duplicating your original post and adding unformatted outputs again, try re-editing original post to represent the actual formatting you want to retain.
No answers about any input data, neither code snippets were provided so far.

Collect the raw data like this?

#!/bin/bash
servers=(
abcd
efgh
)

for server in "${servers[@]}"
do
  echo "$server"
  ssh -n "$server" '
    uptime
    service snmpd status
    df -klP
  '
  echo
done