Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Add network throughput #11

Closed
MisfitPunisher opened this issue Apr 11, 2022 · 13 comments
Closed

[Feature] Add network throughput #11

MisfitPunisher opened this issue Apr 11, 2022 · 13 comments
Labels
enhancement New feature or request planned To be implemented in future release

Comments

@MisfitPunisher
Copy link

MisfitPunisher commented Apr 11, 2022

Hi friends!

I use trueNas since it was named freenas. I build my own interface based on SNMP to keep it clear at my HA. Yours is Great!!
Mine just report some basic information, but please check it out cause its different and gives additional information, and can be useful for more friends like us.

Thank you all for your job! I add today your integration at my HA, and will keep both methods working for some time.

My interface gives me some valid information, than yours still does not do. I list it here to give you some Ideas!

HOSTNAME

  • platform: snmp
    name: "Temido Name"
    host: !secret temido_ip
    baseoid: 1.3.6.1.2.1.1.5.0
    community: !secret snmpcom
    version: "2c"
    scan_interval: 86400

DESCRIPTION

  • platform: snmp
    name: "Temido Descript"
    host: !secret temido_ip
    baseoid: 1.3.6.1.2.1.1.1.0
    community: !secret snmpcom
    version: "2c"
    scan_interval: 86400

CONTACT

  • platform: snmp
    name: "Temido Contact"
    host: !secret temido_ip
    baseoid: 1.3.6.1.2.1.1.4.0
    community: !secret snmpcom
    version: "2c"
    scan_interval: 86400

LOCATION

  • platform: snmp
    name: "Temido Location"
    host: !secret temido_ip
    baseoid: 1.3.6.1.2.1.1.6.0
    community: !secret snmpcom
    version: "2c"
    scan_interval: 86400

USERS

  • platform: snmp
    name: "Temido concurrent users"
    host: !secret temido_ip
    baseoid: .1.3.6.1.2.1.25.1.5.0
    community: !secret snmpcom
    version: "2c"
    scan_interval: 150

SSH LOGINS

  • platform: snmp
    name: "Temido W"
    host: !secret temido_ip
    community: !secret snmpcom
    version: "2c"
    baseoid: .1.3.6.1.2.1.25.1.21
    scan_interval: 300

Number of process

  • platform: snmp
    name: "Temido CPU process"
    host: !secret temido_ip
    baseoid: .1.3.6.1.2.1.25.1.6.0
    value_template: "{{(value)}}"
    community: !secret snmpcom
    version: "2c"
    scan_interval: 30

DETAILED UPTIME

  • platform: snmp
    host: !secret temido_ip
    community: !secret snmpcom
    version: "2c"
    baseoid: .1.3.6.1.2.1.25.1.1.0
    name: TEMIDO Uptime
    scan_interval: 60
    value_template: >-
    {% set timetick = value | int %}
    {% set minutes = ((timetick % 360000) / 6000) | int%}
    {% set hours = ((timetick % 8640000) / 360000) | int %}
    {% set days = (timetick / 8640000) | int %}
    {%- if timetick < 6000 -%}
    Less than a minute
    {%- else -%}
    {%- if days > 0 -%}
    {%- if days == 1 -%}
    1 day
    {%- else -%}
    {{ days }} days
    {%- endif -%}
    {%- endif -%}
    {%- if hours > 0 -%}
    {%- if days > 0 -%}
    {{ ', ' }}
    {%- endif -%}
    {%- if hours == 1 -%}
    1 hr
    {%- else -%}
    {{ hours }} hrs
    {%- endif -%}
    {%- endif -%}
    {%- if minutes > 0 -%}
    {%- if days > 0 or hours > 0 -%}
    {{ ', ' }}
    {%- endif -%}
    {%- if minutes == 1 -%}
    1 min
    {%- else -%}
    {{ minutes }} min
    {%- endif -%}
    {%- endif -%}
    {%- endif -%}

ETH IN and OUT NETWORK SPEED

  • platform: snmp
    name: 'Temido Eth In'
    host: !secret temido_ip
    baseoid: 1.3.6.1.2.1.31.1.1.1.6.1
    #baseoid: 1.3.6.1.2.1.2.2.1.10.1
    community: !secret snmpcom
    version: '2c'

  • platform: snmp
    name: 'Temido Eth Out'
    host: !secret temido_ip
    baseoid: 1.3.6.1.2.1.31.1.1.1.10.1
    community: !secret snmpcom
    version: '2c'

  • platform: derivative
    name: 'Temido Eth In Stats'
    source: sensor.temido_eth_in
    unit_time: s
    unit: B

  • platform: derivative
    name: 'Temido Eth Out Stats'
    source: sensor.temido_eth_out
    unit_time: s
    unit: B

  • platform: template
    sensors:
    temido_eth_in_mbps:
    value_template: "{{ [((states('sensor.temido_eth_in_stats')|float(none))/1000000)|round(2, default=none),0]|max }}"
    unit_of_measurement: 'MBps'
    temido_eth_out_mbps:
    value_template: "{{ [((states('sensor.temido_eth_out_stats')|float(none))/1000000)|round(2, default=none),0]|max }}"
    unit_of_measurement: 'MBps'_

