{"action":"created","issue":{"url":"https://api.github.com/repos/firehol/netdata/issues/2701","repository_url":"https://api.github.com/repos/firehol/netdata","labels_url":"https://api.github.com/repos/firehol/netdata/issues/2701/labels{/name}","comments_url":"https://api.github.com/repos/firehol/netdata/issues/2701/comments","events_url":"https://api.github.com/repos/firehol/netdata/issues/2701/events","html_url":"https://github.com/firehol/netdata/issues/2701","id":256364819,"number":2701,"title":"apcupsd missing dimensions are graphed as zero","user":{"login":"candlerb","id":44789,"avatar_url":"https://avatars2.githubusercontent.com/u/44789?v=4","gravatar_id":"","url":"https://api.github.com/users/candlerb","html_url":"https://github.com/candlerb","followers_url":"https://api.github.com/users/candlerb/followers","following_url":"https://api.github.com/users/candlerb/following{/other_user}","gists_url":"https://api.github.com/users/candlerb/gists{/gist_id}","starred_url":"https://api.github.com/users/candlerb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/candlerb/subscriptions","organizations_url":"https://api.github.com/users/candlerb/orgs","repos_url":"https://api.github.com/users/candlerb/repos","events_url":"https://api.github.com/users/candlerb/events{/privacy}","received_events_url":"https://api.github.com/users/candlerb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-09-08T20:36:40Z","updated_at":"2017-09-09T14:52:22Z","closed_at":null,"author_association":"NONE","body":"netdata automatically collects stats from apcupsd.  Woot!\r\n\r\nHowever I noticed something strange and investigated.  The metric `netdata_apcupsd_input_voltage_Volts_average` is reported with three dimensions, \"voltage\", \"min\" and \"max\".  Whilst \"voltage\" is correct, \"min\" and \"max\" are always zero.\r\n\r\n~~~\r\nroot@nuc2:~# curl -s localhost:19999/api/v1/allmetrics?format=prometheus | grep netdata_apcupsd_input_voltage\r\nnetdata_apcupsd_input_voltage_Volts_average{chart=\"apcupsd.input_voltage\",family=\"input\",dimension=\"voltage\"} 238.0000000 1504900880000\r\nnetdata_apcupsd_input_voltage_Volts_average{chart=\"apcupsd.input_voltage\",family=\"input\",dimension=\"min\"} 0.0000000 1504900880000\r\nnetdata_apcupsd_input_voltage_Volts_average{chart=\"apcupsd.input_voltage\",family=\"input\",dimension=\"max\"} 0.0000000 1504900880000\r\n~~~\r\n\r\nIt wasn't clear to me if it was netdata responsible for creating the min/max values, or the UPS.\r\n\r\nIt took me a while, but I think I've found out why.  Looking in `charts.d/apcupsd.chart.sh`, it seems to be parsing some values which my particular apcupsd doesn't return:\r\n\r\n~~~\r\n/^MINLINEV.*/           { input_voltage_min = \\$3 * 100 };\r\n/^MAXLINEV.*/           { input_voltage_max = \\$3 * 100 };\r\n~~~\r\n\r\nWhereas apcaccess shows:\r\n\r\n~~~\r\nroot@nuc2:~# apcaccess\r\nAPC      : 001,037,0937\r\nDATE     : 2017-09-08 21:05:59 +0100\r\nHOSTNAME : nuc2.example.net\r\nVERSION  : 3.14.12 (29 March 2014) debian\r\nUPSNAME  : bx700\r\nCABLE    : USB Cable\r\nDRIVER   : USB UPS Driver\r\nUPSMODE  : Stand Alone\r\nSTARTTIME: 2017-09-06 17:36:30 +0100\r\nMODEL    : Back-UPS XS 700U\r\nSTATUS   : ONLINE\r\nLINEV    : 238.0 Volts\r\nLOADPCT  : 11.0 Percent\r\nBCHARGE  : 94.0 Percent\r\nTIMELEFT : 37.6 Minutes\r\nMBATTCHG : 5 Percent\r\nMINTIMEL : 3 Minutes\r\nMAXTIME  : 0 Seconds\r\nSENSE    : Medium\r\nLOTRANS  : 140.0 Volts\r\nHITRANS  : 300.0 Volts\r\nALARMDEL : 30 Seconds\r\nBATTV    : 13.2 Volts\r\nLASTXFER : Low line voltage\r\nNUMXFERS : 3\r\nXONBATT  : 2017-09-08 20:48:03 +0100\r\nTONBATT  : 0 Seconds\r\nCUMONBATT: 300 Seconds\r\nXOFFBATT : 2017-09-08 20:50:28 +0100\r\nSELFTEST : NO\r\nSTATFLAG : 0x05000008\r\nSERIALNO : 3B1523X08653\r\nBATTDATE : 2015-06-03\r\nNOMINV   : 230 Volts\r\nNOMBATTV : 12.0 Volts\r\nNOMPOWER : 390 Watts\r\nFIRMWARE : 924.Z3 .I USB FW:Z3\r\nEND APC  : 2017-09-08 21:06:01 +0100\r\n~~~\r\n\r\nEarlier in the script it sets these values to defaults of zero, and so a timeseries with zero values is generated.\r\n\r\nSince my UPS doesn't support MINLINEV and MAXLINEV, I don't know what it's supposed to represent - are they the highest/lowest values seen, or are these thresholds?  In the latter case, maybe LOTRANS and HITRANS respectively can take their place.\r\n\r\n~~~\r\n--- usr/libexec/netdata/charts.d/apcupsd.chart.sh.orig\t2017-07-21 07:28:40.000000000 +0100\r\n+++ usr/libexec/netdata/charts.d/apcupsd.chart.sh\t2017-09-08 21:24:23.866243247 +0100\r\n@@ -107,7 +107,9 @@\r\n /^BATTV.*/\t\t{ battery_voltage = \\$3 * 100 };\r\n /^NOMBATTV.*/\t\t{ battery_voltage_nominal = \\$3 * 100 };\r\n /^LINEV.*/\t\t{ input_voltage = \\$3 * 100 };\r\n+/^LOTRANS.*/\t\t{ input_voltage_min = \\$3 * 100 };\r\n /^MINLINEV.*/\t\t{ input_voltage_min = \\$3 * 100 };\r\n+/^HITRANS.*/\t\t{ input_voltage_max = \\$3 * 100 };\r\n /^MAXLINEV.*/\t\t{ input_voltage_max = \\$3 * 100 };\r\n /^LINEFREQ.*/\t\t{ input_frequency = \\$3 * 100 };\r\n /^OUTPUTV.*/\t\t{ output_voltage = \\$3 * 100 };\r\n~~~\r\n\r\nThat works:\r\n\r\n~~~\r\n# curl -s localhost:19999/api/v1/allmetrics?format=prometheus | grep netdata_apcupsd_input_voltage\r\nnetdata_apcupsd_input_voltage_Volts_average{chart=\"apcupsd.input_voltage\",family=\"input\",dimension=\"voltage\"} 236.0000000 1504902330000\r\nnetdata_apcupsd_input_voltage_Volts_average{chart=\"apcupsd.input_voltage\",family=\"input\",dimension=\"min\"} 140.0000000 1504902330000\r\nnetdata_apcupsd_input_voltage_Volts_average{chart=\"apcupsd.input_voltage\",family=\"input\",dimension=\"max\"} 300.0000000 1504902330000\r\n~~~\r\n\r\nHowever there is a more general issue: if a particular data source is not present, would it be possible suppress the output and the chart, rather than generating a metric with a value of zero?  Perhaps the script could return a sentinel value like NULL so that no time series is generated at all, or it is treated as missing data?\r\n\r\nThere are other apcupsd metrics where I see a zero graph because there is no data: `LINEFREQ`, `OUTV`, `NOMOUTV`, `ITEMP`.  I think those would all be better as no graph."},"comment":{"url":"https://api.github.com/repos/firehol/netdata/issues/comments/328281983","html_url":"https://github.com/firehol/netdata/issues/2701#issuecomment-328281983","issue_url":"https://api.github.com/repos/firehol/netdata/issues/2701","id":328281983,"user":{"login":"ktsaou","id":2662304,"avatar_url":"https://avatars3.githubusercontent.com/u/2662304?v=4","gravatar_id":"","url":"https://api.github.com/users/ktsaou","html_url":"https://github.com/ktsaou","followers_url":"https://api.github.com/users/ktsaou/followers","following_url":"https://api.github.com/users/ktsaou/following{/other_user}","gists_url":"https://api.github.com/users/ktsaou/gists{/gist_id}","starred_url":"https://api.github.com/users/ktsaou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktsaou/subscriptions","organizations_url":"https://api.github.com/users/ktsaou/orgs","repos_url":"https://api.github.com/users/ktsaou/repos","events_url":"https://api.github.com/users/ktsaou/events{/privacy}","received_events_url":"https://api.github.com/users/ktsaou/received_events","type":"User","site_admin":false},"created_at":"2017-09-09T14:52:22Z","updated_at":"2017-09-09T14:52:22Z","author_association":"OWNER","body":"Hi,\r\n\r\naccording `apcaccess` man page: https://linux.die.net/man/8/apcaccess\r\n\r\n```\r\nMAXLINEV: Maximum input line voltage since apcupsd startup\r\nMINLINEV: Minimum input line voltage since apcupsd startup\r\nLOTRANS : Input line voltage below which UPS will switch to battery\r\nHITRANS : Input line voltage above which UPS will switch to battery\r\n```\r\n\r\nI think your UPS does not report them, so netdata just uses zeros."}}
{"actor":{"display_login":"ktsaou"}}