Vadims06 / ospfwatcher

History of all changes in OSPF Topology
https://topolograph.com/ospf-monitoring
GNU General Public License v3.0
61 stars 8 forks source link

ospfwatcher_logstash #2

Closed voip777 closed 1 year ago

voip777 commented 1 year ago

Vadim, tell me, I get it in the ospfwatcher_logstash container

[2022-11-01T12:01:31,118][WARN ][logstash.outputs.elasticsearch][main] Attempted to resurrect connection to dead ES instance, but got an error {:url=>"http://elastic:xxxxxx@127.0.0.1:9200/", :exception=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :message=>"Elasticsearch Unreachable: [http://elastic:xxxxxx@127.0.0.1:9200/][Manticore::SocketException] Connection refused (Connection refused)"}

Index Templates are not created

Vadims06 commented 1 year ago

Hi @voip777, It takes some time in order to logstash boots up, by the way, make sure that all components/containers are up using docker ps command.

Vadims06 commented 1 year ago

Do you have external ELK stack or use local docker-based one?

voip777 commented 1 year ago

docker container ls CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS

                                                     NAMES

8b89508ca7f3 ospfwatcher_logstash "/usr/local/bin/dock…" 5 hours ago Up 5 hours 5044/tcp, 9600/tcp

                                                  logstash

4d32866831f9 watcher:1.0 "python pytail.py" 5 hours ago Up 4 hours

                                                   watcher

c55c034c3ed8 quagga:1.0 "/sbin/tini -- /usr/…" 5 hours ago Up 5 hours

                                                   quagga

21f350b1dbc5 vadims06/webserver:latest "nginx -g 'daemon of…" 4 days ago Up 4 days 0.0.0.0:80->8080/tcp, :::80->8080/tcp

                                                   webserver

665c8ee4a820 vadims06/topolograph:latest "gunicorn -w 4 --bin…" 4 days ago Up 4 days 5000/tcp

                                                  flask

a9205c0fefe0 mongo:4.0.8 "docker-entrypoint.s…" 4 days ago Up 4 days 27017/tcp

                                                   mongodb

9a1a96f7333b docker-elk_logstash "/usr/local/bin/dock…" 6 days ago Up 6 days 0.0.0.0:5044->5044/tcp, :::5044->5044/tcp, 0.0.0.0:9600->9600/tcp, :::9600->9600/tcp, 0.0.0.0:50000->50000/tcp, :::50000->50000/tcp, 0.0.0.0:50000->50000/udp, :::50000->50000/udp docker-elk_logstash_1 99792de4a483 docker-elk_kibana "/bin/tini -- /usr/l…" 6 days ago Up 6 days 0.0.0.0:5601->5601/tcp, :::5601->5601/tcp

                                                   docker-elk_kibana_1

939fb45d55c2 docker-elk_elasticsearch "/bin/tini -- /usr/l…" 6 days ago Up 6 days 0.0.0.0:9200->9200/tcp, :::9200->9200/tcp, 0.0.0.0:9300->9300/tcp, :::9300->9300/tcp

docker-elk_elasticsearch_1

вт, 1 нояб. 2022 г. в 15:16, Vadim @.***>:

Hi @voip777 https://github.com/voip777, It takes some time in order to logstash boots up, by the way, make sure that all components/containers are up using docker ps command.

— Reply to this email directly, view it on GitHub https://github.com/Vadims06/ospfwatcher/issues/2#issuecomment-1298427648, or unsubscribe https://github.com/notifications/unsubscribe-auth/A355TMW5EXDGUN7TAQIAMOTWGECZDANCNFSM6AAAAAART7Y47I . You are receiving this because you were mentioned.Message ID: @.***>

-- Best regards, Vladimir Shencov Digium Certified Asterisk Administrator (dCAA) ISP Crymcom

voip777 commented 1 year ago

use local docker-based

вт, 1 нояб. 2022 г. в 15:19, Vadim @.***>:

Do you have external ELK stack or use local docker-based one?

— Reply to this email directly, view it on GitHub https://github.com/Vadims06/ospfwatcher/issues/2#issuecomment-1298431081, or unsubscribe https://github.com/notifications/unsubscribe-auth/A355TMXNTB6N5LIEDSNNYJLWGEDFHANCNFSM6AAAAAART7Y47I . You are receiving this because you were mentioned.Message ID: @.***>

-- Best regards, Vladimir Shencov Digium Certified Asterisk Administrator (dCAA) ISP Crymcom

Vadims06 commented 1 year ago

@voip777 It seems that elastic works and listens host's IP 9200 port. Make sure that you can login into Elastic's dashboard with elastic/changeme credentials. If you changed login/password previously - set a new one into docker-compose.yml file and re-run docker compose. We can try to re-run index templates creation script manually. For doing this:

  1. jump into logstash-index-creator container using docker exec -it logstash-index-creator /bin/bash
  2. run python create.py
voip777 commented 1 year ago

docker exec -it logstash-index-creator /bin/bash Error response from daemon: Container 7b09985b30eab188717a649e6ffbf5033d5be1380910d90eda2f988bf424cf53 is not running

docker container ls CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS

                                                       NAMES

8b89508ca7f3 ospfwatcher_logstash "/usr/local/bin/dock…" 21 hours ago Up 21 hours 5044/tcp, 9600/tcp

@.***:/home/ospfwatcher/logstash# docker exec -it 8b89508ca7f3 /bin/bash

bash-4.2$ python create.py python: can't open file 'create.py': [Errno 2] No such file or directory bash-4.2$ find -name *.py ./vendor/bundle/jruby/2.5.0/gems/fpm-1.3.3/lib/fpm/package/pyfpm/init.py ./vendor/bundle/jruby/2.5.0/gems/fpm-1.3.3/lib/fpm/package/pyfpm/get_metadata.py

вт, 1 нояб. 2022 г. в 22:14, Vadim @.***>:

@voip777 https://github.com/voip777 It seems that elastic works and listens host's IP 9200 port. Make sure that you can login into Elastic's dashboard with elastic/changeme credentials. If you changed login/password previously - set a new one into docker-compose.yml file and re-run docker compose. We can try to re-run index templates creation script manually. For doing this:

  1. jump into logstash-index-creator container using docker exec -it logstash-index-creator /bin/bash
  2. run python create.py

— Reply to this email directly, view it on GitHub https://github.com/Vadims06/ospfwatcher/issues/2#issuecomment-1298992947, or unsubscribe https://github.com/notifications/unsubscribe-auth/A355TMUQPZJJDO54UVNURALWGFTZRANCNFSM6AAAAAART7Y47I . You are receiving this because you were mentioned.Message ID: @.***>

-- Best regards, Vladimir Shencov Digium Certified Asterisk Administrator (dCAA) ISP Crymcom

Vadims06 commented 1 year ago

Okay, let's try in the following way:

docker run -it -v your_absolute_path_/Users/...logstash/index_template/create.py:/home/watcher/watcher/create.py --network internal watcher:1.0 /bin/bash
python create.py
voip777 commented 1 year ago

@.:/home/ospfwatcher# docker run -it -v /home/ospfwatcher/logstash/index_template/create.py:/home/watcher/watcher/create.py --network internal watcher:1.0 /bin/bash docker: Error response from daemon: network internal not found. @.:/home/ospfwatcher#

ср, 2 нояб. 2022 г. в 10:50, Vadim @.***>:

Okay, let's try in the following way:

docker run -it -v your_absolutepath/Users/...logstash/index_template/create.py:/home/watcher/watcher/create.py --network internal watcher:1.0 /bin/bash python create.py

— Reply to this email directly, view it on GitHub https://github.com/Vadims06/ospfwatcher/issues/2#issuecomment-1299719489, or unsubscribe https://github.com/notifications/unsubscribe-auth/A355TMQXOLVH2JXVC5EPU3LWGIMNXANCNFSM6AAAAAART7Y47I . You are receiving this because you were mentioned.Message ID: @.***>

-- Best regards, Vladimir Shencov Digium Certified Asterisk Administrator (dCAA) ISP Crymcom

voip777 commented 1 year ago

docker network ls NETWORK ID NAME DRIVER SCOPE 8e6e433919d7 bridge bridge local 19b42f91e020 docker-elk_elk bridge local c6069396ac21 host host local 643db39cc0a4 none null local 9caf3227c147 ospfwatcher_elk bridge local 6c99938a681c ospfwatcher_internal bridge local dcd5bd095d23 topolograph-docker_backend bridge local 3bb89cfbb868 topolograph-docker_frontend bridge local

ср, 2 нояб. 2022 г. в 10:50, Vadim @.***>:

Okay, let's try in the following way:

docker run -it -v your_absolutepath/Users/...logstash/index_template/create.py:/home/watcher/watcher/create.py --network internal watcher:1.0 /bin/bash python create.py

— Reply to this email directly, view it on GitHub https://github.com/Vadims06/ospfwatcher/issues/2#issuecomment-1299719489, or unsubscribe https://github.com/notifications/unsubscribe-auth/A355TMQXOLVH2JXVC5EPU3LWGIMNXANCNFSM6AAAAAART7Y47I . You are receiving this because you were mentioned.Message ID: @.***>

-- Best regards, Vladimir Shencov Digium Certified Asterisk Administrator (dCAA) ISP Crymcom

Vadims06 commented 1 year ago

Got it. Use ospfwatcher_internal instead of internal as a network in my last command

voip777 commented 1 year ago

docker run -it -v /home/ospfwatcher/logstash/index_template/create.py:/home/watcher/watcher/create.py --network ospfwatcher_internal watcher:1.0 /bin/bash

no errors , but index Templates are not created

ср, 2 нояб. 2022 г. в 11:30, Vadim @.***>:

Got it. Use ospfwatcher_internal instead of internal as a network in my last command

— Reply to this email directly, view it on GitHub https://github.com/Vadims06/ospfwatcher/issues/2#issuecomment-1299810966, or unsubscribe https://github.com/notifications/unsubscribe-auth/A355TMRAQFBPFKHPBJO2R2TWGIRCXANCNFSM6AAAAAART7Y47I . You are receiving this because you were mentioned.Message ID: @.***>

-- Best regards, Vladimir Shencov Digium Certified Asterisk Administrator (dCAA) ISP Crymcom

Vadims06 commented 1 year ago

You just enter the container, execute python create.py from it.

voip777 commented 1 year ago

How to setup - passed ; How to start - passed ;

ospfwatcher tool not working ...

ср, 2 нояб. 2022 г. в 12:20, Vadim @.***>:

You just enter the container, execute python create.py from it.

— Reply to this email directly, view it on GitHub https://github.com/Vadims06/ospfwatcher/issues/2#issuecomment-1299922226, or unsubscribe https://github.com/notifications/unsubscribe-auth/A355TMVBT3WAS63EOQOBWTTWGIW4RANCNFSM6AAAAAART7Y47I . You are receiving this because you were mentioned.Message ID: @.***>

-- Best regards, Vladimir Shencov Digium Certified Asterisk Administrator (dCAA) ISP Crymcom

voip777 commented 1 year ago

Traceback (most recent call last): File "/home/watcher/watcher/create.py", line 14, in r = requests.put(f"{ELASTIC_URL}:9200/_index_template/{indexTemplateName}", auth=({ELASTIC_USER_LOGIN}, {ELASTIC_USER_PASS}), headers=headers, data=json.dumps(indexTemplateSettings)) File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 132, in put return request('put', url, data=data, kwargs) File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 61, in request return session.request(method=method, url=url, kwargs) File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 542, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 655, in send r = adapter.send(request, kwargs) File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 516, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='172.25.80.1', port=9200): Max retries exceeded with url: /_index_template/ospf-watcher-updown-events (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f3249e2b4c0>: Failed to establish a new connection: [Errno 110] Connection timed out'))

ср, 2 нояб. 2022 г. в 12:20, Vadim @.***>:

You just enter the container, execute python create.py from it.

— Reply to this email directly, view it on GitHub https://github.com/Vadims06/ospfwatcher/issues/2#issuecomment-1299922226, or unsubscribe https://github.com/notifications/unsubscribe-auth/A355TMVBT3WAS63EOQOBWTTWGIW4RANCNFSM6AAAAAART7Y47I . You are receiving this because you were mentioned.Message ID: @.***>

-- Best regards, Vladimir Shencov Digium Certified Asterisk Administrator (dCAA) ISP Crymcom

voip777 commented 1 year ago

Okay , you write : docker run -it -v your_absolutepath/Users/...logstash/index_template/create.py:/home/watcher/watcher/create.py --network internal watcher:1.0 /bin/bash python create.py

container has no environment variable ELASTIC_URL , and then the default values are used which results in an error

your solution is not working

Vadims06 commented 1 year ago

Variables are defined in docker-compose.yml file and looks like this

image

Change it accordingly. I updated this part of README section in order to highlight this step. Based on your feedback, the documentation is getting better.

image

Please make sure that you changed these variables in these 2 places and re-run docker-compose [down/up -d]

Vadims06 commented 1 year ago

Hi @voip777, how is your progress? Did you get it worked?..

Vadims06 commented 1 year ago

Hi @voip777 I drastically changed topolograph-docker and ospfwatcher as well as README, please fetch all changes via git pull and provide the feedback. Cheers.

voip777 commented 1 year ago

checked everything everything works

вс, 20 нояб. 2022 г. в 19:52, Vadim @.***>:

Hi @voip777 https://github.com/voip777 I drastically changed topolograph-docker and ospfwatcher as well as README, please fetch all changes via git pull and provide the feedback. Cheers.

— Reply to this email directly, view it on GitHub https://github.com/Vadims06/ospfwatcher/issues/2#issuecomment-1321182402, or unsubscribe https://github.com/notifications/unsubscribe-auth/A355TMR3ECHY7QOAT5MX7SLWJJJOFANCNFSM6AAAAAART7Y47I . You are receiving this because you were mentioned.Message ID: @.***>

-- Best regards, Vladimir Shencov Digium Certified Asterisk Administrator (dCAA) ISP Crymcom

Vadims06 commented 1 year ago

Glad to hear it. I close this issue. Let me know if you have any issues in the future.