lundi 15 mars 2021

Salt. return custom status code from http.query state and pass it on

I want to maintain web page statuses and pass them to Grafana for easy visual checking

I can check what status the page returns to me.

check-status:
  http.query:
  - name: http://127.0.0.1:5341
  - status: 200

Can I send an http.query and use the status that comes to me in stdout. In order to write it to Postgres and from there send it to the graphan? I want to maintain web page statuses and pass them to Grafana for easy visual checking

Or should I do if\else for each status like: If status 200 - write 200, if status 404 - write 404??

Salt Version:
           Salt: 3002.1
 
Dependency Versions:
           cffi: 1.12.2
       cherrypy: unknown
       dateutil: 2.7.3
      docker-py: 3.4.1
          gitdb: 2.0.5
      gitpython: 2.1.11
         Jinja2: 2.10
        libgit2: 0.27.7
       M2Crypto: Not Installed
           Mako: 1.0.7
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: 1.3.10
      pycparser: 2.19
       pycrypto: 2.6.1
   pycryptodome: 3.6.1
         pygit2: 0.27.4
         Python: 3.7.3 (default, Jul 25 2020, 13:03:44)
   python-gnupg: 0.4.4
         PyYAML: 3.13
          PyZMQ: 17.1.2
          smmap: 2.0.5
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.3.1
 
System Versions:
           dist: debian 10 buster
         locale: UTF-8
        machine: x86_64
        release: 4.19.0-6-amd64
         system: Linux
        version: Debian GNU/Linux 10 buster

Aucun commentaire:

Enregistrer un commentaire