Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
a0733f70e5 | |||
53dc8a68a3 | |||
a8ab382216 | |||
8d6b6eaa3c | |||
ea948d0bb3
|
|||
30c64cde60
|
|||
a5712a20a9
|
|||
36699bd248 | |||
3ab6814c16 | |||
9f19e12375
|
|||
917db84ebb | |||
7c7b175893
|
|||
057b2c3776
|
|||
15cfb7b51c
|
|||
2852f871ec
|
|||
cdb2eeceed
|
|||
31a548f08e |
@ -11,42 +11,6 @@ steps:
|
|||||||
when:
|
when:
|
||||||
- event: [push, tag]
|
- event: [push, tag]
|
||||||
|
|
||||||
scan:
|
|
||||||
image: quay.io/wollud1969/woodpecker-helper:0.5.1
|
|
||||||
environment:
|
|
||||||
TRIVY_TOKEN:
|
|
||||||
from_secret: trivy_token
|
|
||||||
TRIVY_URL:
|
|
||||||
from_secret: trivy_url
|
|
||||||
DTRACK_API_KEY:
|
|
||||||
from_secret: dtrack_api_key
|
|
||||||
DTRACK_API_URL:
|
|
||||||
from_secret: dtrack_api_url
|
|
||||||
commands:
|
|
||||||
- export GOPATH=/woodpecker/go # the export is required, otherwise trivy will not consider the variable
|
|
||||||
- HOME=/home/`id -nu`
|
|
||||||
- TAG="${CI_COMMIT_TAG:-$CI_COMMIT_SHA}"
|
|
||||||
- |
|
|
||||||
trivy fs \
|
|
||||||
--server $TRIVY_URL \
|
|
||||||
--token $TRIVY_TOKEN \
|
|
||||||
--format cyclonedx \
|
|
||||||
--scanners license \
|
|
||||||
--output /tmp/sbom.xml \
|
|
||||||
.
|
|
||||||
- cat /tmp/sbom.xml
|
|
||||||
- |
|
|
||||||
curl -X "POST" \
|
|
||||||
-H "Content-Type: multipart/form-data" \
|
|
||||||
-H "X-Api-Key: $DTRACK_API_KEY" \
|
|
||||||
-F "autoCreate=true" \
|
|
||||||
-F "projectName=$CI_REPO" \
|
|
||||||
-F "projectVersion=$TAG" \
|
|
||||||
-F "bom=@/tmp/sbom.xml"\
|
|
||||||
"$DTRACK_API_URL/api/v1/bom"
|
|
||||||
when:
|
|
||||||
- event: [push, tag]
|
|
||||||
|
|
||||||
dockerize:
|
dockerize:
|
||||||
image: plugins/kaniko
|
image: plugins/kaniko
|
||||||
settings:
|
settings:
|
||||||
@ -73,5 +37,5 @@ steps:
|
|||||||
- export KUBECONFIG=/tmp/kubeconfig
|
- export KUBECONFIG=/tmp/kubeconfig
|
||||||
- ./deployment/deploy.sh
|
- ./deployment/deploy.sh
|
||||||
when:
|
when:
|
||||||
- event: tag
|
- event: [tag]
|
||||||
|
|
||||||
|
@ -4,13 +4,122 @@
|
|||||||
"tlsEnable": "false",
|
"tlsEnable": "false",
|
||||||
"topic": "snmp"
|
"topic": "snmp"
|
||||||
},
|
},
|
||||||
"interval": 10,
|
"interval": 60,
|
||||||
"snmpEndpoints": [
|
"snmpEndpoints": [
|
||||||
|
{
|
||||||
|
"endpoint": "172.16.13.10",
|
||||||
|
"label": "david",
|
||||||
|
"community": "public",
|
||||||
|
"oidTopics": [
|
||||||
|
{
|
||||||
|
"oid": ".1.3.6.1.4.1.2021.10.1.3.1",
|
||||||
|
"label": "load1",
|
||||||
|
"diff": "false"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"oid": ".1.3.6.1.4.1.9676.123.1.4",
|
||||||
|
"label": "stratum",
|
||||||
|
"diff": "false"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"oid": ".1.3.6.1.4.1.9676.123.1.7",
|
||||||
|
"label": "rootdisp",
|
||||||
|
"diff": "false"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"oid": ".1.3.6.1.4.1.9676.123.2.3",
|
||||||
|
"label": "ss-reset",
|
||||||
|
"diff": "false"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"oid": ".1.3.6.1.4.1.9676.123.2.10",
|
||||||
|
"label": "processed-pkts",
|
||||||
|
"diff": "true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"oid": ".1.3.6.1.2.1.31.1.1.1.6.2",
|
||||||
|
"label": "lan-in",
|
||||||
|
"diff": "true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"oid": ".1.3.6.1.2.1.31.1.1.1.7.2",
|
||||||
|
"label": "lan-in-pkts",
|
||||||
|
"diff": "true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"oid": ".1.3.6.1.2.1.31.1.1.1.10.2",
|
||||||
|
"label": "lan-out",
|
||||||
|
"diff": "true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"oid": ".1.3.6.1.2.1.31.1.1.1.11.2",
|
||||||
|
"label": "lan-out-pkts",
|
||||||
|
"diff": "true"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"endpoint": "172.16.13.11",
|
||||||
|
"label": "harrison",
|
||||||
|
"community": "public",
|
||||||
|
"oidTopics": [
|
||||||
|
{
|
||||||
|
"oid": ".1.3.6.1.4.1.2021.10.1.3.1",
|
||||||
|
"label": "load1",
|
||||||
|
"diff": "false"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"oid": ".1.3.6.1.4.1.9676.123.1.4",
|
||||||
|
"label": "stratum",
|
||||||
|
"diff": "false"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"oid": ".1.3.6.1.4.1.9676.123.1.7",
|
||||||
|
"label": "rootdisp",
|
||||||
|
"diff": "false"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"oid": ".1.3.6.1.4.1.9676.123.2.3",
|
||||||
|
"label": "ss-reset",
|
||||||
|
"diff": "false"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"oid": ".1.3.6.1.4.1.9676.123.2.10",
|
||||||
|
"label": "processed-pkts",
|
||||||
|
"diff": "true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"oid": ".1.3.6.1.2.1.31.1.1.1.6.2",
|
||||||
|
"label": "lan-in",
|
||||||
|
"diff": "true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"oid": ".1.3.6.1.2.1.31.1.1.1.7.2",
|
||||||
|
"label": "lan-in-pkts",
|
||||||
|
"diff": "true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"oid": ".1.3.6.1.2.1.31.1.1.1.10.2",
|
||||||
|
"label": "lan-out",
|
||||||
|
"diff": "true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"oid": ".1.3.6.1.2.1.31.1.1.1.11.2",
|
||||||
|
"label": "lan-out-pkts",
|
||||||
|
"diff": "true"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"endpoint": "172.16.3.1",
|
"endpoint": "172.16.3.1",
|
||||||
"label": "router",
|
"label": "router",
|
||||||
"community": "public",
|
"community": "public",
|
||||||
"oidTopics": [
|
"oidTopics": [
|
||||||
|
{
|
||||||
|
"oid": ".1.3.6.1.2.1.25.3.3.1.2.1",
|
||||||
|
"label": "load1",
|
||||||
|
"diff": "false"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"oid": ".1.3.6.1.2.1.31.1.1.1.6.5",
|
"oid": ".1.3.6.1.2.1.31.1.1.1.6.5",
|
||||||
"label": "wan-in",
|
"label": "wan-in",
|
||||||
@ -22,23 +131,6 @@
|
|||||||
"diff": "true"
|
"diff": "true"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
"endpoint": "172.16.3.3",
|
|
||||||
"label": "switch-cluster",
|
|
||||||
"community": "public",
|
|
||||||
"oidTopics": [
|
|
||||||
{
|
|
||||||
"oid": ".1.3.6.1.2.1.31.1.1.1.6.1",
|
|
||||||
"label": "uplink-in",
|
|
||||||
"diff": "true"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"oid": ".1.3.6.1.2.1.31.1.1.1.10.1",
|
|
||||||
"label": "uplink-out",
|
|
||||||
"diff": "true"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,9 @@ func calculateDifference(key string, newValue string) (string, error) {
|
|||||||
Timestamp: currentTime,
|
Timestamp: currentTime,
|
||||||
Value: newValue,
|
Value: newValue,
|
||||||
}
|
}
|
||||||
|
if diffValuePerSecond < 0 {
|
||||||
|
return "", fmt.Errorf("negative difference value: %d", diffValuePerSecond)
|
||||||
|
}
|
||||||
return strconv.Itoa(diffValuePerSecond), nil
|
return strconv.Itoa(diffValuePerSecond), nil
|
||||||
} else {
|
} else {
|
||||||
log.Printf("create lvv for %s", key)
|
log.Printf("create lvv for %s", key)
|
||||||
|
45
tools/mysnmpwalk.sh
Executable file
45
tools/mysnmpwalk.sh
Executable file
@ -0,0 +1,45 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
COMMUNITY=""
|
||||||
|
HOST=""
|
||||||
|
BASE_OID=""
|
||||||
|
|
||||||
|
while getopts "c:h:b:" option; do
|
||||||
|
case $option in
|
||||||
|
c) COMMUNITY=$OPTARG
|
||||||
|
;;
|
||||||
|
h) HOST=$OPTARG
|
||||||
|
;;
|
||||||
|
b) BASE_OID=$OPTARG
|
||||||
|
;;
|
||||||
|
?)
|
||||||
|
echo "Usage $0 -c COMMUNITY -h HOST -b BASE_OID"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$COMMUNITY" = "" ]; then
|
||||||
|
echo "Set a community using -c"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$HOST" = "" ]; then
|
||||||
|
echo "Set a host using -h"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$BASE_OID" = "" ]; then
|
||||||
|
echo "Set a base oid using -b"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
snmpwalk -v 2c -c $COMMUNITY -On $HOST $BASE_OID | while read -r line; do
|
||||||
|
oid=`echo $line | awk '{print $1}'`
|
||||||
|
textoid=`snmptranslate $oid`
|
||||||
|
value=`echo $line | cut -d ' ' -f 3-`
|
||||||
|
echo "$oid ($textoid): $value"
|
||||||
|
done
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user