%> thruk -A thrukadmin 'showlog.cgi?view_mode=xls' > eventlog.xls
The command line tool 'thruk' allows the export of excel files and other reports. When using the source installation, the cli tool is in script/thruk, when using the packages it will be installed in '/usr/bin/thruk' and should be directly available in your PATH. Using the cli tool makes it easy to send regular reports by cron/mail.
Examples:
export the event log as excel file:
%> thruk -A thrukadmin 'showlog.cgi?view_mode=xls' > eventlog.xls
More examples can be found in the man page or by running 'thruk -h'.
It is possible to do comprehensive scripting with Thruk. For example set downtimes automatically, schedule reports or change the objects of your monitoring core configuration.
See CLI API for details and examples.
There are also some scripting examples in the examples folder.
Even when using the Cookie Authentication, it is still possible to use wget or curl for fetching pages.
%> curl "http://thrukadmin:thrukadmin@localhost/thruk/cgi-bin/status.cgi?format=json"
If your Object configuration is generated by a 3rd party config generator, you can export some additional information which is then displayed in the configuration section of each host or service. Just export the special custom variables: '_SRC', '_SRC2' or '_SRC3'.
Most scripts, either Server Actions
or Hooks
have access to special environment
variables.
These are the standard variables available:
REMOTE_USER
username of the logged in user
REMOTE_USER_GROUPS
contact groups of the current user
REMOTE_USER_ALIAS
contact alias name (if available)
REMOTE_USER_EMAIL
contact email address (if available)
THRUK_REQ_URL
contains the current url