NUTSCAN_INIT(3)

✨ NUTSCAN_INIT β€” the lil' startup ritual for the nutscan library ✨

okay bestie, so this is a page from the NUT Manual β€” section 3, NUTSCAN_INIT(3) β€” and honestly? it's short but it's load-bearing, so lock in for like two minutes πŸ’–


🌸 NAME 🌸

nutscan_init β€” Initialize the nutscan library.

yes. that's it. that's the whole job. but bestie, if you skip it, everything else breaks, so let's go 🫢


πŸŽ€ SYNOPSIS πŸŽ€

#include <nut-scan.h>

void nutscan_init(void);

that's the whole vibe. no args, no return value, just vibes and initialization ✨


πŸ’… DESCRIPTION πŸ’…

okay so here's the tea, and it's non-negotiable tea: you must call nutscan_init() at least once before you use any other function in the nutscan library. not once per function, not "eh I'll get to it" β€” at least once, before anything else. periodt. πŸ‘‘

what it does is it updates a bunch of global variables, and those globals are basically the library telling you "hey, here's what I can actually do on this machine right now." so as a nutscan user you can check them at run-time and know which scan methods are available. no guessing, no praying, just facts πŸ’…

and the availability depends on which further libraries are installed on your system:

  • nutscan_avail_avahi = 1: AVAHI NUT scan is available πŸ¦‹
  • nutscan_avail_ipmi = 1: IPMI scan is available
  • nutscan_avail_nut = 1: the "Old" NUT method is available
  • nutscan_avail_nut_simulation = 1: the NUT simulation devices method is available
  • nutscan_avail_snmp = 1: SNMP method is available
  • nutscan_avail_usb = 1: USB method is available
  • nutscan_avail_xml_http = 1: XML HTTP method is available 🌈
⚠️ important, bestie, do not skip this: if one of those variables says a method is unavailable, then calling the matching nutscan_scan_* function will always return NULL. every single time. no exceptions. it's giving "the door is locked and there is no key" πŸ’€

🧚 NOTES 🧚

technically β€” and I do mean technically β€” the function is currently defined in the nutscan-init.h file. iykyk πŸ™ˆ


πŸ’œ SEE ALSO πŸ’œ

go read these too, they're all part of the same friend group:


and that's the whole page, bestie πŸŽ€ this lil' slice of the Network UPS Tools 2.8.5 manual is dated 10/07/2026, so go forth, call nutscan_init() first, and slay πŸ’–βœ¨πŸŒΈ

πŸ“¦ where this page comes from