Skip to content

Commit

Permalink
rebrand and re-release to 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
marshyski committed May 4, 2021
1 parent a48ee13 commit 8e06913
Show file tree
Hide file tree
Showing 52 changed files with 509 additions and 377 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Build yeti-discover binary
- name: Build cmon binary
run: make docker

- name: Build distroless image
run: |
docker build --build-arg GOOS=linux -t yeti-discover:${{ github.sha }} -f Dockerfile-distroless .
docker build --build-arg GOOS=linux -t cmon:${{ github.sha }} -f Dockerfile-distroless .
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'yeti-discover:${{ github.sha }}'
image-ref: 'cmon:${{ github.sha }}'
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results.sarif'
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ _testmain.go
*.exe
*.test
*.prof
yeti-discover
yeti-discover-*
cmon
cmon-*
vendor
*.rpm
*.deb
Expand Down
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ FROM golang

ARG GOOS

RUN mkdir -p /go/src/github.com/yeticloud/yeti-discover
RUN mkdir -p /go/src/github.com/perlogix/cmon
RUN go get -u golang.org/x/lint/golint
RUN curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.6.1
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.34.1
WORKDIR /go/src/github.com/yeticloud/yeti-discover
WORKDIR /go/src/github.com/perlogix/cmon

COPY ./ ./

RUN ls -la ./

RUN make lint
RUN make GOOS=${GOOS} build
4 changes: 2 additions & 2 deletions Dockerfile-distroless
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM gcr.io/distroless/base
COPY ./yeti-discover /app/
COPY ./cmon /app/

CMD [ "/app/yeti-discover" ]
CMD [ "/app/cmon" ]
2 changes: 1 addition & 1 deletion Dockerfile-pkgs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ RUN apt-get update
RUN apt-get install -y ruby ruby-dev rubygems build-essential rpm git
RUN gem install --no-document fpm
COPY ./packaging /packaging
COPY ./yeti-discover /
COPY ./cmon /
WORKDIR /packaging
RUN /packaging/package.sh ${VER}
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
MAIN_PACKAGE := yeti-discover
MAIN_PACKAGE := cmon
BUILT_ON := $(shell date)
GOOS := $(shell uname -s | tr '[:upper:]' '[:lower:]')
COMMIT_HASH:=$(shell git log -n 1 --pretty=format:"%H")
PACKAGES:=$(shell go list ./... | grep -v /vendor/)
GO_LINUX := GOOS=linux GOARCH=amd64
GO_OSX := GOOS=darwin GOARCH=amd64
GO_WIN := GOOS=darwin GOARCH=amd64
VER := 1.3
LDFLAGS := '-s -w -X "github.com/yeticloud/yeti-discover/config.builtOn=$(BUILT_ON)" -X "github.com/yeticloud/yeti-discover/config.commitHash=$(COMMIT_HASH)" -X "github.com/yeticloud/yeti-discover/config.version=$(VER)"'
VER := 1.0
LDFLAGS := '-s -w -X "github.com/perlogix/cmon/config.builtOn=$(BUILT_ON)" -X "github.com/perlogix/cmon/config.commitHash=$(COMMIT_HASH)" -X "github.com/perlogix/cmon/config.version=$(VER)"'

default: build

Expand Down Expand Up @@ -47,7 +47,7 @@ update-deps:
docker:
sudo docker build --build-arg GOOS=$(GOOS) -t $(MAIN_PACKAGE)-build .
sudo docker create --name $(MAIN_PACKAGE)-build $(MAIN_PACKAGE)-build
sudo docker cp $(MAIN_PACKAGE)-build:/go/src/github.com/yeticloud/$(MAIN_PACKAGE)/$(MAIN_PACKAGE) ./
sudo docker cp $(MAIN_PACKAGE)-build:/go/src/github.com/perlogix/$(MAIN_PACKAGE)/$(MAIN_PACKAGE) ./
sudo docker rm -f $(MAIN_PACKAGE)-build

pkgs:
Expand Down
47 changes: 19 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# yeti-discover
# cmon

[![Go Report Card](https://goreportcard.com/badge/github.com/yeticloud/yeti-discover)](https://goreportcard.com/report/github.com/yeticloud/yeti-discover)
![Go](https://github.com/yeticloud/yeti-discover/workflows/Go/badge.svg)
[![Go Report Card](https://goreportcard.com/badge/github.com/perlogix/cmon)](https://goreportcard.com/report/github.com/perlogix/cmon)
![Go](https://github.com/perlogix/cmon/workflows/Go/badge.svg)

#### Table of Contents

Expand All @@ -16,7 +16,6 @@
6. [Configuration](#configuration)
7. [Vagrant](#vagrant)
8. [Platforms Tested On](#platforms-tested-on)
9. [Screenshots](#screenshots)

## Overview

Expand Down Expand Up @@ -355,39 +354,39 @@ If you were to delete all hosts in the environment nightly. If the agent is runn

Example with cURL:

If you want to manually / cron schedule yeti-discover to post to ElasticSearch
If you want to manually / cron schedule cmon to post to ElasticSearch

```sh
# HTTP unauth
sudo ./yeti-discover | curl -XPOST -H "Content-Type: application/json" -d @- "http://localhost:9200/servers/_doc/$(hostid)"
sudo ./cmon | curl -XPOST -H "Content-Type: application/json" -d @- "http://localhost:9200/servers/_doc/$(hostid)"


# Insecure SSL and basic auth
sudo ./yeti-discover | curl -XPOST -k -u admin:admin -H "Content-Type: application/json" -d @- "https://localhost:9200/servers/_doc/$(hostid)"
sudo ./cmon | curl -XPOST -k -u admin:admin -H "Content-Type: application/json" -d @- "https://localhost:9200/servers/_doc/$(hostid)"
```

## Install

Install the statically linked Linux binary:

```sh
curl -OL "https://github.com/yeticloud/yeti-discover/releases/download/1.2/yeti-discover" && chmod -f 0755 ./yeti-discover
curl -OL "https://github.com/perlogix/cmon/releases/download/1.0/cmon" && chmod -f 0755 ./cmon
```

Install DEB file:

```sh
curl -LO $(curl -s https://api.github.com/repos/yeticloud/yeti-discover/releases/latest | grep browser_download_url | grep deb | cut -d '"' -f 4)
curl -LO $(curl -s https://api.github.com/repos/perlogix/cmon/releases/latest | grep browser_download_url | grep deb | cut -d '"' -f 4)

dpkg -i ./yeti-discover*.deb
dpkg -i ./cmon*.deb
```

Install RPM file:

```sh
curl -LO $(curl -s https://api.github.com/repos/yeticloud/yeti-discover/releases/latest | grep browser_download_url | grep rpm | cut -d '"' -f 4)
curl -LO $(curl -s https://api.github.com/repos/perlogix/cmon/releases/latest | grep browser_download_url | grep rpm | cut -d '"' -f 4)

rpm -i ./yeti-discover*.rpm
rpm -i ./cmon*.rpm
```

**ElasticSearch Mappings Needed**
Expand Down Expand Up @@ -428,17 +427,17 @@ make docker
To build the RPM and Deb packages with Docker run the following command:

```sh
make VER=1.2 pkgs
make VER=1.0 pkgs
```

## Getting Started Vagrant

```sh
git clone https://github.com/yeticloud/yeti-discover.git
git clone https://github.com/perlogix/cmon.git

cd yeti-discover
cd cmon

curl -LO "https://github.com/yeticloud/yeti-discover/releases/download/1.2/yeti-discover"
curl -LO "https://github.com/perlogix/cmon/releases/download/1.0/cmon"

vagrant up
```
Expand All @@ -448,13 +447,13 @@ vagrant up
No flags / arguments will do a one-time run and produce a JSON file in the current path of the binary

-d, --daemon Run in daemon mode
-c, --config Set configuration path, defaults are ['./','/etc/yeticloud','/opt/yeticloud','/usr/lib/yeticloud/yeti-discover']
-c, --config Set configuration path, defaults are ['./', '/opt/perlogix/cmon', '/etc/perlogix/cmon']

## Configuration

Configurations can be written in YAML, JSON or TOML.

_/opt/yeticloud/yeti-discover.yaml_
_/etc/perlogix/cmon/cmon.yaml_
_DEFAULT values if no config is present_

```yaml
Expand Down Expand Up @@ -498,8 +497,8 @@ oscap_profile: xccdf_org.ssgproject.content_profile_cis
## Vagrant
```sh
git clone https://github.com/yeticloud/yeti-discover.git
cd yeti-discover
git clone https://github.com/perlogix/cmon.git
cd cmon
vagrant up
vagrant ssh
```
Expand All @@ -511,11 +510,3 @@ vagrant ssh
- Ubuntu 16 - latest
- Mac OS X 16.7.0 - latest
- Windows 10 - latest

## Screenshots

![First View](https://yeticloud-public.s3.amazonaws.com/yeti-discover-kibana-1.png)

![Second View](https://yeticloud-public.s3.amazonaws.com/yeti-discover-kibana-2.png)

![Third View](https://yeticloud-public.s3.amazonaws.com/yeti-discover-kibana-3.png)
22 changes: 11 additions & 11 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/focal64"
config.vm.hostname = "yeti-discover-stack"
config.vm.hostname = "cmon-stack"
config.vm.network :private_network, ip: "10.20.1.32"
config.vm.network "forwarded_port", guest: 5601, host: 5601, auto_correct: true
config.vm.network "forwarded_port", guest: 9200, host: 9200, auto_correct: true
config.vm.network "forwarded_port", guest: 9600, host: 9600, auto_correct: true
config.vm.provider "virtualbox" do |v|
v.name = "yeti-discover-stack"
v.name = "cmon-stack"
v.memory = 4096
v.cpus = 2
v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
Expand Down Expand Up @@ -60,11 +60,11 @@ curl -XPUT -k -u admin:admin https://localhost:9200/servers
# Create ES Mapping for servers Index
curl -XPUT -k -u admin:admin "https://localhost:9200/servers/_mapping" -H 'Content-Type: application/json' -d@/vagrant/mapping.json
# Setup yeti-discover
if [[ -f "/vagrant/yeti-discover" ]]; then
mkdir -p /usr/lib/yeticloud/yeti-discover
# Setup cmon
if [[ -f "/vagrant/cmon" ]]; then
mkdir -p /etc/perlogix/cmon
cat <<'EOF'>/usr/lib/yeticloud/yeti-discover/yeti-discover.yml
cat <<'EOF'>/etc/perlogix/cmon/cmon.yaml
host: 127.0.0.1
port: 9200
username: admin
Expand All @@ -73,15 +73,15 @@ https: true
insecure_ssl: true
EOF
cp -f /vagrant/yeti-discover /usr/bin/
cp -f /vagrant/cmon /usr/bin/
else
curl -LO $(curl -s https://api.github.com/repos/yeticloud/yeti-discover/releases/latest | grep browser_download_url | grep deb | cut -d '"' -f 4)
dpkg -i ./yeti-discover*.deb
curl -LO $(curl -s https://api.github.com/repos/perlogix/cmon/releases/latest | grep browser_download_url | grep deb | cut -d '"' -f 4)
dpkg -i ./cmon*.deb
fi
cp -f /vagrant/yeti-discover /usr/bin/
cp -f /vagrant/cmon /usr/bin/
timeout 15 yeti-discover -d
timeout 15 cmon -d
# Test stack works, should return 2
curl -sk -u admin:admin https://localhost:9200/servers/_search | jq -r '.hits.hits[0]._source.cpu_count'
Expand Down
12 changes: 6 additions & 6 deletions cloud/aws.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// Copyright (C) YetiCloud
// This file is part of yeti-discover <https://github.com/yeticloud/yeti-discover>.
// Copyright (C) Perlogix
// This file is part of cmon <https://github.com/perlogix/cmon>.
//
// yeti-discover is free software: you can redistribute it and/or modify
// cmon is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// yeti-discover is distributed in the hope that it will be useful,
// cmon is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with yeti-discover. If not, see <http://www.gnu.org/licenses/>.
// along with cmon. If not, see <http://www.gnu.org/licenses/>.

package cloud

Expand All @@ -23,7 +23,7 @@ import (
"strings"
"time"

"github.com/yeticloud/yeti-discover/data"
"github.com/perlogix/cmon/data"
)

var c = &http.Client{Timeout: 10 * time.Millisecond}
Expand Down
14 changes: 7 additions & 7 deletions cloud/detect.go
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
// Copyright (C) YetiCloud
// This file is part of yeti-discover <https://github.com/yeticloud/yeti-discover>.
// Copyright (C) Perlogix
// This file is part of cmon <https://github.com/perlogix/cmon>.
//
// yeti-discover is free software: you can redistribute it and/or modify
// cmon is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// yeti-discover is distributed in the hope that it will be useful,
// cmon is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with yeti-discover. If not, see <http://www.gnu.org/licenses/>.
// along with cmon. If not, see <http://www.gnu.org/licenses/>.

package cloud

import (
detectCloud "github.com/yeticloud/libdetectcloud"
"github.com/yeticloud/yeti-discover/data"
"github.com/perlogix/cmon/data"
detectCloud "github.com/perlogix/libdetectcloud"
)

// DetectCloud detects if on cloud instance or container
Expand Down
Loading

0 comments on commit 8e06913

Please sign in to comment.