Script to get the storage value of AMQ












-1















Script that I made.



#!/bin/bash

amqBaseURL="http://10.199.199.199:8080"

/usr/bin/wget --http-user=admin --http-password=admin $amqBaseURL/admin/ -O amq1.html

store=`cat amq1.html |sed -n '/Store/{n;p}'|grep -o "[0-9]*"`

echo -e "$store"


Script output



--2019-01-23 21:25:13--  http://10.199.199.199:8080/admin/
Connecting to 10.199.199.199:8080... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Reusing existing connection to 10.199.199.199:8080.
HTTP request sent, awaiting response... 200 OK
Length: 7363 (7.2K) [text/html]
Saving to: “amq1.htmlâ€‌

100%[==========================================================================================================>] 7,363 --.-K/s in 0s

2019-01-23 21:25:13 (251 MB/s) - “amq1.htmlâ€‌ saved [7363/7363]

0


I need to get the output only the value. Instead of the whole length like everytime i run the script the output would only be.



100


I am running an external scheduler (Zabbix) for this script and the tool only accepts digits.










share|improve this question




















  • 2





    Have you looked into wget --quiet?

    – DopeGhoti
    Jan 23 at 20:46











  • Not yet, I will try to look for it. Thanks

    – White Leoming
    Jan 23 at 20:54













  • Thank you, got it. Just added -q between this line. /usr/bin/wget -q --http-user=admin

    – White Leoming
    Jan 23 at 21:00
















-1















Script that I made.



#!/bin/bash

amqBaseURL="http://10.199.199.199:8080"

/usr/bin/wget --http-user=admin --http-password=admin $amqBaseURL/admin/ -O amq1.html

store=`cat amq1.html |sed -n '/Store/{n;p}'|grep -o "[0-9]*"`

echo -e "$store"


Script output



--2019-01-23 21:25:13--  http://10.199.199.199:8080/admin/
Connecting to 10.199.199.199:8080... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Reusing existing connection to 10.199.199.199:8080.
HTTP request sent, awaiting response... 200 OK
Length: 7363 (7.2K) [text/html]
Saving to: “amq1.htmlâ€‌

100%[==========================================================================================================>] 7,363 --.-K/s in 0s

2019-01-23 21:25:13 (251 MB/s) - “amq1.htmlâ€‌ saved [7363/7363]

0


I need to get the output only the value. Instead of the whole length like everytime i run the script the output would only be.



100


I am running an external scheduler (Zabbix) for this script and the tool only accepts digits.










share|improve this question




















  • 2





    Have you looked into wget --quiet?

    – DopeGhoti
    Jan 23 at 20:46











  • Not yet, I will try to look for it. Thanks

    – White Leoming
    Jan 23 at 20:54













  • Thank you, got it. Just added -q between this line. /usr/bin/wget -q --http-user=admin

    – White Leoming
    Jan 23 at 21:00














-1












-1








-1








Script that I made.



#!/bin/bash

amqBaseURL="http://10.199.199.199:8080"

/usr/bin/wget --http-user=admin --http-password=admin $amqBaseURL/admin/ -O amq1.html

store=`cat amq1.html |sed -n '/Store/{n;p}'|grep -o "[0-9]*"`

echo -e "$store"


Script output



--2019-01-23 21:25:13--  http://10.199.199.199:8080/admin/
Connecting to 10.199.199.199:8080... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Reusing existing connection to 10.199.199.199:8080.
HTTP request sent, awaiting response... 200 OK
Length: 7363 (7.2K) [text/html]
Saving to: “amq1.htmlâ€‌

100%[==========================================================================================================>] 7,363 --.-K/s in 0s

2019-01-23 21:25:13 (251 MB/s) - “amq1.htmlâ€‌ saved [7363/7363]

0


I need to get the output only the value. Instead of the whole length like everytime i run the script the output would only be.



100


I am running an external scheduler (Zabbix) for this script and the tool only accepts digits.










share|improve this question
















Script that I made.



#!/bin/bash

amqBaseURL="http://10.199.199.199:8080"

/usr/bin/wget --http-user=admin --http-password=admin $amqBaseURL/admin/ -O amq1.html

store=`cat amq1.html |sed -n '/Store/{n;p}'|grep -o "[0-9]*"`

echo -e "$store"


Script output



--2019-01-23 21:25:13--  http://10.199.199.199:8080/admin/
Connecting to 10.199.199.199:8080... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Reusing existing connection to 10.199.199.199:8080.
HTTP request sent, awaiting response... 200 OK
Length: 7363 (7.2K) [text/html]
Saving to: “amq1.htmlâ€‌

