Ad Widget

Collapse

How to change String to Numeric ? Argument is not a numeric value.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Testicuser123
    Junior Member
    • Oct 2022
    • 12

    #1

    How to change String to Numeric ? Argument is not a numeric value.

    Hello,
    I have a little problem with calculated function with one of my items.

    Pooled oid:

    Click image for larger version

Name:	image.png
Views:	1050
Size:	9.1 KB
ID:	452784

    Calculated item:
    Click image for larger version

Name:	image.png
Views:	1029
Size:	9.9 KB
ID:	452785

    Right after testing this fomula I get response that it's not a numeric value:
    Click image for larger version

Name:	image.png
Views:	1139
Size:	6.7 KB
ID:	452786
    Click image for larger version

Name:	image.png
Views:	1018
Size:	3.4 KB
ID:	452788
    But it looks like it is:
    Click image for larger version

Name:	image.png
Views:	1155
Size:	4.9 KB
ID:	452787

    Any idea how to solve this problem?​

    ​​How can i change this value from string to Numeric?
  • Bartosz Mickiewicz
    Junior Member
    • Oct 2022
    • 27

    #2
    Hi,
    Can you show preprocessing steps?
    You could use JavaScript and put in "return parseInt(value)" and then test and see if it works.

    Comment

    • Testicuser123
      Junior Member
      • Oct 2022
      • 12

      #3
      Originally posted by Aigars Kadikis
      Hi,
      Can you show preprocessing steps?
      You could use JavaScript and put in "return parseInt(value)" and then test and see if it works.
      Hi, thanks for your reply. I don't have anything in preprocess. I've tried to use that and the value on currentusagepowervaluetest showed correct value:
      Click image for larger version

Name:	image.png
Views:	1020
Size:	3.4 KB
ID:	452794
      but...
      1kwh item still not working as I want:
      Click image for larger version

Name:	image.png
Views:	1021
Size:	6.5 KB
ID:	452795

      Comment

      • cyber
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Dec 2006
        • 4807

        #4
        That syntax doesn't add up...
        function(/host/key,<parameter1>,<parameter2>,...)

        so if iti is directly on host it should be "avg(/hostname/currentusagepowervaluetest,3600)/1000" I think. Skip hostname, if added through template."avg(//currentusagepowervaluetest,3600)/1000"

        Comment

        • Testicuser123
          Junior Member
          • Oct 2022
          • 12

          #5
          Originally posted by cyber
          That syntax doesn't add up...
          function(/host/key,<parameter1>,<parameter2>,...)

          so if iti is directly on host it should be "avg(/hostname/currentusagepowervaluetest,3600)/1000" I think. Skip hostname, if added through template."avg(//currentusagepowervaluetest,3600)/1000"
          I've found this solution on reddit first link in google : Monitoring Power usage with Zabbix and Grafana


          After applying your configuration to my template :
          Click image for larger version

Name:	image.png
Views:	1010
Size:	10.3 KB
ID:	452836


          I've got this error:
          Click image for larger version

Name:	image.png
Views:	1004
Size:	10.1 KB
ID:	452837
          But, there is a item called currentusagepowervaluetest.​

          Click image for larger version

Name:	image.png
Views:	1026
Size:	8.9 KB
ID:	452835

          Any idea?

          Thanks in advance​

          Comment

          • cyber
            Senior Member
            Zabbix Certified SpecialistZabbix Certified Professional
            • Dec 2006
            • 4807

            #6
            You are pressing "Test" when you are editing template.. it cannot go and pull data, ... Go to the host directly, find that calculated item and try there (click on item, so it opens and find test there) ... you should get the value from host directly.

            Comment

            • Testicuser123
              Junior Member
              • Oct 2022
              • 12

              #7
              Originally posted by cyber
              You are pressing "Test" when you are editing template.. it cannot go and pull data, ... Go to the host directly, find that calculated item and try there (click on item, so it opens and find test there) ... you should get the value from host directly.
              Oh my... You're the boss! Huge thanks to you

              Comment

              Working...