PYNAG(1)
π PYNAG π
okay bestie, this is the pynag(1) manual page and honestly? it's giving power tool. buckle up π
β¨ NAME β¨
pynag β command line front for manipulating nagios configuration. that's it, that's the vibe π
β¨ SYNOPSIS β¨
pynag <sub-command> [options] [arguments]
β¨ DESCRIPTION β¨
so like, pynag is a command-line utility that you can use to view or change your current nagios configuration. no cap, it just does the thing π¦
β¨ SUB-COMMANDS β¨
list πΈ
print to screen nagios configuration objects as specified by a WHERE clause. yes, a WHERE clause, we're doing SQL energy in a nagios config, periodt π
pynag list [attribute1] [attribute2] [WHERE ...]
update β¨
modify specific attributes of nagios objects as specified by a WHERE and SET clause. glow-up for your objects, fr fr π₯
pynag update set attr1=value WHERE attr=value and attr=value
delete π
Delete objects from nagios configuration as specified by a WHERE clause. it's giving cleanup era π
pynag delete delete <WHERE ...>
add π
Add a new object definition. brand new object, main character energy π
pynag add <object_type> <attr1=value1> [attr2=value2]
copy π§
Copy objects, specifiying which attributes to change. (that's the original spelling, we don't fix it, we honor it π)
pynag copy <WHERE ...> <SET attr1=value1 [attr2=value2] ...>
execute β
Executes the currently configured check command for a host or a service. live run, no simulation π
pynag execute <host_name> [service_description]
config π
modify values in main nagios configuration file (nagios.cfg)
pynag config [--set <attribute=value>] [--old_value=attribute]
pynag config [--append <attribute=value>] [--old_value=attribute]
pynag config [--remove <attribute>] [--old_value=attribute]
pynag config [--get <attribute>]
β¨ WHERE STATEMENTS β¨
Some Subcommands use WHERE statements to filter which objects to work with. Where has certain similarity with SQL syntax. yes bestie, it's SQL-coded π«Ά
Syntax:
WHERE <attr=value> [AND attr=value] [OR attr=value]
[another where statement]
where attr is any nagios attribute (i.e. host_name or service_description).
Example:
pynag list WHERE host_name=localhost and object_type=service
pynag list WHERE object_type=host or object_type=service
Any search attributes have the same syntax as the pynag filter. For example these work just fine:
pynag list WHERE host_name__contains=production
pynag list WHERE host_name__startswith=prod
pynag list WHERE host_name__notcontains=test
pynag list host_name address WHERE address__exists=True
pynag list host_name WHERE register__isnot=0
The pynag filter supports few parameters that are not just attributes. the little extras, the secret menu π
Example:
filenameβ The filename which the object belongsidβ pynag unique identifier for the objecteffective_command_lineβ command which nagios will execute
Of course these can be combined with the pynag filter syntax:
pynag list where filename__startswith=/etc/nagios/conf.d/
pynag list host_name service_description effective_command_line
For detailed description of the filter see pydoc for pynag.Model.ObjectDefintion.filter()
β οΈ note: that's ObjectDefintion with the typo, exactly as written. do not come for me, I did not type it, I am simply the messenger π
β¨ SET STATEMENTS β¨
Subcommands that use SET statements (like update or copy) use them a list of attributes change for a specific object.
Syntax:
SET <attr1=value1> [attr2=value2] [...]
Example:
pynag update SET address=127.0.0.1 WHERE host_name=localhost and object_type=host
β¨ EXAMPLES β¨
πΈ List all services that have myhost as a host_name
pynag list host_name service_description WHERE host_name=myhost and object_type=service
π₯ Set check_period to 24x7 on all services that belong to host myhost
pynag update set check_period=24x7 WHERE host_name=myhost
β¨ list examples
pynag list host_name address WHERE object_type=host
pynag list host_name service_description WHERE host_name=examplehost and object_type=service
π update examples
pynag update SET host_name=newhostname WHERE host_name=oldhostname
pynag update SET address=127.0.0.1 WHERE host_name='examplehost.example.com' and object_type=host
π copy examples
pynag copy SET host_name=newhostname WHERE host_name=oldhostname
pynag copy SET address=127.0.0.1 WHERE host_name='examplehost.example.com' and object_type=host
π¦ add examples
pynag add host host_name=examplehost use=generic-host address=127.0.0.1
pynag add service service_description="Test Service" use="check_nrpe" host_name="localhost"
π delete examples
pynag delete where object_type=service and host_name='mydeprecated_host'
pynag delete where filename__startswith='/etc/nagios/myoldhosts'
β execute examples
pynag execute localhost
pynag execute localhost "Disk Space
β οΈ yes, that last quote really is unterminated in the original. I'm not touching it, it's canon now π
β¨ ADDITIONAL RESOURCES β¨
See http://github.com/pynag/pynag.git for more information. go read it bestie, it's free education π
β¨ AUTHOR β¨
Pall Sigurdsson and Tomas Edwardsson π«Ά
β¨ COPYRIGHT β¨
2014, Pall Sigurdsson and Tomas Edwardsson
okay that's the whole page, you ate it, you understood it, you're basically a nagios config girlie now π this was pynag version 0.9.1 from August 05, 2014 β sending you off with a kiss, mwah πβ¨π
π¦ where this page comes from
- debian bookworm: pynag 1.1.2+dfsg-3 Β· GPL-2.0-only
- debian trixie: pynag 1.1.2+dfsg-3 Β· GPL-2.0-only
- ubuntu jammy: pynag 1.1.2+dfsg-2 Β· GPL-2.0-only
- ubuntu noble: pynag 1.1.2+dfsg-3 Β· GPL-2.0-only
- ubuntu questing: pynag 1.1.2+dfsg-3
- ubuntu resolute: pynag 1.1.2+dfsg-3build1 Β· GPL-2.0-only
- ubuntu stonking: pynag 1.1.2+dfsg-4 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms