Access via API or other method

Is there a way to get data from Continua CI by a REST- or other API call?
I’m trying to monitor our server with Zabbix, but I’m not able to get a working connection with a Zabbix http-agent item.
None of the available authentication methods (basic, ntlm, kerberos, digest) is able to connect. I’m getting http error 401 (not autorized).

Hi Bernd,

We don’t currently have a REST API, although it is planned (and partially implemented for v2).

We have not used Zabbix, but I assume that you are using it’s web monitoring feature to check the Continua CI website availability.

Continua CI uses form-based authentication with an authorisation cookie to store the session.
Depending on the authentication method (forms, ldap or mixed) which was set during installation or in the server configuration file, this cookie is created after entering username and password into the login page or after redirecting to the /WindowsAuthentication virtual directory.

Based on the Zabbix documentation then you should be able to set up a “web scenario” which involves sending username and password data to the /account/login page. Although, it’s not clear whether Zabbix handles session cookies at all - see Web Scenario login Cookies and Session IDs and Cookie sessions in Web scenarios.

If you are only interested monitoring whether the site is running, then perhaps you only need to monitor the /account/login page without any authentication.

Hi Dave,

If you are only interested monitoring whether the site is running, then perhaps you only need to monitor the /account/login page without any authentication.

… we are already monitoring the availability, what works fine.

My idea was to login and parse the dashboard page for the number of queued builds.
If this number is greater than a specific amount, there will be hanging builds and we have to look after it.

I dont’t know either how Zabbix is handling session cookies.
I will continue my investigations - thanks for your reply.

Another way could be a query against the database.
Zabbix supports ODBC. I will search for a Postgre driver for Linux.

FYI:
I found a way to monitor Continua by Zabbix with an item of type ‘external script’ :smiley:
Create a shell script /usr/lib/zabbix/externalscripts/continua.sh with the following content:

 curl --location 'https://<your_url_to_continua>/account/login' --header 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'UserName=<your_username>' --data-urlencode 'password=<your_password>' --insecure -b --cookie

As a result the item fetches the complete dashboard page.
It’s now easy to create dependent items with RegEx to fetch the desired data.

1 Like