100%[==========================================================================================================>] 7,363 --.-K/s in 0s

2019-01-23 21:25:13 (251 MB/s) - “amq1.htmlâ€‌ saved [7363/7363]

0


I need to get the output only the value. Instead of the whole length like everytime i run the script the output would only be.



100


I am running an external scheduler (Zabbix) for this script and the tool only accepts digits.







linux shell-script






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 23 at 21:06









Rui F Ribeiro

39.8k1479133




39.8k1479133










asked Jan 23 at 20:43









White LeomingWhite Leoming

1




1








  • 2





    Have you looked into wget --quiet?

    – DopeGhoti
    Jan 23 at 20:46











  • Not yet, I will try to look for it. Thanks

    – White Leoming
    Jan 23 at 20:54













  • Thank you, got it. Just added -q between this line. /usr/bin/wget -q --http-user=admin

    – White Leoming
    Jan 23 at 21:00














  • 2





    Have you looked into wget --quiet?

    – DopeGhoti
    Jan 23 at 20:46











  • Not yet, I will try to look for it. Thanks

    – White Leoming
    Jan 23 at 20:54













  • Thank you, got it. Just added -q between this line. /usr/bin/wget -q --http-user=admin

    – White Leoming
    Jan 23 at 21:00








2




2





Have you looked into wget --quiet?

– DopeGhoti
Jan 23 at 20:46





Have you looked into wget --quiet?

– DopeGhoti
Jan 23 at 20:46













Not yet, I will try to look for it. Thanks

– White Leoming
Jan 23 at 20:54







Not yet, I will try to look for it. Thanks

– White Leoming
Jan 23 at 20:54















Thank you, got it. Just added -q between this line. /usr/bin/wget -q --http-user=admin

– White Leoming
Jan 23 at 21:00





Thank you, got it. Just added -q between this line. /usr/bin/wget -q --http-user=admin

– White Leoming
Jan 23 at 21:00










1 Answer
1






active

oldest

votes


















0














Posting answer so that question can be marked closed. Credit to DopeGhoti.
In order to suppress the full wget session output, the command can be run with the -q or --quiet flag. From the documentation:




   -q
--quiet
Turn off Wget's output.



Alternatively, to get minimal output (e.g. errors) use the -nv or --no-verbose flag. From the documentation:




   -nv
--no-verbose
Turn off verbose without being completely quiet (use -q for that), which means that error messages and basic information still get printed.






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f496322%2fscript-to-get-the-storage-value-of-amq%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Posting answer so that question can be marked closed. Credit to DopeGhoti.
    In order to suppress the full wget session output, the command can be run with the -q or --quiet flag. From the documentation:




       -q
    --quiet
    Turn off Wget's output.



    Alternatively, to get minimal output (e.g. errors) use the -nv or --no-verbose flag. From the documentation:




       -nv
    --no-verbose
    Turn off verbose without being completely quiet (use -q for that), which means that error messages and basic information still get printed.






    share|improve this answer




























      0














      Posting answer so that question can be marked closed. Credit to DopeGhoti.
      In order to suppress the full wget session output, the command can be run with the -q or --quiet flag. From the documentation:




         -q
      --quiet
      Turn off Wget's output.



      Alternatively, to get minimal output (e.g. errors) use the -nv or --no-verbose flag. From the documentation:




         -nv
      --no-verbose
      Turn off verbose without being completely quiet (use -q for that), which means that error messages and basic information still get printed.






      share|improve this answer


























        0












        0








        0







        Posting answer so that question can be marked closed. Credit to DopeGhoti.
        In order to suppress the full wget session output, the command can be run with the -q or --quiet flag. From the documentation:




           -q
        --quiet
        Turn off Wget's output.



        Alternatively, to get minimal output (e.g. errors) use the -nv or --no-verbose flag. From the documentation:




           -nv
        --no-verbose
        Turn off verbose without being completely quiet (use -q for that), which means that error messages and basic information still get printed.






        share|improve this answer













        Posting answer so that question can be marked closed. Credit to DopeGhoti.
        In order to suppress the full wget session output, the command can be run with the -q or --quiet flag. From the documentation:




           -q
        --quiet
        Turn off Wget's output.



        Alternatively, to get minimal output (e.g. errors) use the -nv or --no-verbose flag. From the documentation:




           -nv
        --no-verbose
        Turn off verbose without being completely quiet (use -q for that), which means that error messages and basic information still get printed.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 23 at 22:28









        CrypteyaCrypteya

        13610




        13610






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f496322%2fscript-to-get-the-storage-value-of-amq%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

            is 'sed' thread safe

            How to make a Squid Proxy server?