Nagios:...:Config(3)

πŸ“¦ version 0.36, in opensuse-leap 16.0

πŸ’… NAME

ok so bestie, meet Nagios::Plugin::Config β€” it reads nagios plugin .ini style config files. that's it, that's the whole vibe. it reads files, it does not write them, periodt.


✨ SYNOPSIS ✨

# Read given nagios plugin config file
$Config = Nagios::Plugin::Config->read( '/etc/nagios/plugins.ini' );

# Search for and read default nagios plugin config file
$Config = Nagios::Plugin::Config->read();

# Access sections and properties (returns scalars or arrayrefs)
$rootproperty =  $Config->{_}->{rootproperty};
$one = $Config->{section}->{one};
$Foo = $Config->{section}->{Foo};

like, you literally just call read and then poke at hash keys. the {_} one is the root section btw, iykyk 🫢


🌸 DESCRIPTION 🌸

Nagios::Plugin::Config is a subclass of the excellent Config::Tiny β€” yes, we're stanning. it's the same iconic energy, just with these glow-ups:

  • repeated keys are allowed within sections πŸŽ€ and they come back as lists instead of scalars. so when a key shows up more than once you get an arrayref situation, not a sad lone value.
  • write functionality has been removed, meaning access is read only. you look, you don't touch. no cap.
  • Nagios::Plugin::Config searches for a default nagios plugins file if you don't hand read() an explicit filename. the current standard locations it checks are:
/etc/nagios/plugins.ini
/usr/local/nagios/etc/plugins.ini
/usr/local/etc/nagios /etc/opt/nagios/plugins.ini
/etc/nagios-plugins.ini
/usr/local/etc/nagios-plugins.ini
/etc/opt/nagios-plugins.ini

(copy those exactly bestie, don't get creative with them πŸ™ˆ)

to use a custom location, set a NAGIOS_CONFIG_PATH environment variable to the set of directories that should be checked. the first plugins.ini or nagios-plugins.ini file found will be used. first come, first served, main character wins πŸ‘‘

⭐ lowkey important: it's NAGIOS_CONFIG_PATH holding directories, and the winner is whichever of plugins.ini / nagios-plugins.ini it finds first.

πŸ¦‹ SEE ALSO πŸ¦‹

Config::Tiny, Nagios::Plugin

go give them a follow, they're the family πŸ’–


πŸ‘‘ AUTHORS πŸ‘‘

this code is maintained by the Nagios Plugin Development Team: <http://nagiosplug.sourceforge.net>.


Copyright (C) 2006-2007 by Nagios Plugin Development Team

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


and that's the whole thing, bestie ✨ this masterpiece dropped in the perl v5.42.0 era, dated 2024-03-04, and it's filed under Nagios:...:Config(3) β€” mwah, slay, go read some .ini files πŸ“πŸ§šπŸ’œ

πŸ“¦ where this page comes from