[SDFAB-688][SDFAB-689] Add per ONOS instance state support

Change-Id: I68738da877c379999bf71c2af79b3b88ee760542
diff --git a/.gitignore b/.gitignore
index 9c8d1e2..41c8995 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,7 @@
 
 # ignore dependent chart dirs
 charts
+Chart.lock
 
 # ignore MacOS DS_Store
 *.DS_Store
diff --git a/apps/tost-telegraf/Chart.yaml b/apps/tost-telegraf/Chart.yaml
index 8f2aa1f..284fcd9 100644
--- a/apps/tost-telegraf/Chart.yaml
+++ b/apps/tost-telegraf/Chart.yaml
@@ -18,7 +18,7 @@
 # This is the chart version. This version number should be incremented each time you make changes
 # to the chart and its templates, including the app version.
 # Versions are expected to follow Semantic Versioning (https://semver.org/)
-version: 0.1.3
+version: 0.1.4
 
 # This is the version number of the application being deployed. This version number should be
 # incremented each time you make changes to the application. Versions are not expected to
diff --git a/apps/tost-telegraf/templates/configmap-config.yaml b/apps/tost-telegraf/templates/configmap-config.yaml
index 28e861f..7c5652b 100644
--- a/apps/tost-telegraf/templates/configmap-config.yaml
+++ b/apps/tost-telegraf/templates/configmap-config.yaml
@@ -13,7 +13,7 @@
     release: "{{ .Release.Name }}"
     app: tost-telegraf
 data:
-  tost_telegraf.sh: |
+  sdfabric_telegraf.sh: |
     #!/bin/bash
     set -x
     #Locale setting for json_pp
@@ -34,8 +34,13 @@
         DEVICES=$(curl --fail -sSL --user {{ .Values.onos.username }}:{{ .Values.onos.password }} --noproxy {{ .Values.onos.server }} -X GET -H 'Accept: application/json' \
         http://{{ .Values.onos.server }}:{{ .Values.onos.port }}/onos/v1/devices | json_pp | grep "\"type\" : \"SWITCH\"" | wc -l)
 
+        ONOS_PODS=$(kubectl get po -l app=onos-classic -o name)
+        for POD in $ONOS_PODS; do
+            ONOS_READY=$(kubectl -n {{ .Values.onos.namespace }} get ${POD} --no-headers -o custom-columns=':.status.containerStatuses[*].ready' | grep true | wc -l)
+            echo "onos_telegraf,type=onos,onos_pod=${POD} ready=${ONOS_READY}"
+        done
         # Config Pod's ready status indicate the status of ONOS cluster
         # Assumption: Config Pod has only one instance
         ONOS_READY=$(kubectl -n {{ .Values.onos.namespace }} get pods -l {{ .Values.onos.component_label }} --no-headers -o custom-columns=':.status.containerStatuses[*].ready' | grep true | wc -l)
-        echo "onos_telegraf active_links=${ACTIVE_LINKS},enable_device_ports=${ENABLE_DEVICE_PORTS},devices=${DEVICES},ready=${ONOS_READY}"
+        echo "onos_telegraf,type=cluster active_links=${ACTIVE_LINKS},enable_device_ports=${ENABLE_DEVICE_PORTS},devices=${DEVICES},ready=${ONOS_READY}"
     done
diff --git a/apps/tost-telegraf/values.yaml b/apps/tost-telegraf/values.yaml
index 28485e9..1465b55 100644
--- a/apps/tost-telegraf/values.yaml
+++ b/apps/tost-telegraf/values.yaml
@@ -11,8 +11,8 @@
         defaultMode: 0755
   mountPoints:
     - name: "telegraf-external-daemon"
-      mountPath: /tmp/onos_telegraf.sh
-      subPath: tost_telegraf.sh
+      mountPath: /tmp/sdfabric_telegraf.sh
+      subPath: sdfabric_telegraf.sh
   rbac:
     rules:
     - apiGroups: [""]
@@ -29,7 +29,7 @@
   config:
     inputs:
       - execd:
-          command: ["sh", "-c", "/tmp/onos_telegraf.sh"]
+          command: ["sh", "-c", "/tmp/sdfabric_telegraf.sh"]
           signal: "STDIN"
       - cisco_telemetry_gnmi:
           addresses: