Monitoring Azure resources with Zabbix

Comments  

Kingsley
# zabbix monitor from on-prem to cloudKingsley 2018-08-07 17:56
Is it possible to monitor azure resources (i.e server VMs) from on premises zabbix server
Reply | Reply with quote | Quote
Super User
# RE: zabbix monitor from on-prem to cloudSuper User 2018-08-10 16:25
Quoting Kingsley:
Is it possible to monitor azure resources (i.e server VMs) from on premises zabbix server


Hi!

Yep, it's possible, there is no any difference.
Reply | Reply with quote | Quote
Dragan Vucanovic
# Problem with running scripDragan Vucanovic 2018-08-08 20:37
Powershell script runs fine on Windows but on zabbbix server no results, only get {"data":}, and how did you manage to run sh script, just replaced ps1 with sh, i tried it but got bunch of errors, installed powershell following this guide:https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-powershell-core-on-linux?view=powershell-6
Reply | Reply with quote | Quote
Super User
# RE: Problem with running scripSuper User 2018-08-10 16:33
Quoting Dragan Vucanovic:
Powershell script runs fine on Windows but on zabbbix server no results, only get {"data":}, and how did you manage to run sh script, just replaced ps1 with sh, i tried it but got bunch of errors, installed powershell following this guide:https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-powershell-core-on-linux?view=powershell-6


Hi!

I believe you're talking about discovery script...

1. I think the problem, when script's working on Windows, but not on Linux, is somewhere around 56 and 66 strings:
$sql_servers = (Invoke-RestMethod -Uri $uri -Headers $azure_header -Method Get -ErrorAction Stop).content.properties;

I've faced some issues and played with data returned from API - for some reason there were no "content.properties" - just echo $sql_servers and check if you're getting correct data.

2.
How to run ps1 from sh:

pwsh /usr/lib/zabbix/externalscripts/azure.discovery.sql.databases.ps1 $1 $2
Reply | Reply with quote | Quote
Dragan Vucanovic
# RE: Problem with running scripDragan Vucanovic 2018-08-11 20:40
yes, when testing on windows had to replace content.properties with Value, and when pasted it on Linux forgot to revert it back, all works now
Reply | Reply with quote | Quote
Dragan Vucanovic
# RE: Problem with running scriptsDragan Vucanovic 2018-08-20 22:10
i created multiple scripts (for multiple services) and getting "Value Should be JSON object"
Reply | Reply with quote | Quote
Super User
# RE: Problem with running scriptsSuper User 2018-08-21 11:24
Quoting Dragan Vucanovic:
i created multiple scripts (for multiple services) and getting "Value Should be JSON object"


Could you please run script manually and provide output?
Reply | Reply with quote | Quote
Dragan Vucanovic
# RE: Problem with running scriptsDragan Vucanovic 2018-08-21 15:09
Fixed it: the issue was that when Azure token expires (after 60 minutes), new one couldn't be created because zabbix user had no right to write to azure.json file, once i gave ownership to zabbix user over that file-issue was solved. Manually running scripts gives desired output,it took me few hours to figure out what was the problem. When found out (after googling) that Azure token expires after 60 minutes then i had a clue what could have been an issue. Thank you for quick response.
Reply | Reply with quote | Quote
Super User
# RE: Problem with running scriptsSuper User 2018-08-21 15:45
Quoting Dragan Vucanovic:
Fixed it: the issue was that when Azure token expires (after 60 minutes), new one couldn't be created because zabbix user had no right to write to azure.json file, once i gave ownership to zabbix user over that file-issue was solved. Manually running scripts gives desired output,it took me few hours to figure out what was the problem. When found out (after googling) that Azure token expires after 60 minutes then i had a clue what could have been an issue. Thank you for quick response.


Yeah, I've closed public comments because of tons of spam coming ... ;(
So reviewing them manually.

I'll update article to point you guys to verify linux permissions on files.
Reply | Reply with quote | Quote
Guig
# Problem with running scripts again...Guig 2018-11-13 01:35
I
I have the same issue than Dragan,
when i link the template to the host, the discovry rules is on error, with the info : Value should be a JSON object.
if i run the .sh i have a valid json, the token is renewed automatically each hour on azure.json...
Reply | Reply with quote | Quote
Super User
# RE: Problem with running scripts again...Super User 2018-11-15 15:15
Quoting Guig:
I
I have the same issue than Dragan,
when i link the template to the host, the discovry rules is on error, with the info : Value should be a JSON object.
if i run the .sh i have a valid json, the token is renewed automatically each hour on azure.json...


Hi Guig!

Please remember that you're running .sh script under your user account which might have permissions to write file to the disk.

However, zabbix-server running this script under 'zabbix' user which might not have permissions. Please check the working folder - 'zabbix' user should have 777 or 466 ... something like that.
Reply | Reply with quote | Quote
stban
# Problem with pulling metricsstban 2018-09-07 16:37
Hi guys,
i'm able to discover Zabbix item, t works.
But i'm stuck with the pulling metrics script.
it doesn't create the export file.
If i show $host_item variable, it's empty.

I launch manually the script with:
pwsh azure.monitor.metrics.ps1 HOSTNAME
HOSTNAME is the zabbix hostname of my server who own the item discovered (like windowsDB1)

is it ok?
Reply | Reply with quote | Quote
Super User
# RE: Problem with pulling metricsSuper User 2018-09-10 13:05
Quoting stban:
Hi guys,
i'm able to discover Zabbix item, t works.
But i'm stuck with the pulling metrics script.
it doesn't create the export file.
If i show $host_item variable, it's empty.

I launch manually the script with:
pwsh azure.monitor.metrics.ps1 HOSTNAME
HOSTNAME is the zabbix hostname of my server who own the item discovered (like windowsDB1)

is it ok?


Hi!

Yep, looks like you're running your script in proper way.

What can I suggest - is that you run script in debug mode (windows or linux - doesn't matter) and check if you have issues while pulling 'items' from Zabbix - and I believe you will have.

Only one issue I've faced during development - certificate assigned to Zabbix Server front-end was not valid for me.
Reply | Reply with quote | Quote
stban
# RE: Problem with pulling metricsstban 2018-09-26 16:51
It's working, user who import the files needs to be super admin in zabbix :)
Reply | Reply with quote | Quote

Add comment


Security code
Refresh