-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelasticsearch-export-dev-run.sh
More file actions
executable file
·52 lines (51 loc) · 2.25 KB
/
Copy pathelasticsearch-export-dev-run.sh
File metadata and controls
executable file
·52 lines (51 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh
# -- Elasticsearch Exporter GitHub : https://github.com/prometheus-community/elasticsearch_exporter
ELASTICSEARCH_EXPORT_PATH=/home/devuser/monitoring/es_exporter/elasticsearch_exporter-1.6.0.linux-386/
#PATH=$PATH:$ELASTICSEARCH_EXPORT_PATH/bin
SERVICE_NAME=elasticsearch-export-service
# ES_HOST=localhost:9200
ES_HOST=es_monitoring:test@localhost:9200
PORT=9201
# See how we were called.
case "$1" in
start)
# Start daemon.
echo "Starting $SERVICE_NAME";
nohup $ELASTICSEARCH_EXPORT_PATH/elasticsearch_exporter --es.uri=https://$ES_HOST --es.all --es.indices --es.timeout 20s --es.snapshots --es.ssl-skip-verify --web.listen-address :$PORT &> /dev/null &
#$ELASTICSEARCH_EXPORT_PATH/elasticsearch_exporter --es.uri=https://$ES_HOST --es.all --es.indices --es.timeout 20s --es.snapshots --es.ssl-skip-verify --web.listen-address :$PORT
# nohup $ELASTICSEARCH_EXPORT_PATH/elasticsearch_exporter --es.uri=https://a:a@localhost:9200 --es.all --es.indices --es.timeout 20s --es.snapshots --es.ssl-skip-verify --web.listen-address :$PORT &> /dev/null &
#nohup $ELASTICSEARCH_EXPORT_PATH/elasticsearch_exporter --es.uri=http://$ES_HOST --es.all --es.indices --es.timeout 20s --es.snapshots --web.listen-address :$PORT &> /dev/null &
# $ELASTICSEARCH_EXPORT_PATH/elasticsearch_exporter --es.uri=http://$ES_HOST --es.all --es.indices --es.timeout 20s --es.snapshots --web.listen-address :$PORT
;;
stop)
# Stop daemons.
echo "Shutting down $SERVICE_NAME";
pid=`ps ax | grep -i '/elasticsearch_exporter --es.uri=http://'$ES_HOST | grep -v grep | awk '{print $1}'`
if [ -n "$pid" ]
then
kill -9 $pid
else
echo "$SERVICE_NAME was not Running"
fi
;;
restart)
#$0 stop
#sleep 2
#$0 start
$0 stop
$0 start
sleep 5
;;
status)
pid=`ps ax | grep -i '/elasticsearch_exporter --es.uri=http://'$ES_HOST | grep -v grep | awk '{print $1}'`
if [ -n "$pid" ]
then
echo "$SERVICE_NAME is Running as PID: $pid"
else
echo "$SERVICE_NAME is not Running"
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac