master
md 230 lines 6.5 KB
Rendered Raw
1 <!--startmeta
2 custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/collectors/python.d.plugin/am2320/README.md"
3 meta_yaml: "https://github.com/netdata/netdata/edit/master/src/collectors/python.d.plugin/am2320/metadata.yaml"
4 sidebar_label: "AM2320"
5 learn_status: "Published"
6 learn_rel_path: "Collecting Metrics/Collectors/Hardware and Sensors"
7 keywords: ['temperature', 'am2320', 'sensor', 'humidity']
8 message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE"
9 endmeta-->
10
11 # AM2320
12
13
14 <img src="https://netdata.cloud/img/microchip.svg" width="150"/>
15
16
17 Plugin: python.d.plugin
18 Module: am2320
19
20 <img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" />
21
22 ## Overview
23
24 This collector monitors AM2320 sensor metrics about temperature and humidity.
25
26 It retrieves temperature and humidity values by contacting an AM2320 sensor over i2c.
27
28 This collector is supported on all platforms.
29
30 This collector only supports collecting metrics from a single instance of this integration.
31
32
33 ### Default Behavior
34
35 #### Auto-Detection
36
37 Assuming prerequisites are met, the collector will try to connect to the sensor via i2c
38
39 #### Limits
40
41 The default configuration for this integration does not impose any limits on data collection.
42
43 #### Performance Impact
44
45 The default configuration for this integration is not expected to impose a significant performance impact on the system.
46
47 ## Setup
48
49
50 ### Prerequisites
51
52 #### Sensor connection to a Raspberry Pi
53
54 Connect the am2320 to the Raspberry Pi I2C pins
55
56 Raspberry Pi 3B/4 Pins:
57
58 - Board 3.3V (pin 1) to sensor VIN (pin 1)
59 - Board SDA (pin 3) to sensor SDA (pin 2)
60 - Board GND (pin 6) to sensor GND (pin 3)
61 - Board SCL (pin 5) to sensor SCL (pin 4)
62
63 You may also need to add two I2C pullup resistors if your board does not already have them. The Raspberry Pi does have internal pullup resistors but it doesn't hurt to add them anyway. You can use 2.2K - 10K but we will just use 10K. The resistors go from VDD to SCL and SDA each.
64
65
66 #### Software requirements
67
68 Install the Adafruit Circuit Python AM2320 library:
69
70 `sudo pip3 install adafruit-circuitpython-am2320`
71
72
73
74 ### Configuration
75
76 #### Options
77
78 There are 2 sections:
79
80 * Global variables
81 * One or more JOBS that can define multiple different instances to monitor.
82
83 The following options can be defined globally: priority, penalty, autodetection_retry, update_every, but can also be defined per JOB to override the global values.
84
85 Additionally, the following collapsed table contains all the options that can be configured inside a JOB definition.
86
87 Every configuration JOB starts with a `job_name` value which will appear in the dashboard, unless a `name` parameter is specified.
88
89
90 <details open><summary>Config options</summary>
91
92
93
94 | Option | Description | Default | Required |
95 |:-----|:------------|:--------|:---------:|
96 | update_every | Sets the default data collection frequency. | 5 | no |
97 | priority | Controls the order of charts at the netdata dashboard. | 60000 | no |
98 | autodetection_retry | Sets the job re-check interval in seconds. | 0 | no |
99 | penalty | Indicates whether to apply penalty to update_every in case of failures. | yes | no |
100 | name | Job name. This value will overwrite the `job_name` value. JOBS with the same name are mutually exclusive. Only one of them will be allowed running at any time. This allows autodetection to try several alternatives and pick the one that works. | | no |
101
102
103 </details>
104
105
106
107 #### via File
108
109 The configuration file name for this integration is `python.d/am2320.conf`.
110
111 The file format is YAML. Generally, the structure is:
112
113 ```yaml
114 update_every: 1
115 autodetection_retry: 0
116
117 job_name:
118 job_option1: some_value
119 job_option2: some_other_vlaue
120 ```
121 You can edit the configuration file using the [`edit-config`](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#edit-configuration-files) script from the
122 Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#locate-your-config-directory).
123
124 ```bash
125 cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
126 sudo ./edit-config python.d/am2320.conf
127 ```
128
129 ##### Examples
130
131 ###### Local sensor
132
133 A basic JOB configuration
134
135 ```yaml
136 local_sensor:
137 name: 'Local AM2320'
138
139 ```
140
141
142 ## Alerts
143
144 There are no alerts configured by default for this integration.
145
146
147 ## Metrics
148
149 Metrics grouped by *scope*.
150
151 The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels.
152
153
154
155 ### Per AM2320 instance
156
157 These metrics refer to the entire monitored application.
158
159 This scope has no labels.
160
161 Metrics:
162
163 | Metric | Dimensions | Unit |
164 |:------|:----------|:----|
165 | am2320.temperature | temperature | celsius |
166 | am2320.humidity | humidity | percentage |
167
168
169
170 ## Troubleshooting
171
172 ### Debug Mode
173
174
175 To troubleshoot issues with the `am2320` collector, run the `python.d.plugin` with the debug option enabled. The output
176 should give you clues as to why the collector isn't working.
177
178 - Navigate to the `plugins.d` directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on
179 your system, open `netdata.conf` and look for the `plugins` setting under `[directories]`.
180
181 ```bash
182 cd /usr/libexec/netdata/plugins.d/
183 ```
184
185 - Switch to the `netdata` user.
186
187 ```bash
188 sudo -u netdata -s
189 ```
190
191 - Run the `python.d.plugin` to debug the collector:
192
193 ```bash
194 ./python.d.plugin am2320 debug trace
195 ```
196
197 ### Getting Logs
198
199 If you're encountering problems with the `am2320` collector, follow these steps to retrieve logs and identify potential issues:
200
201 - **Run the command** specific to your system (systemd, non-systemd, or Docker container).
202 - **Examine the output** for any warnings or error messages that might indicate issues. These messages should provide clues about the root cause of the problem.
203
204 #### System with systemd
205
206 Use the following command to view logs generated since the last Netdata service restart:
207
208 ```bash
209 journalctl _SYSTEMD_INVOCATION_ID="$(systemctl show --value --property=InvocationID netdata)" --namespace=netdata --grep am2320
210 ```
211
212 #### System without systemd
213
214 Locate the collector log file, typically at `/var/log/netdata/collector.log`, and use `grep` to filter for collector's name:
215
216 ```bash
217 grep am2320 /var/log/netdata/collector.log
218 ```
219
220 **Note**: This method shows logs from all restarts. Focus on the **latest entries** for troubleshooting current issues.
221
222 #### Docker Container
223
224 If your Netdata runs in a Docker container named "netdata" (replace if different), use this command:
225
226 ```bash
227 docker logs netdata 2>&1 | grep am2320
228 ```
229
230