Skip to content

Commit

Permalink
fix(deploy): not using set indexes (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Faircloth authored Apr 29, 2021
1 parent a3371ba commit 61e2cff
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 19 deletions.
20 changes: 12 additions & 8 deletions deploy/install_full.bash
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ then
while [ ! -n "$EVENTS_INDEX" ]
do
echo ""
read -p 'EVENTS_INDEX for splunk em_events (default): ' EVENTS_INDEX
EVENTS_INDEX=${EVENTS_INDEX:-em_events}
read -p 'EVENTS_INDEX for splunk em_logs (default): ' EVENTS_INDEX
EVENTS_INDEX=${EVENTS_INDEX:-em_logs}
echo testing HEC url with index $EVENTS_INDEX
curl -f $CURL_SSL $PROTO://$HOST$URI_PORT/services/collector -H "Authorization: Splunk $TOKEN" -d "{\"index\": \"$EVENTS_INDEX\", \"event\": \"test\" }"
if [ "$?" != "0" ];
Expand All @@ -249,7 +249,7 @@ then
while [ ! -n "$METRICS_INDEX" ]
do
echo ""
read -p 'METRICS_INDEX for splunk (default): ' METRICS_INDEX
read -p 'METRICS_INDEX for splunk em_metrics (default): ' METRICS_INDEX
METRICS_INDEX=${METRICS_INDEX:-em_metrics}
echo testing HEC url with index $METRICS_INDEX
curl -f $CURL_SSL $PROTO://$HOST$URI_PORT/services/collector -H "Authorization: Splunk $TOKEN" -d "{\"index\": \"$METRICS_INDEX\", \"event\": \"metric\" }"
Expand All @@ -262,8 +262,8 @@ then
while [ ! -n "$META_INDEX" ]
do
echo ""
read -p 'META_INDEX for splunk default: ' META_INDEX
META_INDEX=${META_INDEX:-em_logs}
read -p 'META_INDEX for splunk em_meta (default): ' META_INDEX
META_INDEX=${META_INDEX:-em_meta}
echo testing HEC url with index $META_INDEX
curl -f $CURL_SSL $PROTO://$HOST$URI_PORT/services/collector -H "Authorization: Splunk $TOKEN" -d "{\"index\": \"$META_INDEX\", \"event\": \"test\" }"
if [ "$?" != "0" ];
Expand Down Expand Up @@ -338,11 +338,15 @@ then
--from-literal=SIGNALFX_REALM=$SIMREALM
fi

files=( "deploy/sc4snmp/ftr/scheduler-config.yaml" "deploy/sc4snmp/ftr/scheduler-inventory.yaml" "deploy/sc4snmp/ftr/traps-server-config.yaml")
files=( "deploy/sc4snmp/ftr/scheduler-config.yaml" "deploy/sc4snmp/ftr/scheduler-inventory.yaml" "deploy/sc4snmp/ftr/traps-server-config.yaml" )
for i in "${files[@]}"
do
if [ -f $i ]; then f=$i; else f=https://raw.githubusercontent.com/splunk/splunk-connect-for-snmp/$BRANCH/$i; fi
$KCMD -n sc4snmp create -f $f
if [ -f $i ]; then src_cmd="cat $i"; else src_cmd="curl -s https://raw.githubusercontent.com/splunk/splunk-connect-for-snmp/$BRANCH/$i"; fi

$src_cmd \
| sed -e "s/##EVENTS_INDEX##/${EVENTS_INDEX}/g;s/##METRICS_INDEX##/${METRICS_INDEX}/g;s/##META_INDEX##/${META_INDEX}/g" \
| $KCMD -n sc4snmp apply -f -

done

while [ ! -n "$SHAREDIP" ]
Expand Down
6 changes: 3 additions & 3 deletions deploy/sc4snmp/ftr/scheduler-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ data:
- ['SNMPv2-MIB', 'sysName']
splunk:
index:
event: "em_logs"
meta: "em_meta"
metric: "em_metrics"
event: "##EVENTS_INDEX##"
meta: "##META_INDEX##"
metric: "##METRICS_INDEX##"
mongo:
database: "snmp_poller"
collection: "walked_hosts"
4 changes: 1 addition & 3 deletions deploy/sc4snmp/ftr/traps-server-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,4 @@ data:
thread-pool:
max-suggested-working-threads: 10
splunk:
index: snmp
index: "##EVENTS_INDEX##"
1 change: 1 addition & 0 deletions deploy/sc4snmp/internal/mib-server-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ spec:
containers:
- name: mib-server
image: ghcr.io/splunk/splunk-connect-for-snmp-mib-server:1
imagePullPolicy: Always
ports:
- containerPort: 5000
env:
Expand Down
1 change: 1 addition & 0 deletions deploy/sc4snmp/internal/scheduler-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ spec:
containers:
- name: sc4-snmp-scheduler
image: ghcr.io/splunk/splunk-connect-for-snmp-poller:1
imagePullPolicy: Always
args:
[
"--log=DEBUG",
Expand Down
3 changes: 2 additions & 1 deletion deploy/sc4snmp/internal/traps-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ spec:
containers:
- name: traps
image: ghcr.io/splunk/splunk-connect-for-snmp-traps:1
args: ["--loglevel=DEBUG", "--config=/work/config/config.yaml", "--index=snmp"]
imagePullPolicy: Always
args: ["--loglevel=DEBUG", "--config=/work/config/config.yaml"]
ports:
- containerPort: 2162
env:
Expand Down
1 change: 1 addition & 0 deletions deploy/sc4snmp/internal/worker-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ spec:
containers:
- name: sc4-snmp-worker
image: ghcr.io/splunk/splunk-connect-for-snmp-poller:1
imagePullPolicy: Always
args: ["--log=DEBUG", "--config=/work/config/config.yaml"]
env:
- name: CELERY_BROKER_URL
Expand Down
10 changes: 6 additions & 4 deletions docs/source/gettingstarted.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ Deploy SC4SNMP non-interactive
PORT=8088 \
TOKEN=450a69af-16a9-4f87-9628-c26f04ad3785 \
METRICS_INDEX=em_metrics \
EVENTS_INDEX=em_events \
META_INDEX=em_logs \
EVENTS_INDEX=em_logs \
META_INDEX=em_meta \
CLUSTER_NAME=foo \
SHAREDIP=10.202.18.166/32 \
RESOLVERIP=8.8.4.4 \
Expand All @@ -88,13 +88,15 @@ Test SNMP Traps
* Test the trap from a linux system with snmp installed replace the ip ``10.0.101.22`` with the shared ip above

.. code-block:: bash
apt-get install snmpd
snmptrap -v2c -c public 10.0.101.22 123 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.5.0 s test
* Search splunk, one event per trap command with the host value of the test machine ip will be found

.. code-block:: bash
index=* sourcetype="sc4snmp:traps"
index=em_logs sourcetype="sc4snmp:traps"
Setup Poller
Expand Down Expand Up @@ -126,7 +128,7 @@ Search splunk, one event per trap command with the host value of the test machin

.. code-block:: bash
index=* sourcetype="sc4snmp:meta" SNMPv2_MIB__sysLocation_0="*" | dedup host
index=em_logs sourcetype="sc4snmp:meta" SNMPv2_MIB__sysLocation_0="*" | dedup host
.. code-block:: bash
Expand Down

0 comments on commit 61e2cff

Please sign in to comment.