dinger1986 / TRMM-Grafana

Grafana Dashboards setup and preconfigured to work with Tactical RMM
30 stars 17 forks source link

CPU/Memory/Disk usage graphs on T-RMM Agent Dashboard don't populate through Automation Policy #18

Closed ventra007 closed 2 years ago

ventra007 commented 2 years ago

Hi,

17

I must mention that I ran into this issue as well. My problem though was that the CPU and Memory checks was configured through an automation policy that applied it, and these are not pulling through. Only when I add the check manually does it appear.

ninjamonkey198206 commented 2 years ago

I'll check on this, but I'm fairly certain I've tested both ways. Do you know which T-RMM version this was on?

ventra007 commented 2 years ago

I'll check on this, but I'm fairly certain I've tested both ways. Do you know which T-RMM version this was on?

Hi, I'm using v0.13.4 currently.

ventra007 commented 2 years ago

Hello,

Any progress on the investigation?

ninjamonkey198206 commented 2 years ago

Sorry, not yet. Got caught up with other projects, but I'll try to take a look tonight.

ninjamonkey198206 commented 2 years ago

Confirmed. That's odd...

Zebble commented 2 years ago

The problem seems to be that the "agent_id" field in checks_check is blank. The TacticalRMM GUI is able to show historical data so I'm not sure how it's linking that in. Still digging...

Zebble commented 2 years ago

Appears the queries could be changed to leverage agent_id instead of just the id. Found another problem along the way though. The Grafana queries seem to assume that the hostname is unique across all of TacticalRMM. This isn't necessarily true if you're using it in a multi-tenant environment.

I can help with fixing if you need the help. Just let me know!

ventra007 commented 2 years ago

I certainly require the help please 😄

Zebble commented 2 years ago

I think I've fixed the 3 graphs and also fixed the windows update status after the has_pending_updates field was removed from TRMM.

Pull request: https://github.com/dinger1986/TRMM-Grafana/pull/19

I didn't fix the unique agent hostname issue as that's a larger issue. I'll open a seperate issue for that one.

WolfgangZA commented 2 years ago

Hi Zebble, Thanks when can we expect this fix? I am having the same issue

Zebble commented 2 years ago

We'll have to wait for @dinger1986 to accept the pull request, or you can grab the modified JSON directly from the pull request (linked above).

WolfgangZA commented 2 years ago

Legend!. Managed to get my reports working, Thanks Zebble

ninjamonkey198206 commented 2 years ago

Thank you for looking into that. I know Dinger has been busy, and my house got hit by the 'rona, so I haven't been getting much done. I'll take a look at this later today.

Any help is appreciated.

WolfgangZA commented 2 years ago

I found an error Zebble. Surely the memory check shouldnt be CPULOAD as shown down here? SELECT x AS "time", y as "Memory Usage" FROM checks_checkhistory, checks_check, agents_agent WHERE checks_checkhistory.agent_id=agents_agent.agent_id AND checks_checkhistory.check_id=checks_check.id AND agents_agent.hostname = '$Agents_HostName' AND checks_check.check_type='cpuload' AND x BETWEEN $timeFrom() and $timeTo() ORDER BY x

Line 576 on pull request

Should be SELECT x AS "time", y as "Memory Usage" FROM checks_checkhistory, checks_check, agents_agent WHERE checks_checkhistory.agent_id=agents_agent.agent_id AND checks_checkhistory.check_id=checks_check.id AND agents_agent.hostname = '$Agents_HostName' AND checks_check.check_type='Memory' AND x BETWEEN $timeFrom() and $timeTo() ORDER BY x

ventra007 commented 2 years ago

These work for me as per the changes you made: CPU

SELECT x AS "time", y as "CPU Load" FROM checks_checkhistory, checks_check, agents_agent WHERE checks_checkhistory.agent_id=agents_agent.agent_id AND checks_checkhistory.check_id=checks_check.id AND agents_agent.hostname='$Agent' AND checks_check.check_type='cpuload' AND x BETWEEN $__timeFrom() and $__timeTo() ORDER BY x

Memory

SELECT x AS "time", y as "Memory Usage" FROM checks_checkhistory, checks_check, agents_agent WHERE checks_checkhistory.agent_id=agents_agent.agent_id AND checks_checkhistory.check_id=checks_check.id AND agents_agent.hostname='$Agent' AND checks_check.check_type='memory' AND x BETWEEN $__timeFrom() and $__timeTo() ORDER BY x

Thank you very much 😄

Zebble commented 2 years ago

Whoops! I must have re-copied the wrong query. Let me change that in the pull request. Should be done in a few minutes…

I found an error Zebble. Surely the memory check shouldnt be CPULOAD as shown down here? SELECT x AS "time", y as "Memory Usage" FROM checks_checkhistory, checks_check, agents_agent WHERE checks_checkhistory.agent_id=agents_agent.agent_id AND checks_checkhistory.check_id=checks_check.id AND agents_agent.hostname = '$Agents_HostName' AND checks_check.check_type='cpuload' AND x BETWEEN $timeFrom() and $timeTo() ORDER BY x

Zebble commented 2 years ago

Fixed the cpuload/memory issue. Thanks for catching that @WolfgangZA. Added a new commit in the same pull request.

WolfgangZA commented 2 years ago

Fixed the cpuload/memory issue. Thanks for catching that @WolfgangZA. Added a new commit in the same pull request.

No problem @Zebble

ventra007 commented 2 years ago

Thank you everyone. I'll close this and wait for the pull request to be approved. I'll just manually enter these values for now.