Open SCH48 opened 4 years ago
Hey @SCH48, thanks your time!
I will analyze this case soon.
Problem in param "history" = "0" and Zabbix Printer Template collecting data into the database as a "numeric float".
I change in Template "float" to "unsigned"
Testing 2 printers with different templates but same OID "page count" ....
$PrintersInGroups = Get-ZabbixHost -Groups 'Network Printers' -HostStatus 0
$PrintersInGroups| ft hostid, host
$OID = "1.3.6.1.2.1.43.10.2.1.4.1.1"
$ItemsOID = Get-ZabbixItem -Hosts $PrintersInGroups | ?{$_.snmp_oid -contains $OID}
$ItemsOID | ft hostid, itemid, snmp_oid, name, lastclock, lastvalue
First, testing the correct "itemid=30461"
Get-ZabbixHistory -limit 5 -Items "30461" | ft
Default "history" is 3 - "numeric unsigned", All right.
Now check the problem data - "itemid=30441"
Get-ZabbixHistory -limit 5 -Items "30441" | ft
Oh, great! But One record? Check "numeric float" data add "-hystory 0":
Get-ZabbixHistory -limit 5 -Items "30441" -history 0 | ft
Nothing changed :-(
Test Simple code:
$params.body = @{
"jsonrpc"= "2.0"
"method" = "history.get"
"params"= @{
"output" = "extend"
"itemids" = "30441"
"sortfield" = "clock"
"sortorder" ="DESC"
"limit" = 10
}
auth = ($result.Content | ConvertFrom-Json).result
id = 1
} | ConvertTo-Json
$result = (Invoke-WebRequest @params).Content | ConvertFrom-Json
$result.result | ft
Also one record. It's the record I translated in "numeric unsigned". But the rest of the entries remained in the "numeric float". Check
$params.body = @{
"jsonrpc"= "2.0"
"method" = "history.get"
"params"= @{
"output" = "extend"
"history" = "0"
"itemids" = "30441"
"sortfield" = "clock"
"sortorder" ="DESC"
"limit" = 10
}
auth = ($result.Content | ConvertFrom-Json).result
id = 1
} | ConvertTo-Json
Yes they exist!!!
I understand that I need to convert all the data to one format.
But Why does not it work Get-ZabbixHistory -history 0
?
And is it possible to convert data in the "Get-Zabbix History" command without use the "history" parameter? Ore least a number format lead one to another?
Sorry for my English, I'm Russian. Regards, @SCH48
Hi @SCH48 , sorry the delay. I will review this soon.
Thank you very much for your analysis efforts. Once again, apologies for the years-long delay. I will investigate what you have put together and see if it still makes sense for corrections
Hi! I'm trying to get history
Auth-Zabbix -URL 'http://10.248.10.148/zabbix'
Get-ZabbixHistory -history 0 -Hosts $Printer -Items $Item -limit 100
= Empty output :-( But simple code work!
Originally posted by @SCH48 in https://github.com/rrg92/power-zabbix/issues/2#issuecomment-635899091