Our company is trying to develop a script for automatic sending of helpdesk reports from the Nagios Services table (in Nagios Core) and we recently encountered several problems.
The idea is of calling a server side PHP script through the built-in "notes_url" functionality that will create an icon with a link by each service of each host. This script should get parameters like a username of the user who sent the report and an additional information about the reported service. The question is, whether and how is it possible to determine these information from the script?
We tried to pass the service informaion via standard nagios macros ($SERVICEDISPLAYNAME$, $SERVICEOUTPUT$ etc.) passed as parameters of the script, but in the Services table, only host macros are readable, though. Service macros are inaccessible (which is surprising).
Considering the username, I estimate Nagios Core is using apache session for user login. Is there any environmental variable that can be accessed to retrieve it?
Nagios Core Macros + username stored in session
-
nejsemzprahy
- Posts: 2
- Joined: Sun Mar 18, 2012 9:28 am
-
nejsemzprahy
- Posts: 2
- Joined: Sun Mar 18, 2012 9:28 am
Re: Nagios Core Macros + username stored in session
OK, figured it out somehow by myself...
To pass the username I created a cookie.
The only service macro that is usable in All Unhandled table is $SERVICEDESC$, which passes a name of the service. Inside the script I use the name of the service and a name of the service's host to get all desired data from the nagios database.
To pass the username I created a cookie.
The only service macro that is usable in All Unhandled table is $SERVICEDESC$, which passes a name of the service. Inside the script I use the name of the service and a name of the service's host to get all desired data from the nagios database.