Sign inSign up

eoprede/oxidized

By eoprede

•Updated about 4 years ago

This is a slightly modified container for oxidized, supporting arm64

Image
0

2.0K

eoprede/oxidized repository overview

This container has the following differences from original 1:

  1. It doesn't have any additional schedulers or services, it just runs oxidized command. This puts logs in foreground and allows for easy access from kubectl
  2. It runs slightly modified oxidized-web gem - https://github.com/ytti/oxidized-web/pull/223⁠ You can use environment variables BASIC_AUTH_USERNAME and BASIC_AUTH_PASSWORD to set basic authentication without relying on reverse proxy.
  3. It runs on arm64 as well

If you want to run this in k8s, you can use the following manifest. I would strongly suggest using persistent storage backend, I am using longhorn.

---
apiVersion: v1
kind: Secret
metadata:
  name: oxi-conf
  labels:
    app: oxidized
type: Opaque
stringData:
  router.db: |-
    router.something.local:192.168.1.1:junos
  config: |-
    username: admin
    password: pass
    model: junos
    resolve_dns: true
    interval: 3600
    use_syslog: false
    debug: false
    threads: 30
    timeout: 20
    retries: 3
    prompt: !ruby/regexp /^([\w.@-]+[#>]\s?)$/
    rest: 0.0.0.0:8888
    next_adds_job: false
    vars: {}
    groups: {}
    models: {}
    pid: "/tmp/pid"
    crash:
      directory: "/root/.config/oxidized/crashes"
      hostnames: false
    stats:
      history_size: 10
    input:
      default: ssh, telnet
      debug: false
      ssh:
        secure: false
      ftp:
        passive: true
      utf8_encoded: true
    output:
      default: git
      git:
        user: backup
        email: [email protected]
        repo: /root/.config/oxidized/git-configs
    source:
      default: csv
      csv:
        file: "/root/.config/oxidized/router.db"
        delimiter: !ruby/regexp /:/
        map:
          name: 0
          ip: 1
          model: 2
    model_map:
      juniper: junos
      cisco: ios
    models:
      fortios:
        vars:
          remove_secret: true
    hooks:
      push_to_remote:
        type: githubrepo
        events: [post_store]
        remote_repo: http://github.something.com/backup/configs.git
        username: backup
        password: backup
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
    app: oxidized
  name: oxidized
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: longhorn
  resources:
    requests:
      storage: 1Gi
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: oxidized
  name: oxidized-tcp
spec:
  ports:
    - name: "8888"
      port: 80
      targetPort: 8888
  selector:
    app: oxidized
  type: LoadBalancer
  loadBalancerIP: 192.168.2.56
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app: oxidized
  name: oxidized
spec:
  replicas: 1
  serviceName: oxidized
  selector:
    matchLabels:
      app: oxidized
  template:
    metadata:
      labels:
        app: oxidized
    spec:
      initContainers:
        - name: copy-config
          image: busybox
          command: ['sh', '-c', 'cp -f /foo/* /root/.config/oxidized']
          volumeMounts:
            - name: foo
              mountPath: /foo
            - name: config
              mountPath: /root/.config/oxidized
      containers:
        - image: eoprede/oxidized:1.1
          name: oxidized
          env:
            - name: BASIC_AUTH_USERNAME
              value: user
            - name: BASIC_AUTH_PASSWORD
              value: pass
          ports:
            - containerPort: 8888
          volumeMounts:
            - name: config
              mountPath: "/root/.config/oxidized"
      restartPolicy: Always
      volumes:
        - name: foo
          secret:
            secretName: oxi-conf
            items:
              - key: config
                path: config
              - key: router.db
                path: router.db
        - name: config
          persistentVolumeClaim:
            claimName: oxidized

Running container from docker is not much different than the standard oxidized one:

docker run --rm -v /etc/oxidized:/root/.config/oxidized -p 8888:8888/tcp -t eoprede/oxidized:latest oxidized

I will have a decent readme eventually, but for now here's the Dockerfile for your enjoyment:

FROM ruby:2.7.4-alpine3.14

RUN apk add cmake make g++ icu-dev git openssl-dev libssh2-dev mailx

# build and install oxidized
COPY . /tmp/oxidized/
WORKDIR /tmp/oxidized

# docker automated build gets shallow copy, but non-shallow copy cannot be unshallowed
#RUN git fetch --unshallow || true
RUN rake install

# web interface
# You can get standard one with
#RUN gem install oxidized-web
#But I am using custom one referenced in PR above, I just copied gem over to local folder
RUN gem install pkg/oxidized-web-0.13.1.gem

EXPOSE 8888/tcp

ENV OXIDIZED_HOME=/oxidized

CMD oxidized

Tag summary

Content type

Image

Digest

Size

149.1 MB

Last updated

over 4 years ago

docker pull eoprede/oxidized