Ad Widget

Collapse

Preprocessing doubts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mfortes
    Senior Member
    • Oct 2019
    • 416

    #1

    Preprocessing doubts

    Hi,

    I have an equipament where is not possible install a Zabbix agent or SNMP-utils for SNMP monitoring...
    I'm trying collect uptime info with an SSH connection and executing the command "uptime".
    My answer is that: 09:29:24 up 111 days, 10:04, 29 users, load average: 4.12, 4.15, 4.14

    How i can get only the number before "days" and after "up"?

    I'm trying to use a preprocessing option, but i dont know how =/

    (no, i dont know how to upload a profile picture, sorry =/ )


    Michael R. Fortes

    Linkedin: Mike Fortes
    Medium: mromeiro-f
  • AvaTTaR
    Member
    • Dec 2018
    • 96

    #2
    try use regex
    .*up ([0-9]*).*
    and in output \1 or \0 if first one will not work

    Comment

    • mfortes
      Senior Member
      • Oct 2019
      • 416

      #3
      It works perfectly for me !!!

      Thanks.


      Michael R. Fortes

      Linkedin: Mike Fortes
      Medium: mromeiro-f

      Comment

      • AvaTTaR
        Member
        • Dec 2018
        • 96

        #4
        in fact you can use just other command - for example
        uptime | cut -d' ' -f4

        I think it will be better

        Comment

        Working...