NUTSCAN_SCAN_SNMP(3)
π NUTSCAN_SCAN_SNMP β the SNMP scanner page, bestie edition π
okay so this is NUTSCAN_SCAN_SNMP(3), a page from the NUT manual, and it's literally all about sniffing out SNMP devices on your network. sit down, grab a strawberry π, we're doing this.
β¨ NAME β¨
nutscan_scan_snmp β scan the network for SNMP devices. that's it, that's the whole vibe. π¦
β¨ SYNOPSIS β¨
#include <nut-scan.h>
#include <unistd.h> /* useconds_t */
nutscan_device_t * nutscan_scan_snmp(
const char * start_ip,
const char * stop_ip,
useconds_t timeout,
nutscan_snmp_t * sec);
nutscan_device_t * nutscan_scan_ip_range_snmp(
nutscan_ip_range_list_t * irl,
useconds_t usec_timeout,
nutscan_snmp_t * sec);
β¨ DESCRIPTION β¨
so nutscan_scan_snmp() and nutscan_scan_ip_range_snmp() are the two besties here, and their whole job is trying to detect NUT-compatible SNMP devices. π
nutscan_scan_snmp() does the classic thing: it throws SNMP queries at every single IP from start_ip all the way to stop_ip. and listen β startIP is mandatory, stopIP is optional. if stopIP is NULL, it just scans that one single startIP address. lowkey efficient. π
nutscan_scan_ip_range_snmp() is the one with main character energy: it can walk several IP address ranges, all represented by a nutscan_ip_range_list_t structure. slay. π
those IP arguments can be either IPv4 or IPv6 addresses, or host names. no cap.
ok important β you MUST call nutscan_init(3) before using this function. like, actually must. it's giving prerequisite. π
this function waits up to timeout microseconds before deciding that an IP address just isn't answering the SNMP queries. (microseconds!! not milliseconds, not seconds. respect the units. π)
and you have to pass it a valid nutscan_snmp_t structure. non-negotiable, fr fr.
the nutscan_snmp_t structure has these members, and you gotta fill them in like this:
char * 'community';
char * 'secLevel';
char * 'secName';
char * 'authPassword';
char * 'privPassword';
char * 'authProtocol';
char * 'privProtocol';
okay now the rules, and there are rules:
- if
communityis notNULL, then SNMP v1 requests get sent using that community. - if
communityisNULLandsecLevelisNULL, then SNMP v1 is selected andcommunitygets set to"public". (default queen behavior β¨) - in all the other cases, SNMP v3 is used.
secLevelcan be one ofSNMP_SEC_LEVEL_NOAUTH,SNMP_SEC_LEVEL_AUTHNOPRIVorSNMP_SEC_LEVEL_AUTHPRIV.secNameis the security name and it must be nonNULL. - if
secLevelis set toSNMP_SEC_LEVEL_AUTHNOPRIV, thenauthPasswordmust be nonNULL. - if
secLevelis set toSNMP_SEC_LEVEL_AUTHPRIV, then bothauthPasswordandprivPasswordmust be nonNULL. - if
authProtocolisNULL, the MD5 protocol is used. otherwise you can setauthProtocolto either"MD5"or"SHA". - if
privProtocolisNULL, the DES protocol is used. otherwise you can setprivProtocolto either"AES"or"DES".
and then there's peername and handle β those two are used internally, so you do not need to initialize them. leave them alone, they're doing their own thing. π§
β¨ RETURN VALUE β¨
nutscan_scan_snmp() returns a pointer to a nutscan_device_t structure holding all the found devices π β or NULL if an error happens or if literally no device is found. π
β¨ SEE ALSO β¨
the whole friend group, in order, no one left out:
nutscan_init(3), nutscan_scan_usb(3), nutscan_scan_xml_http_range(3), nutscan_scan_nut(3), nutscan_scan_avahi(3), nutscan_scan_ipmi(3), nutscan_display_sanity_check(3), nutscan_display_sanity_check_serial(3), nutscan_display_ups_conf_with_sanity_check(3), nutscan_display_ups_conf(3), nutscan_display_parsable(3), nutscan_new_device(3), nutscan_free_device(3), nutscan_add_option_to_device(3), nutscan_add_device_to_device(3), nutscan_scan_eaton_serial(3), nutscan_init_ip_ranges(3), nutscan_free_ip_ranges(3), nutscan_add_ip_range(3), nutscan_cidr_to_ip(3)
and that's the page!! ππ this one came to you from Network UPS Tools 2.8.5, dated 10/07/2026 β go forth and scan, bestie, you've got this π«Άβ¨π
π¦ where this page comes from
- fedora 43: nut-devel 2.8.5-9.fc43 Β· GPL-2.0-or-later AND GPL-3.0-or-later
- fedora 43: nut-devel 2.8.5-9.fc43 Β· GPL-2.0-or-later AND GPL-3.0-or-later
- fedora 44: nut-devel 2.8.5-9.fc44 Β· GPL-2.0-or-later AND GPL-3.0-or-later
- fedora 44: nut-devel 2.8.5-9.fc44 Β· GPL-2.0-or-later AND GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms