<commit_before># System Api
System Api is a REST-interface to your computers hardware. it uses [Sigar](https://github.com/hyperic/sigar) to gather information about your system and publishes that information in the JSON format with the help of [Dropwizard](https://github.com/dropwizard/dropwizard).
You can run this application on a bunch of different platforms. Take a look at [Sigars wiki](https://support.hyperic.com/display/SIGAR/Home) to get an idea if you can run this on your system.

Feel free to create issues or make pull requests.

# Usage
The project uses [Maven](https://maven.apache.org/) so assuming you have mvn and git on your path:

```sh
git clone [this repo] sys-api
```
```sh
mvn clean install
```

This will download the necessary Sigar native files and extract them under server/target/lib

You should now be able to:

```sh
cd server
java -jar target/system-api.jar server dev.yml
```

If you want to package everything needed to run this application in a *.zip*, *tar.gz* and *tar.bz2*:

```sh
mvn clean package
```

And the resulting files should be located in */server/target/*

## Configuration reference
The dev.yml file is a Dropwizard configuration file. Have a look at the [Dropwizard configuration reference](https://dropwizard.github.io/dropwizard/manual/configuration.html).

Apart from the standard Dropwizard configurations you need to specify what username and password to be used for the Basic Authentication like so:

    user:
        username: [change me]
        password: [<PASSWORD>]

The application will attempt to resolve the location of the Sigar native files by itself. So the native files need to be contained in a directory named lib in the same directory as the .jar executable. 
This has been tested on Mac OSX Yosemite and Windows 8.1. However, if you get *UnsatisfiedLinkError*'s you can override the location by specifying:

    sigarLocation: [absolute path to lib folder]

### Want HTTPS?

Take a look at this guide: [Dropwizard and SSL](http://clearthehaze.com/2014/09/dropwizard-ssl/)<commit_msg>Added more instructions to README.md<commit_after># System Api
System Api is a REST-interface to your computers hardware. it uses [Sigar](https://github.com/hyperic/sigar) to gather information about your system and publishes that information in the JSON format with the help of [Dropwizard](https://github.com/dropwizard/dropwizard).
You can run this application on a bunch of different platforms. Take a look at [Sigars wiki](https://support.hyperic.com/display/SIGAR/Home) to get an idea if you can run this on your system.

Feel free to create issues or make pull requests.

# Usage
The project uses [Maven](https://maven.apache.org/) so assuming you have mvn and git on your path:

```sh
git clone [this repo] sys-api
```
```sh
mvn clean install
```

This will download the necessary Sigar native files and extract them under server/target/lib

You should now be able to:


```sh
cd server
java -jar target/system-api.jar server dev.yml
```
If you got everything working you should now be able to:

```sh
curl -i --user user:password -H "Accept: application/json" -X GET http://localhost:8080/system
```

If you want to package everything needed to run this application in a *.zip*, *tar.gz* and *tar.bz2*:

```sh
mvn clean package
```

And the resulting files should be located in */server/target/*

## Configuration reference
The dev.yml file is a Dropwizard configuration file. Have a look at the [Dropwizard configuration reference](https://dropwizard.github.io/dropwizard/manual/configuration.html).

Apart from the standard Dropwizard configurations you need to specify what username and password to be used for the Basic Authentication like so:

    user:
        username: [change me]
        password: [<PASSWORD>]

The application will attempt to resolve the location of the Sigar native files by itself. So the native files need to be contained in a directory named lib in the same directory as the .jar executable. 
This has been tested on Mac OSX Yosemite and Windows 8.1. However, if you get *UnsatisfiedLinkError*'s you can override the location by specifying:

    sigarLocation: [absolute path to lib folder]

### But I want HTTPS?

Take a look at this guide: [Dropwizard and SSL](http://clearthehaze.com/2014/09/dropwizard-ssl/)
{'fraction_non_alphanumeric': 0.08145741471339057, 'fraction_numerical': 0.0051055929449988395, 'mean_word_length': 4.24330900243309, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6138819', 'n_tokens_mistral': 1230, 'n_tokens_neox': 1160, 'n_words': 581}