I let you here some screenshoots!

Best regards, and thank you all!

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

Captura de pantalla 2022-04-11 a les 6 51 32
Captura de pantalla 2022-04-11 a les 6 51 54
Captura de pantalla 2022-04-11 a les 6 52 10

Describe alternatives you've considered

Additional context

@MisfitPunisher MisfitPunisher added the enhancement New feature or request label Apr 11, 2022
@tomaae
Copy link
Owner

tomaae commented Apr 11, 2022

Nice work.
I'm using API, so information I get is limited to that of course.
I will look into network, not sure why I didnt added that, could have been some issue. HACS approval took a month, so I dont really remember.
Uptime is available in HA standard, if you need something special, you can transform it into any format using HA templating system.
SSH related is OS stuff, its not NAS related. I dont think I would even find that in API.
Not sure about other stuff, its mostly static information which is available. But as a sensor would not make much sense for HA.

@MisfitPunisher
Copy link
Author

MisfitPunisher commented Apr 11, 2022 via email

@tomaae tomaae added the planned To be implemented in future release label Apr 11, 2022
@tomaae
Copy link
Owner

tomaae commented Apr 11, 2022

Yea, SSH is not something usually required, but if you need that, you still need to use SNMP.
I will look into adding network throughput. It should be possible.

PS: you mention something about SMB in title. what are you missing?

@tomaae tomaae changed the title [SSH/SMB/Hostname/NIC speed and some more stuff] [Feature] Add network throughput Apr 12, 2022
@MisfitPunisher
Copy link
Author

MisfitPunisher commented Apr 12, 2022 via email

@tomaae
Copy link
Owner

tomaae commented Apr 12, 2022

yes, there would be one unrelated thing. I see you are using ZRAID. is there anything that needs to be monitored on ZRAID and is available in TrueNAS?
I never touched ZRAID since I build my NAS for best performance (stripped mirror ssd drives), so I have no idea what is important there.

@MisfitPunisher
Copy link
Author

MisfitPunisher commented Apr 12, 2022 via email

@tomaae
Copy link
Owner

tomaae commented Apr 12, 2022

With RAIDZ2 you can lose only 1 drive tho.
There are already pool status sensors. That should tell you if there is problem with any drive in pool as downgraded status. Not sure if drives needs them separatly in HA as warning should be handled by pool sensor.
Scrub status and progress is already available
How is zpool clear presented in GUI?
Not sure I can get memory details from api, will have to look.
There are bunch of examples how to template new uptime sensor on HA forums. Its same with all standard HA uptime sensors.

@MisfitPunisher
Copy link
Author

Hi friend!

Im trying to fix the timestamp issue and covert it to readable text, and I cannot the right performance of any example. Can you helpme?

I've been seeing all the attributes on HA truenas sensors. Awesome!
About the zpool clear. Is just a console command (root), no UI (just zpool clear my_pool )

@tomaae
Copy link
Owner

tomaae commented Apr 12, 2022

If it is not in UI, its unlikely to be accessible using API.

Not sure what you need to do with uptime sensor. Got these 2 types from HA forums:

{{ as_timestamp(states.sensor.truenas_uptime.state) | timestamp_custom(' %Y-%m-%d %I:%M:%S %p ') }}
{%- set time = (as_timestamp(now()) - as_timestamp(states.sensor.truenas_uptime.state)) | int  %}
{%- set minutes = ((time % 3600) // 60) %}
{%- set minutes = '{}minutes'.format(minutes) if minutes > 0 else '' %}
{%- set hours = ((time % 86400) // 3600) %}
{%- set hours = '{}hours '.format(hours) if hours > 0 else '' %}
{%- set days = (time // 86400) %}
{%- set days = '{}days '.format(days) if days > 0 else '' %}
{{ 'Less than 1 minute' if time < 60 else days + hours + minutes }} ago

You can find many more there.

@MisfitPunisher
Copy link
Author

MisfitPunisher commented Apr 13, 2022 via email

@tomaae
Copy link
Owner

tomaae commented Apr 13, 2022

If I understood it right, this is what you are looking for:

{{ state_attr('binary_sensor.truenas_boot_pool_healthy', 'Scrub secs left') }}

@MisfitPunisher
Copy link
Author

MisfitPunisher commented Apr 13, 2022 via email

@tomaae
Copy link
Owner

tomaae commented Apr 14, 2022

mailing this is not a good idea. that does not take to formatting nicely :)

@tomaae tomaae closed this as completed in 71a6512 Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request planned To be implemented in future release
Projects
None yet
Development

No branches or pull requests

2 participants